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.StaleLinkException; |
21 |
| import org.apache.tapestry.services.ResponseRenderer; |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| public class StaleLinkExceptionPresenterImpl implements StaleLinkExceptionPresenter |
32 |
| { |
33 |
| private RequestExceptionReporter _requestExceptionReporter; |
34 |
| |
35 |
| private ResponseRenderer _responseRenderer; |
36 |
| |
37 |
| private String _pageName; |
38 |
| |
39 |
1
| public void presentStaleLinkException(IRequestCycle cycle, StaleLinkException cause)
|
40 |
| { |
41 |
1
| try
|
42 |
| { |
43 |
1
| IPage exceptionPage = cycle.getPage(_pageName);
|
44 |
| |
45 |
1
| exceptionPage.setProperty("message", cause.getMessage());
|
46 |
| |
47 |
1
| cycle.activate(exceptionPage);
|
48 |
| |
49 |
1
| _responseRenderer.renderResponse(cycle);
|
50 |
| } |
51 |
| catch (Throwable ex) |
52 |
| { |
53 |
| |
54 |
| |
55 |
| |
56 |
0
| _requestExceptionReporter.reportRequestException(ErrorMessages
|
57 |
| .unableToProcessClientRequest(cause), cause); |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
0
| _requestExceptionReporter.reportRequestException(ErrorMessages
|
63 |
| .unableToPresentExceptionPage(ex), ex); |
64 |
| |
65 |
| |
66 |
| |
67 |
0
| throw new ApplicationRuntimeException(ex.getMessage(), ex);
|
68 |
| } |
69 |
| |
70 |
| } |
71 |
| |
72 |
1
| public void setPageName(String pageName)
|
73 |
| { |
74 |
1
| _pageName = pageName;
|
75 |
| } |
76 |
| |
77 |
1
| public void setRequestExceptionReporter(RequestExceptionReporter requestExceptionReporter)
|
78 |
| { |
79 |
1
| _requestExceptionReporter = requestExceptionReporter;
|
80 |
| } |
81 |
| |
82 |
1
| public void setResponseRenderer(ResponseRenderer responseRenderer)
|
83 |
| { |
84 |
1
| _responseRenderer = responseRenderer;
|
85 |
| } |
86 |
| |
87 |
| } |