Sends the browser to another URL instead of writing a response body. Created via ViewsBuilder.redirectView(...) from server-side JS and returned from a controller as the view for a request. Rendering writes no bytes at all: it sets the redirect on the current response, temporary by default or permanent when constructed with permanent true. Its content type is null, so nothing downstream should treat this as an HTML view. The class is also configurable in XML under the alias "redirect".
Group: Views
Implements: View, Serializable
Properties
| Property | Returns | Description |
|---|---|---|
| contentType | String | Always null, because a redirect has no response body and so no content type. |
| redirectUrl | String | The URL the browser is sent to when this view renders, as supplied at construction or from XML. |
Methods
render(CommonResource page, OutputStream out, Range range, Map<String,String> params, String contentType)
Returns: void
Sets a redirect to this view's URL on the current response, permanent or temporary as configured. Nothing is written to the output stream.
| Parameter | Description |
|---|---|
page | the resource the view is being rendered for, not used by this view |
out | the response output stream, not written to by this view |
range | not used by this view |
params | request parameters, not used by this view |
contentType | not used by this view |
getContentType()
Returns: String
Always null, because a redirect has no response body and so no content type.
getRedirectUrl()
Returns: String
The URL the browser is sent to when this view renders, as supplied at construction or from XML.