KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > HandlerAdapter


1 /*
2  * Copyright 2002-2006 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;
18
19 import javax.portlet.ActionRequest;
20 import javax.portlet.ActionResponse;
21 import javax.portlet.RenderRequest;
22 import javax.portlet.RenderResponse;
23
24 /**
25  * Portlet MVC framework SPI interface, allowing parameterization of core MVC workflow.
26  *
27  * <p>Interface that must be implemented for each handler type to handle a request.
28  * This interface is used to allow the DispatcherPortlet to be indefinitely
29  * extensible. The DispatcherPortlet accesses all installed handlers through this
30  * interface, meaning that it does not contain code specific to any handler type.
31  *
32  * <p>Note that a handler can be of type Object. This is to enable handlers from
33  * other frameworks to be integrated with this framework without custom coding.
34  *
35  * <p>This interface is not intended for application developers. It is available
36  * to handlers who want to develop their own web workflow.
37  *
38  * <p>Note: Implementations can implement the Ordered interface to be able to
39  * specify a sorting order and thus a priority for getting applied by
40  * DispatcherPortlet. Non-Ordered instances get treated as lowest priority.
41  *
42  * @author John A. Lewis
43  * @since 2.0
44  * @see org.springframework.web.portlet.mvc.SimpleControllerHandlerAdapter
45  */

46 public interface HandlerAdapter {
47     
48     /**
49      * Given a handler instance, return whether or not this HandlerAdapter can
50      * support it. Typical HandlerAdapters will base the decision on the handler
51      * type. HandlerAdapters will usually only support one handler type each.
52      * <p>A typical implementation:
53      * <p><code>
54      * return (handler instanceof MyHandler);
55      * </code>
56      * @param handler handler object to check
57      * @return whether or not this object can use the given handler
58      */

59     boolean supports(Object JavaDoc handler);
60
61     /**
62      * Use the given handler to handle this action request.
63      * The workflow that is required may vary widely.
64      * @param request current action request
65      * @param response current action response
66      * @param handler handler to use. This object must have previously been passed
67      * to the <code>supports</code> method of this interface, which must have
68      * returned true.
69      * @throws Exception in case of errors
70      */

71     void handleAction(ActionRequest request, ActionResponse response, Object JavaDoc handler) throws Exception JavaDoc;
72
73     /**
74      * Use the given handler to handle this render request.
75      * The workflow that is required may vary widely.
76      * @param request current render request
77      * @param response current render response
78      * @param handler handler to use. This object must have previously been passed
79      * to the <code>supports</code> method of this interface, which must have
80      * returned <code>true</code>.
81      * @throws Exception in case of errors
82      * @return ModelAndView object with the name of the view and the required
83      * model data, or <code>null</code> if the request has been handled directly
84      */

85     ModelAndView handleRender(RenderRequest request, RenderResponse response, Object JavaDoc handler) throws Exception JavaDoc;
86
87 }
88
Popular Tags