1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.error; |
16 |
| |
17 |
| import org.apache.hivemind.ApplicationRuntimeException; |
18 |
| import org.apache.tapestry.IPage; |
19 |
| import org.apache.tapestry.IRequestCycle; |
20 |
| import org.apache.tapestry.StaleSessionException; |
21 |
| import org.apache.tapestry.services.ResponseRenderer; |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| public class StaleSessionExceptionPresenterImpl implements StaleSessionExceptionPresenter |
31 |
| { |
32 |
| private RequestExceptionReporter _requestExceptionReporter; |
33 |
| |
34 |
| private ResponseRenderer _responseRenderer; |
35 |
| |
36 |
| private String _pageName; |
37 |
| |
38 |
5
| public void presentStaleSessionException(IRequestCycle cycle, StaleSessionException cause)
|
39 |
| { |
40 |
5
| try
|
41 |
| { |
42 |
5
| IPage exceptionPage = cycle.getPage(_pageName);
|
43 |
| |
44 |
5
| cycle.activate(exceptionPage);
|
45 |
| |
46 |
5
| _responseRenderer.renderResponse(cycle);
|
47 |
| } |
48 |
| catch (Exception ex) |
49 |
| { |
50 |
| |
51 |
| |
52 |
| |
53 |
1
| _requestExceptionReporter.reportRequestException(ErrorMessages
|
54 |
| .unableToProcessClientRequest(cause), cause); |
55 |
| |
56 |
| |
57 |
| |
58 |
| |
59 |
1
| _requestExceptionReporter.reportRequestException(ErrorMessages
|
60 |
| .unableToPresentExceptionPage(ex), ex); |
61 |
| |
62 |
| |
63 |
| |
64 |
1
| throw new ApplicationRuntimeException(ex.getMessage(), ex);
|
65 |
| } |
66 |
| |
67 |
| } |
68 |
| |
69 |
3
| public void setPageName(String pageName)
|
70 |
| { |
71 |
3
| _pageName = pageName;
|
72 |
| } |
73 |
| |
74 |
2
| public void setRequestExceptionReporter(RequestExceptionReporter requestExceptionReporter)
|
75 |
| { |
76 |
2
| _requestExceptionReporter = requestExceptionReporter;
|
77 |
| } |
78 |
| |
79 |
3
| public void setResponseRenderer(ResponseRenderer responseRenderer)
|
80 |
| { |
81 |
3
| _responseRenderer = responseRenderer;
|
82 |
| } |
83 |
| |
84 |
| } |