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

ViewControllerRegistration

open class ViewControllerRegistration

Assist with the registration of a single view controller.

Author
Rossen Stoyanchev

Author
Keith Donald

Since
3.1

Constructors

<init>

ViewControllerRegistration(urlPath: String)

Functions

setStatusCode

open fun setStatusCode(statusCode: HttpStatus): ViewControllerRegistration

Set the status code to set on the response. Optional.

If not set the response status will be 200 (OK).

setViewName

open fun setViewName(viewName: String): Unit

Set the view name to return. Optional.

If not specified, the view controller will return null as the view name in which case the configured RequestToViewNameTranslator will select the view name. The DefaultRequestToViewNameTranslator for example translates "/foo/bar" to "foo/bar".