|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
DisableCachingFilter.java | - | 100% | 100% | 100% |
|
1 | // Copyright 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.services.impl; | |
16 | ||
17 | import java.io.IOException; | |
18 | ||
19 | import org.apache.hivemind.ErrorLog; | |
20 | import org.apache.hivemind.HiveMind; | |
21 | import org.apache.tapestry.services.ResetEventCoordinator; | |
22 | import org.apache.tapestry.services.WebRequestServicer; | |
23 | import org.apache.tapestry.services.WebRequestServicerFilter; | |
24 | import org.apache.tapestry.web.WebRequest; | |
25 | import org.apache.tapestry.web.WebResponse; | |
26 | ||
27 | /** | |
28 | * Filter whose job is to invoke | |
29 | * {@link org.apache.tapestry.services.ResetEventCoordinator#fireResetEvent()}after the request has | |
30 | * been processed. This filter is only contributed into the | |
31 | * tapestry.request.WebRequestServicerPipeline configuration if the | |
32 | * org.apache.tapestry.disable-caching system property is true. | |
33 | * | |
34 | * @author Howard M. Lewis Ship | |
35 | * @since 4.0 | |
36 | */ | |
37 | public class DisableCachingFilter implements WebRequestServicerFilter | |
38 | { | |
39 | private ErrorLog _errorLog; | |
40 | ||
41 | private ResetEventCoordinator _resetEventCoordinator; | |
42 | ||
43 | 2 | public void service(WebRequest request, WebResponse response, WebRequestServicer servicer) |
44 | throws IOException | |
45 | { | |
46 | 2 | try |
47 | { | |
48 | 2 | servicer.service(request, response); |
49 | } | |
50 | finally | |
51 | { | |
52 | 2 | fireResetEvent(); |
53 | } | |
54 | ||
55 | } | |
56 | ||
57 | 2 | private void fireResetEvent() |
58 | { | |
59 | 2 | try |
60 | { | |
61 | 2 | _resetEventCoordinator.fireResetEvent(); |
62 | } | |
63 | catch (Exception ex) | |
64 | { | |
65 | 1 | _errorLog.error(ImplMessages.errorResetting(ex), HiveMind.getLocation(ex), ex); |
66 | } | |
67 | } | |
68 | ||
69 | 2 | public void setResetEventCoordinator(ResetEventCoordinator resetEventCoordinator) |
70 | { | |
71 | 2 | _resetEventCoordinator = resetEventCoordinator; |
72 | } | |
73 | ||
74 | 1 | public void setErrorLog(ErrorLog errorLog) |
75 | { | |
76 | 1 | _errorLog = errorLog; |
77 | } | |
78 | } |
|