1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.portlet; |
16 |
| |
17 |
| import javax.portlet.ActionRequest; |
18 |
| import javax.portlet.ActionResponse; |
19 |
| |
20 |
| import org.apache.hivemind.ApplicationRuntimeException; |
21 |
| import org.apache.tapestry.IRequestCycle; |
22 |
| import org.apache.tapestry.StaleSessionException; |
23 |
| import org.apache.tapestry.error.RequestExceptionReporter; |
24 |
| import org.apache.tapestry.error.StaleSessionExceptionPresenter; |
25 |
| import org.apache.tapestry.services.ServiceConstants; |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| public class PortletStaleSessionExceptionPresenter implements StaleSessionExceptionPresenter |
32 |
| { |
33 |
| private PortletRequestGlobals _globals; |
34 |
| |
35 |
| private RequestExceptionReporter _requestExceptionReporter; |
36 |
| |
37 |
0
| public void presentStaleSessionException(IRequestCycle cycle, StaleSessionException cause)
|
38 |
| { |
39 |
0
| try
|
40 |
| { |
41 |
0
| String markup = PortletMessages.staleSession();
|
42 |
| |
43 |
0
| ActionRequest request = _globals.getActionRequest();
|
44 |
| |
45 |
0
| request.getPortletSession(true).setAttribute(
|
46 |
| PortletConstants.PORTLET_EXCEPTION_MARKUP_ATTRIBUTE, |
47 |
| markup); |
48 |
| |
49 |
0
| ActionResponse response = _globals.getActionResponse();
|
50 |
| |
51 |
0
| response.setRenderParameter(
|
52 |
| ServiceConstants.SERVICE, |
53 |
| PortletConstants.EXCEPTION_SERVICE); |
54 |
| } |
55 |
| catch (Exception ex) |
56 |
| { |
57 |
| |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
0
| _requestExceptionReporter.reportRequestException(PortletMessages
|
64 |
| .errorReportingException(ex), ex); |
65 |
| |
66 |
| |
67 |
| |
68 |
0
| throw new ApplicationRuntimeException(ex.getMessage(), ex);
|
69 |
| } |
70 |
| } |
71 |
| |
72 |
0
| public void setGlobals(PortletRequestGlobals globals)
|
73 |
| { |
74 |
0
| _globals = globals;
|
75 |
| } |
76 |
| |
77 |
0
| public void setRequestExceptionReporter(RequestExceptionReporter requestExceptionReporter)
|
78 |
| { |
79 |
0
| _requestExceptionReporter = requestExceptionReporter;
|
80 |
| } |
81 |
| } |