Top Description Fields Constructors Methods
org.springframework.web.servlet.config.annotation

public Class RedirectViewControllerRegistration

extends Object
Class Inheritance
Imports
org.springframework.context.ApplicationContext, org.springframework.http.HttpStatusCode, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.servlet.mvc.ParameterizableViewController, org.springframework.web.servlet.view.RedirectView

Assist with the registration of a single redirect view controller.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
private final ParameterizableViewController
private final RedirectView
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
protected ParameterizableViewController
protected void
public RedirectViewControllerRegistration
setContextRelative(boolean contextRelative)

Whether to interpret a given redirect URL that starts with a slash ("/") as relative to the current ServletContext, i.e. as relative to the web application root.

public RedirectViewControllerRegistration
setKeepQueryParams(boolean propagate)

Whether to propagate the query parameters of the current request through to the target redirect URL.

public RedirectViewControllerRegistration
setStatusCode(HttpStatusCode statusCode)

Set the specific redirect 3xx status code to use.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

controllerback to summary
private final ParameterizableViewController controller
redirectViewback to summary
private final RedirectView redirectView
urlPathback to summary
private final String urlPath

Constructor Detail

RedirectViewControllerRegistrationback to summary
public RedirectViewControllerRegistration(String urlPath, String redirectUrl)

Method Detail

getUrlPathback to summary
protected String getUrlPath()
getViewControllerback to summary
protected ParameterizableViewController getViewController()
setApplicationContextback to summary
protected void setApplicationContext(ApplicationContext applicationContext)
setContextRelativeback to summary
public RedirectViewControllerRegistration setContextRelative(boolean contextRelative)

Whether to interpret a given redirect URL that starts with a slash ("/") as relative to the current ServletContext, i.e. as relative to the web application root.

Default is true.

setKeepQueryParamsback to summary
public RedirectViewControllerRegistration setKeepQueryParams(boolean propagate)

Whether to propagate the query parameters of the current request through to the target redirect URL.

Default is false.

setStatusCodeback to summary
public RedirectViewControllerRegistration setStatusCode(HttpStatusCode statusCode)

Set the specific redirect 3xx status code to use.

If not set, org.springframework.web.servlet.view.RedirectView will select HttpStatus.MOVED_TEMPORARILY (302) by default.