|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.resthub.web.springmvc.router.RouterHandlerAdapter
public class RouterHandlerAdapter
Implementation of the HandlerAdapter interface
that maps HTTPServletRequests on Routes defined in route file configuration.
The route file name can be configured
handler methods based on RoutesHTTP paths, HTTP methods 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.
| Nested Class Summary | |
|---|---|
static class |
RouterHandlerAdapter.LocalVariablesNamesTracer
Runtime part. |
class |
RouterHandlerAdapter.RouterMethodResolver
Resolve Controller and Action for the given route (that contains the fullAction "controller.action") |
| Field Summary |
|---|
| Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
|---|
METHOD_GET, METHOD_HEAD, METHOD_POST |
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
RouterHandlerAdapter()
|
|
| Method Summary | |
|---|---|
protected void |
addReturnValueAsModelAttribute(Method handlerMethod,
Class handlerType,
Object returnValue,
org.springframework.ui.ExtendedModelMap implicitModel)
|
protected org.springframework.web.bind.ServletRequestDataBinder |
createBinder(javax.servlet.http.HttpServletRequest request,
Object target,
String objectName)
Template method for creating a new ServletRequestDataBinder instance. |
protected org.springframework.http.HttpInputMessage |
createHttpInputMessage(javax.servlet.http.HttpServletRequest servletRequest)
Template method for creating a new HttpInputMessage instance. |
protected org.springframework.http.HttpOutputMessage |
createHttpOutputMessage(javax.servlet.http.HttpServletResponse servletResponse)
Template method for creating a new HttpOuputMessage instance. |
long |
getLastModified(javax.servlet.http.HttpServletRequest request,
Object handler)
|
org.springframework.http.converter.HttpMessageConverter<?>[] |
getMessageConverters()
Return the message body converters that this adapter has been configured with. |
int |
getOrder()
Get the order value for this HandlerAdapter bean. |
org.springframework.web.servlet.ModelAndView |
handle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
Handles a request, calling the matched controller+action. |
protected void |
initApplicationContext()
Load and cache @Controller classes at application start. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
|
void |
setCustomArgumentResolver(org.springframework.web.bind.support.WebArgumentResolver argumentResolver)
Set a custom WebArgumentResolvers to use for special method parameter types. |
void |
setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[] argumentResolvers)
Set one or more custom WebArgumentResolvers to use for special method parameter types. |
void |
setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] customModelAndViewResolvers)
Set one or more custom ModelAndViewResolvers to use for special method return types. |
void |
setMessageConverters(org.springframework.http.converter.HttpMessageConverter<?>[] messageConverters)
Set the message body converters to use. |
void |
setOrder(int order)
Specify the order value for this HandlerAdapter bean. |
void |
setWebBindingInitializer(org.springframework.web.bind.support.WebBindingInitializer webBindingInitializer)
Specify a WebBindingInitializer which will apply pre-configured configuration to every DataBinder that this controller uses. |
boolean |
supports(Object handler)
Says wether or not this handlerAdapter supports the given handler, i.e. knows how to handle requests mapped with this handler. |
| Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
|---|
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader |
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
|---|
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
| Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
|---|
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RouterHandlerAdapter()
| Method Detail |
|---|
public int getOrder()
Default value is Ordered.LOWEST_PRECEDENCE, meaning that it's non-ordered.
getOrder in interface org.springframework.core.OrderedOrdered.getOrder()public void setOrder(int order)
Default value is Ordered.LOWEST_PRECEDENCE, meaning that it's non-ordered.
Ordered.getOrder()public void setWebBindingInitializer(org.springframework.web.bind.support.WebBindingInitializer webBindingInitializer)
public void setCustomArgumentResolver(org.springframework.web.bind.support.WebArgumentResolver argumentResolver)
Such a custom WebArgumentResolver will kick in first, having a chance to resolve an argument value before the standard argument handling kicks in.
public void setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[] argumentResolvers)
Any such custom WebArgumentResolver will kick in first, having a chance to resolve an argument value before the standard argument handling kicks in.
public void setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] customModelAndViewResolvers)
Any such custom ModelAndViewResolver will kick in first, having a chance to resolve a return value before the standard ModelAndView handling kicks in.
public void setMessageConverters(org.springframework.http.converter.HttpMessageConverter<?>[] messageConverters)
These converters are used to convert from and to HTTP requests and responses.
public org.springframework.http.converter.HttpMessageConverter<?>[] getMessageConverters()
protected org.springframework.web.bind.ServletRequestDataBinder createBinder(javax.servlet.http.HttpServletRequest request,
Object target,
String objectName)
throws Exception
The default implementation creates a standard ServletRequestDataBinder. This can be overridden for custom ServletRequestDataBinder subclasses.
request - current HTTP 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 argumentsServletRequestDataBinder.bind(javax.servlet.ServletRequest),
DataBinder.convertIfNecessary(Object, Class, org.springframework.core.MethodParameter)
protected org.springframework.http.HttpInputMessage createHttpInputMessage(javax.servlet.http.HttpServletRequest servletRequest)
throws Exception
The default implementation creates a standard ServletServerHttpRequest.
This can be overridden for custom HttpInputMessage implementations
servletRequest - current HTTP request
Exception - in case of errors
protected org.springframework.http.HttpOutputMessage createHttpOutputMessage(javax.servlet.http.HttpServletResponse servletResponse)
throws Exception
The default implementation creates a standard ServletServerHttpResponse.
This can be overridden for custom HttpOutputMessage implementations
servletResponse - current HTTP response
Exception - in case of errorspublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
public long getLastModified(javax.servlet.http.HttpServletRequest request,
Object handler)
getLastModified in interface org.springframework.web.servlet.HandlerAdapter
protected void initApplicationContext()
throws org.springframework.beans.BeansException
initApplicationContext in class org.springframework.context.support.ApplicationObjectSupportorg.springframework.beans.BeansExceptionpublic boolean supports(Object handler)
supports in interface org.springframework.web.servlet.HandlerAdapterhandler - the handler to adapt
public org.springframework.web.servlet.ModelAndView handle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
throws Exception
handle in interface org.springframework.web.servlet.HandlerAdapterrequest - the HTTP requestresponse - the HTTP responsehandler - the handler mapped for this request (should be an instance
of RouterHandler)
Exception
protected void addReturnValueAsModelAttribute(Method handlerMethod,
Class handlerType,
Object returnValue,
org.springframework.ui.ExtendedModelMap implicitModel)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||