spring-framework / org.springframework.web.servlet.config.annotation / RedirectViewControllerRegistration

RedirectViewControllerRegistration

open class RedirectViewControllerRegistration

Assist with the registration of a single redirect view controller.

Author
Rossen Stoyanchev

Since
4.1

Constructors

<init>

RedirectViewControllerRegistration(urlPath: String, redirectUrl: String)

Functions

setContextRelative

open fun setContextRelative(contextRelative: Boolean): RedirectViewControllerRegistration

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.

setKeepQueryParams

open fun setKeepQueryParams(propagate: Boolean): RedirectViewControllerRegistration

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

Default is false.

setStatusCode

open fun setStatusCode(statusCode: HttpStatus): RedirectViewControllerRegistration

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.