KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2002-2007 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.PortletRequest;
20
21 /**
22  * Interface to be implemented by objects that define a mapping between
23  * requests and handler objects.
24  *
25  * <p>This class can be implemented by application developers, although this is not
26  * necessary, as {@link org.springframework.web.portlet.handler.PortletModeHandlerMapping},
27  * {@link org.springframework.web.portlet.handler.ParameterHandlerMapping} and
28  * {@link org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping}
29  * are included in the framework. The first is the default if no HandlerMapping
30  * bean is registered in the portlet application context.
31  *
32  * <p>HandlerMapping implementations can support mapped interceptors but do not
33  * have to. A handler will always be wrapped in a {@link HandlerExecutionChain}
34  * instance, optionally accompanied by some {@link HandlerInterceptor} instances.
35  * The DispatcherPortlet will first call each HandlerInterceptor's
36  * <code>preHandle</code> method in the given order, finally invoking the handler
37  * itself if all <code>preHandle</code> methods have returned <code>true</code>.
38  *
39  * <p>The ability to parameterize this mapping is a powerful and unusual
40  * capability of this Portlet MVC framework. For example, it is possible to
41  * write a custom mapping based on session state, cookie state or many other
42  * variables. No other MVC framework seems to be equally flexible.
43  *
44  * <p>Note: Implementations can implement the {@link org.springframework.core.Ordered}
45  * interface to be able to specify a sorting order and thus a priority for getting
46  * applied by DispatcherPortlet. Non-Ordered instances get treated as lowest priority.
47  *
48  * @author John A. Lewis
49  * @author Juergen Hoeller
50  * @see org.springframework.core.Ordered
51  * @see org.springframework.web.portlet.handler.AbstractHandlerMapping
52  * @see org.springframework.web.portlet.handler.PortletModeHandlerMapping
53  * @see org.springframework.web.portlet.handler.ParameterHandlerMapping
54  * @see org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping
55  */

56 public interface HandlerMapping {
57     
58     /**
59      * Return a handler and any interceptors for this request. The choice may be made
60      * on portlet mode, session state, or any factor the implementing class chooses.
61      * <p>The returned HandlerExecutionChain contains a handler Object, rather than
62      * even a tag interface, so that handlers are not constrained in any way.
63      * For example, a HandlerAdapter could be written to allow another framework's
64      * handler objects to be used.
65      * <p>Returns <code>null</code> if no match was found. This is not an error.
66      * The DispatcherPortlet will query all registered HandlerMapping beans to find
67      * a match, and only decide there is an error if none can find a handler.
68      * @param request current portlet request
69      * @return a HandlerExecutionChain instance containing handler object and
70      * any interceptors, or null if no mapping found
71      * @throws Exception if there is an internal error
72      */

73     HandlerExecutionChain getHandler(PortletRequest request) throws Exception JavaDoc;
74
75 }
76
Popular Tags