public class PortletRequestMappingHandlerAdapter extends AbstractPortletHandlerMethodAdapter implements BeanFactoryAware, InitializingBean
AbstractPortletHandlerMethodAdapter that supports HandlerMethods annotated with ActionMapping, EventMapping, RenderMapping, or ResourceMapping.
Support for custom argument and return value types can be added via setCustomArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>) and setCustomReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>), or alternatively, to re-configure all argument and return value types, use setArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>) and setReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>).
HandlerMethodArgumentResolver,
HandlerMethodReturnValueHandler| Modifier and Type | Field and Description |
|---|---|
static String |
IMPLICIT_MODEL_RENDER_PARAMETER |
static String |
IMPLICIT_MODEL_SESSION_ATTRIBUTE |
static ReflectionUtils.MethodFilter |
INIT_BINDER_METHODS
MethodFilter that matches
@InitBinder methods. |
static ReflectionUtils.MethodFilter |
MODEL_ATTRIBUTE_METHODS
MethodFilter that matches
@ModelAttribute methods. |
loggerHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
PortletRequestMappingHandlerAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected InitBinderDataBinderFactory |
createDataBinderFactory(List<InvocableHandlerMethod> binderMethods)
Template method to create a new InitBinderDataBinderFactory instance.
|
protected PortletInvocableHandlerMethod |
createInvocableHandlerMethod(HandlerMethod handlerMethod)
Create a
PortletInvocableHandlerMethod from the given HandlerMethod definition. |
protected ModelAndView |
doHandle(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
HandlerMethod handlerMethod) |
protected ModelAndView |
doHandle(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
Object handler) |
List<HandlerMethodArgumentResolver> |
getArgumentResolvers()
Return the configured argument resolvers, or possibly
null if not initialized yet via afterPropertiesSet(). |
protected ConfigurableBeanFactory |
getBeanFactory()
Return the owning factory of this bean instance, or
null if none. |
List<HandlerMethodArgumentResolver> |
getCustomArgumentResolvers()
Return the custom argument resolvers, or
null. |
List<HandlerMethodReturnValueHandler> |
getCustomReturnValueHandlers()
Return the custom return value handlers, or
null. |
List<HandlerMethodArgumentResolver> |
getInitBinderArgumentResolvers()
Return the argument resolvers for
@InitBinder methods, or possibly null if not initialized yet
via afterPropertiesSet(). |
List<HttpMessageConverter<?>> |
getMessageConverters()
Return the configured message body converters.
|
List<ModelAndViewResolver> |
getModelAndViewResolvers()
Return the configured
ModelAndViewResolvers, or null. |
List<HandlerMethodReturnValueHandler> |
getReturnValueHandlers()
Return the configured handlers, or possibly
null if not initialized yet via afterPropertiesSet(). |
WebBindingInitializer |
getWebBindingInitializer()
Return the configured WebBindingInitializer, or
null if none. |
protected void |
handleActionInternal(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response,
Object handler)
Use the given handler method to handle the request.
|
protected void |
handleEventInternal(javax.portlet.EventRequest request,
javax.portlet.EventResponse response,
Object handler)
Use the given handler method to handle the request.
|
protected ModelAndView |
handleRenderInternal(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response,
Object handler)
Use the given handler method to handle the request.
|
protected ModelAndView |
handleResourceInternal(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response,
Object handler)
Use the given handler method to handle the request.
|
void |
setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Configure the complete list of supported argument types thus overriding the resolvers that would otherwise be
configured by default.
|
void |
setBeanFactory(BeanFactory beanFactory)
A
ConfigurableBeanFactory is expected for resolving expressions in method argument default values. |
void |
setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager)
Set the
ContentNegotiationManager to use to determine requested media types. |
void |
setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Provide resolvers for custom argument types.
|
void |
setCustomReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Provide handlers for custom return value types.
|
void |
setInitBinderArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Configure the supported argument types in
@InitBinder methods. |
void |
setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Provide the converters to use in argument resolvers and return value handlers that support reading and/or writing
to the body of the request and response.
|
void |
setModelAndViewResolvers(List<ModelAndViewResolver> modelAndViewResolvers)
Provide custom
ModelAndViewResolvers. |
void |
setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)
Set the ParameterNameDiscoverer to use for resolving method parameter names if needed (e.g.
|
void |
setReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)
Configure the complete list of supported return value types thus overriding handlers that would otherwise be
configured by default.
|
void |
setSessionAttributeStore(SessionAttributeStore sessionAttributeStore)
Specify the strategy to store session attributes with.
|
void |
setTaskExecutor(AsyncTaskExecutor taskExecutor)
Set the default
AsyncTaskExecutor to use when a controller method return a Callable. |
void |
setWebBindingInitializer(WebBindingInitializer webBindingInitializer)
Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.
|
protected boolean |
supportsInternal(Object handler)
Always return
true since any method argument and return value type will be processed in some way. |
getOrder, handleAction, handleEvent, handleRender, handleResource, setOrder, supportsapplyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSessiongetPortletContext, getTempDir, isContextRequired, setPortletContextgetApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContextpublic static final String IMPLICIT_MODEL_SESSION_ATTRIBUTE
public static final String IMPLICIT_MODEL_RENDER_PARAMETER
public static final ReflectionUtils.MethodFilter INIT_BINDER_METHODS
@InitBinder methods.public static final ReflectionUtils.MethodFilter MODEL_ATTRIBUTE_METHODS
@ModelAttribute methods.public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBean@Nullable public List<HandlerMethodArgumentResolver> getArgumentResolvers()
null if not initialized yet via afterPropertiesSet().@Nullable public List<HandlerMethodArgumentResolver> getCustomArgumentResolvers()
null.@Nullable public List<HandlerMethodReturnValueHandler> getCustomReturnValueHandlers()
null.@Nullable public List<HandlerMethodArgumentResolver> getInitBinderArgumentResolvers()
@InitBinder methods, or possibly null if not initialized yet
via afterPropertiesSet().public List<HttpMessageConverter<?>> getMessageConverters()
@Nullable public List<ModelAndViewResolver> getModelAndViewResolvers()
ModelAndViewResolvers, or null.@Nullable public List<HandlerMethodReturnValueHandler> getReturnValueHandlers()
null if not initialized yet via afterPropertiesSet().@Nullable public WebBindingInitializer getWebBindingInitializer()
null if none.public void setArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers)
public void setBeanFactory(BeanFactory beanFactory)
ConfigurableBeanFactory is expected for resolving expressions in method argument default values.setBeanFactory in interface BeanFactoryAwarepublic void setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager)
ContentNegotiationManager to use to determine requested media types. If not set, the default
constructor is used.public void setCustomArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers)
setArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver>) instead.public void setCustomReturnValueHandlers(@Nullable List<HandlerMethodReturnValueHandler> returnValueHandlers)
setReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler>).public void setInitBinderArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers)
@InitBinder methods.public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
public void setModelAndViewResolvers(@Nullable List<ModelAndViewResolver> modelAndViewResolvers)
ModelAndViewResolvers.
Note: This method is available for backwards compatibility only. However, it is recommended
to re-write a ModelAndViewResolver as HandlerMethodReturnValueHandler. An adapter between the two
interfaces is not possible since the HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter) method cannot be
implemented. Hence ModelAndViewResolvers are limited to always being invoked at the end after all other
return value handlers have been given a chance.
A HandlerMethodReturnValueHandler provides better access to the return type and controller method
information and can be ordered freely relative to other return value handlers.
public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)
Default is a DefaultParameterNameDiscoverer.
public void setReturnValueHandlers(@Nullable List<HandlerMethodReturnValueHandler> returnValueHandlers)
public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore)
DefaultSessionAttributeStore, storing session attributes in the HttpSession
with the same attribute name as in the model.public void setTaskExecutor(AsyncTaskExecutor taskExecutor)
AsyncTaskExecutor to use when a controller method return a Callable. Controller
methods can override this default on a per-request basis by returning an WebAsyncTask.
By default a SimpleAsyncTaskExecutor instance is used. It's recommended to change that default in
production as the simple executor does not re-use threads.
public void setWebBindingInitializer(@Nullable WebBindingInitializer webBindingInitializer)
protected InitBinderDataBinderFactory createDataBinderFactory(List<InvocableHandlerMethod> binderMethods) throws Exception
The default implementation creates a PortletRequestDataBinderFactory. This can be overridden for custom ServletRequestDataBinder subclasses.
binderMethods - @InitBinder methodsException - in case of invalid state or argumentsprotected PortletInvocableHandlerMethod createInvocableHandlerMethod(HandlerMethod handlerMethod)
PortletInvocableHandlerMethod from the given HandlerMethod definition.handlerMethod - the HandlerMethod definitionPortletInvocableHandlerMethod (or custom subclass thereof)protected ModelAndView doHandle(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, Object handler) throws Exception
Exceptionprotected ModelAndView doHandle(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response, HandlerMethod handlerMethod) throws Exception
Exception@Nullable protected ConfigurableBeanFactory getBeanFactory()
null if none.protected void handleActionInternal(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response,
Object handler)
throws Exception
AbstractPortletHandlerMethodAdapterhandleActionInternal in class AbstractPortletHandlerMethodAdapterrequest - current action requestresponse - current action responsehandler - refers to an instance of a class with a method annotated with ActionMapping. Alternatively refers to an
instance of HandlerMethod.Exception - in case of errorsprotected void handleEventInternal(javax.portlet.EventRequest request,
javax.portlet.EventResponse response,
Object handler)
throws Exception
AbstractPortletHandlerMethodAdapterhandleEventInternal in class AbstractPortletHandlerMethodAdapterrequest - current action requestresponse - current action responsehandler - refers to an instance of a class with a method annotated with EventMapping. Alternatively refers to an
instance of HandlerMethod.Exception - in case of errorsprotected ModelAndView handleRenderInternal(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, Object handler) throws Exception
AbstractPortletHandlerMethodAdapterhandleRenderInternal in class AbstractPortletHandlerMethodAdapterrequest - current action requestresponse - current action responsehandler - refers to an instance of a class with a method annotated with RenderMapping. Alternatively refers to an
instance of HandlerMethod.null if the
request has been handled directlyException - in case of errorsprotected ModelAndView handleResourceInternal(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response, Object handler) throws Exception
AbstractPortletHandlerMethodAdapterhandleResourceInternal in class AbstractPortletHandlerMethodAdapterrequest - current action requestresponse - current action responsehandler - refers to an instance of a class with a method annotated with ResourceMapping. Alternatively refers to an
instance of HandlerMethod.null if the
request has been handled directlyException - in case of errorsprotected boolean supportsInternal(Object handler)
true since any method argument and return value type will be processed in some way. A
method argument not recognized by any HandlerMethodArgumentResolver is interpreted as a request parameter if it
is a simple type, or as a model attribute otherwise. A return value not recognized by any
HandlerMethodReturnValueHandler will be interpreted as a model attribute.supportsInternal in class AbstractPortletHandlerMethodAdapterhandler - refers to an instance of a class with a method annotated with ActionMapping, EventMapping, RenderMapping, or ResourceMapping. Alternatively refers to an
instance of HandlerMethod.Copyright © 2019 Liferay, Inc.. All rights reserved.