KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > handler > HandlerInterceptorAdapter


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.portlet.handler;
18
19 import java.io.IOException JavaDoc;
20
21 import javax.portlet.ActionRequest;
22 import javax.portlet.ActionResponse;
23 import javax.portlet.RenderRequest;
24 import javax.portlet.RenderResponse;
25 import javax.portlet.PortletRequest;
26 import javax.portlet.PortletResponse;
27 import javax.portlet.PortletException;
28
29 import org.springframework.web.portlet.HandlerInterceptor;
30 import org.springframework.web.portlet.ModelAndView;
31
32 /**
33  * Abstract adapter class for the HandlerInterceptor interface,
34  * for simplified implementation of pre-only/post-only interceptors.
35  *
36  * @author Juergen Hoeller
37  * @author John A. Lewis
38  * @since 2.0
39  */

40 public abstract class HandlerInterceptorAdapter implements HandlerInterceptor {
41
42     /**
43      * This implementation delegates to <code>preHandle</code>.
44      * @see #preHandle
45      */

46     public boolean preHandleAction(ActionRequest request, ActionResponse response, Object JavaDoc handler) throws Exception JavaDoc {
47         return preHandle(request, response, handler);
48     }
49
50     /**
51      * This implementation delegates to <code>afterCompletion</code>.
52      * @see #afterCompletion
53      */

54     public void afterActionCompletion(
55             ActionRequest request, ActionResponse response, Object JavaDoc handler, Exception JavaDoc ex) throws Exception JavaDoc {
56
57         afterCompletion(request, response, handler, ex);
58     }
59
60
61     /**
62      * This implementation delegates to <code>preHandle</code>.
63      * @see #preHandle
64      */

65     public boolean preHandleRender(RenderRequest request, RenderResponse response, Object JavaDoc handler) throws Exception JavaDoc {
66         return preHandle(request, response, handler);
67     }
68
69     /**
70      * This implementation is empty.
71      */

72     public void postHandleRender(
73             RenderRequest request, RenderResponse response, Object JavaDoc handler, ModelAndView modelAndView) throws Exception JavaDoc {
74     }
75
76     /**
77      * This implementation delegates to <code>afterCompletion</code>.
78      * @see #afterCompletion
79      */

80     public void afterRenderCompletion(
81             RenderRequest request, RenderResponse response, Object JavaDoc handler, Exception JavaDoc ex) throws Exception JavaDoc {
82
83         afterCompletion(request, response, handler, ex);
84     }
85
86
87     /**
88      * Default callback that both <code>preHandleRender</code>
89      * and <code>preHandleAction</code> delegate to.
90      * <p>This implementation always returns <code>true</code>.
91      * @see #preHandleRender
92      * @see #preHandleAction
93      */

94     protected boolean preHandle(PortletRequest request, PortletResponse response, Object JavaDoc handler)
95             throws Exception JavaDoc {
96
97         return true;
98     }
99
100     /**
101      * Default callback that both <code>preHandleRender</code>
102      * and <code>preHandleAction</code> delegate to.
103      * <p>This implementation is empty.
104      * @see #afterRenderCompletion
105      * @see #afterActionCompletion
106      */

107     protected void afterCompletion(
108             PortletRequest request, PortletResponse response, Object JavaDoc handler, Exception JavaDoc ex) throws Exception JavaDoc {
109
110     }
111
112 }
113
Popular Tags