|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.support.ApplicationObjectSupport org.springframework.web.portlet.handler.AbstractHandlerMapping
public abstract class AbstractHandlerMapping
Abstract base class for HandlerMapping implementations. Supports ordering, a default handler, and handler interceptors.
getHandlerInternal(javax.portlet.PortletRequest)
,
HandlerInterceptor
Field Summary |
---|
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
AbstractHandlerMapping()
|
Method Summary | |
---|---|
protected HandlerInterceptor |
adaptInterceptor(Object interceptor)
Adapt the given interceptor object to the HandlerInterceptor interface. |
protected Object |
getDefaultHandler()
Return the default handler for this handler mapping, or null if none. |
HandlerExecutionChain |
getHandler(PortletRequest request)
Look up a handler for the given request, falling back to the default handler if no specific one is found. |
protected abstract Object |
getHandlerInternal(PortletRequest request)
Look up a handler for the given request, returning null if no
specific one is found. |
int |
getOrder()
Return the order value of this object, with a higher value meaning greater in terms of sorting. |
protected void |
initApplicationContext()
Calls the initInterceptors() method. |
protected void |
initInterceptors()
Initialize the specified interceptors, adapting them where necessary. |
void |
setApplyWebRequestInterceptorsToRenderPhaseOnly(boolean applyWebRequestInterceptorsToRenderPhaseOnly)
Specify whether to apply WebRequestInterceptors to the Portlet render phase only ("true", or whether to apply them to the Portlet action phase as well ("false"). |
void |
setDefaultHandler(Object defaultHandler)
Set the default handler for this handler mapping. |
void |
setInterceptors(Object[] interceptors)
Set the interceptors to apply for all handlers mapped by this handler mapping. |
void |
setOrder(int order)
|
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, isContextRequired, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractHandlerMapping()
Method Detail |
---|
public final void setOrder(int order)
public final int getOrder()
Ordered
Normally starting with 0 or 1, with Ordered.LOWEST_PRECEDENCE
indicating greatest. Same order values will result in arbitrary
positions for the affected objects.
Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).
Note that order values below 0 are reserved for framework purposes. Application-specified values should always be 0 or greater, with only framework components (internal or third-party) supposed to use lower values.
getOrder
in interface Ordered
Ordered.LOWEST_PRECEDENCE
public final void setDefaultHandler(Object defaultHandler)
Default is null
, indicating no default handler.
protected final Object getDefaultHandler()
null
if none.
public final void setInterceptors(Object[] interceptors)
Supported interceptor types are HandlerInterceptor and WebRequestInterceptor. Each given WebRequestInterceptor will be wrapped in a WebRequestHandlerInterceptorAdapter.
interceptors
- array of handler interceptors, or null
if noneadaptInterceptor(java.lang.Object)
,
HandlerInterceptor
,
WebRequestInterceptor
public void setApplyWebRequestInterceptorsToRenderPhaseOnly(boolean applyWebRequestInterceptorsToRenderPhaseOnly)
Default is "true", since WebRequestInterceptors are usually built for MVC-style handler execution plus rendering process (which is, for example, the primary target scenario for "Open Session in View" interceptors, offering lazy loading of persistent objects during view rendering). Set this to "false" to have WebRequestInterceptors apply to the action phase as well (for example, in case of an "Open Session in View" interceptor, to allow for lazy loading outside of a transaction during the action phase).
setInterceptors(java.lang.Object[])
,
WebRequestInterceptor
,
WebRequestHandlerInterceptorAdapter.WebRequestHandlerInterceptorAdapter(WebRequestInterceptor, boolean)
,
OpenSessionInViewInterceptor
protected void initApplicationContext() throws BeansException
initInterceptors()
method.
initApplicationContext
in class ApplicationObjectSupport
ApplicationContextException
- in case of initialization errors
BeansException
- if thrown by ApplicationContext methodsinitInterceptors()
protected void initInterceptors()
setInterceptors(java.lang.Object[])
,
adaptInterceptor(java.lang.Object)
protected HandlerInterceptor adaptInterceptor(Object interceptor)
Supported interceptor types are HandlerInterceptor and WebRequestInterceptor. Each given WebRequestInterceptor will be wrapped in a WebRequestHandlerInterceptorAdapter. Can be overridden in subclasses.
interceptor
- the specified interceptor object
setApplyWebRequestInterceptorsToRenderPhaseOnly(boolean)
,
HandlerInterceptor
,
WebRequestInterceptor
,
WebRequestHandlerInterceptorAdapter
public final HandlerExecutionChain getHandler(PortletRequest request) throws Exception
getHandler
in interface HandlerMapping
request
- current HTTP request
Exception
- if there is an internal errorgetHandlerInternal(javax.portlet.PortletRequest)
protected abstract Object getHandlerInternal(PortletRequest request) throws Exception
null
if no
specific one is found. This method is called by getHandler;
a null
return value will lead to the default handler, if one is set.
- Parameters:
request
- current portlet request
- Returns:
- the corresponding handler instance, or
null
if none found
- Throws:
Exception
- if there is an internal error- See Also:
getHandler(javax.portlet.PortletRequest)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |