Package org.springframework.web.servlet.config.annotation

# Class ViewControllerRegistration

java.lang.Object
org.springframework.web.servlet.config.annotation.ViewControllerRegistration

public class ViewControllerRegistration extends Object
Assist with the registration of a single view controller.

Since:
  3.1
Author:
  Rossen Stoyanchev, Keith Donald

## Constructor Summary

Constructors
Constructor
Description
`ViewControllerRegistration(String urlPath)`

## Method Summary

Modifier and Type
Method
Description
`protected String`
`getUrlPath()`
`protected ParameterizableViewController`
`getViewController()`
`protected void`
`setApplicationContext(org.springframework.context.ApplicationContext applicationContext)`
`ViewControllerRegistration`
`setStatusCode(org.springframework.http.HttpStatusCode statusCode)`
Set the status code to set on the response.
`void`
`setViewName(String viewName)`
Set the view name to return.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ViewControllerRegistration

public ViewControllerRegistration(String urlPath)

## Method Details

### setStatusCode

public ViewControllerRegistration setStatusCode(org.springframework.http.HttpStatusCode statusCode)
Set the status code to set on the response. Optional.

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

### setViewName

public void setViewName(String viewName)
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".

See Also:
  - `DefaultRequestToViewNameTranslator`

### setApplicationContext

protected void setApplicationContext(@Nullable org.springframework.context.ApplicationContext applicationContext)

### getUrlPath

protected String getUrlPath()

### getViewController

protected ParameterizableViewController getViewController()