|
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.context.PortletApplicationObjectSupport org.springframework.web.portlet.handler.PortletContentGenerator org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter
public class AnnotationMethodHandlerAdapter
Implementation of the HandlerAdapter
interface that maps handler methods based on portlet modes, action/render phases
and request parameters expressed through the RequestMapping
annotation.
Supports request parameter binding through the RequestParam
annotation.
Also supports the ModelAttribute
annotation for exposing model attribute
values to the view, as well as InitBinder
for binder initialization methods
and SessionAttributes
for automatic session management of specific attributes.
This adapter can be customized through various bean properties.
A common use case is to apply shared binder initialization logic through
a custom WebBindingInitializer
.
setWebBindingInitializer(org.springframework.web.bind.support.WebBindingInitializer)
,
setSessionAttributeStore(org.springframework.web.bind.support.SessionAttributeStore)
Field Summary |
---|
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
AnnotationMethodHandlerAdapter()
|
Method Summary | |
---|---|
protected PortletRequestDataBinder |
createBinder(PortletRequest request,
Object target,
String objectName)
Template method for creating a new PortletRequestDataBinder instance. |
protected ModelAndView |
doHandle(PortletRequest request,
PortletResponse response,
Object handler)
|
void |
handleAction(ActionRequest request,
ActionResponse response,
Object handler)
Use the given handler to handle this action request. |
ModelAndView |
handleRender(RenderRequest request,
RenderResponse response,
Object handler)
Use the given handler to handle this render request. |
void |
setSessionAttributeStore(SessionAttributeStore sessionAttributeStore)
Specify the strategy to store session attributes with. |
void |
setWebBindingInitializer(WebBindingInitializer webBindingInitializer)
Specify a WebBindingInitializer which will apply pre-configured configuration to every DataBinder that this controller uses. |
boolean |
supports(Object handler)
Given a handler instance, return whether or not this HandlerAdapter can support it. |
Methods inherited from class org.springframework.web.portlet.handler.PortletContentGenerator |
---|
applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession |
Methods inherited from class org.springframework.web.portlet.context.PortletApplicationObjectSupport |
---|
getPortletContext, getTempDir, isContextRequired, setPortletContext |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationMethodHandlerAdapter()
Method Detail |
---|
public void setWebBindingInitializer(WebBindingInitializer webBindingInitializer)
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore)
Default is DefaultSessionAttributeStore
,
storing session attributes in the PortletSession, using the same
attribute name as in the model.
public boolean supports(Object handler)
HandlerAdapter
A typical implementation:
return (handler instanceof MyHandler);
supports
in interface HandlerAdapter
handler
- handler object to check
public void handleAction(ActionRequest request, ActionResponse response, Object handler) throws Exception
HandlerAdapter
handleAction
in interface HandlerAdapter
request
- current action requestresponse
- current action responsehandler
- handler to use. This object must have previously been passed
to the supports
method of this interface, which must have
returned true.
Exception
- in case of errorspublic ModelAndView handleRender(RenderRequest request, RenderResponse response, Object handler) throws Exception
HandlerAdapter
handleRender
in interface HandlerAdapter
request
- current render requestresponse
- current render responsehandler
- handler to use. This object must have previously been passed
to the supports
method of this interface, which must have
returned true
.
null
if the request has been handled directly
Exception
- in case of errorsprotected ModelAndView doHandle(PortletRequest request, PortletResponse response, Object handler) throws Exception
Exception
protected PortletRequestDataBinder createBinder(PortletRequest request, Object target, String objectName) throws Exception
The default implementation creates a standard PortletRequestDataBinder. This can be overridden for custom PortletRequestDataBinder subclasses.
request
- current portlet requesttarget
- the target object to bind onto (or null
if the binder is just used to convert a plain parameter value)objectName
- the objectName of the target object
Exception
- in case of invalid state or argumentsPortletRequestDataBinder.bind(javax.portlet.PortletRequest)
,
DataBinder.convertIfNecessary(Object, Class, MethodParameter)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |