public class ParameterizableViewController extends AbstractController
HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST
logger
Constructor and Description |
---|
ParameterizableViewController() |
Modifier and Type | Method and Description |
---|---|
HttpStatus |
getStatusCode()
Return the configured HTTP status code or
null . |
View |
getView()
Return the View object, or
null if we are using a view name
to be resolved by the DispatcherServlet via a ViewResolver. |
java.lang.String |
getViewName()
Return the name of the view to delegate to, or
null if using a
View instance. |
protected ModelAndView |
handleRequestInternal(HttpServletRequest request,
HttpServletResponse response)
Return a ModelAndView object with the specified view name.
|
boolean |
isStatusOnly()
Whether the request is fully handled within the controller.
|
void |
setStatusCode(HttpStatus statusCode)
Configure the HTTP status code that this controller should set on the
response.
|
void |
setStatusOnly(boolean statusOnly)
The property can be used to indicate the request is considered fully
handled within the controller and that no view should be used for rendering.
|
void |
setView(View view)
Set a View object for the ModelAndView to return.
|
void |
setViewName(java.lang.String viewName)
Set a view name for the ModelAndView to return, to be resolved by the
DispatcherServlet via a ViewResolver.
|
java.lang.String |
toString() |
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
applyCacheControl, applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, prepareResponse, preventCaching, setAlwaysMustRevalidate, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader, setVaryByRequestHeaders
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
public void setViewName(@Nullable java.lang.String viewName)
@Nullable public java.lang.String getViewName()
null
if using a
View instance.public void setView(View view)
@Nullable public View getView()
null
if we are using a view name
to be resolved by the DispatcherServlet via a ViewResolver.public void setStatusCode(@Nullable HttpStatus statusCode)
When a "redirect:" prefixed view name is configured, there is no need
to set this property since RedirectView will do that. However this property
may still be used to override the 3xx status code of RedirectView
.
For full control over redirecting provide a RedirectView
instance.
If the status code is 204 and no view is configured, the request is fully handled within the controller.
@Nullable public HttpStatus getStatusCode()
null
.public void setStatusOnly(boolean statusOnly)
setStatusCode(org.springframework.http.HttpStatus)
.
By default this is set to false
.
public boolean isStatusOnly()
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws java.lang.Exception
The content of the "input" FlashMap
is also added to the model.
handleRequestInternal
in class AbstractController
java.lang.Exception
getViewName()
public java.lang.String toString()
toString
in class java.lang.Object