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

PropertyReturnsDescription
contentTypeStringAlways null, because a redirect has no response body and so no content type.
redirectUrlStringThe 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.

ParameterDescription
pagethe resource the view is being rendered for, not used by this view
outthe response output stream, not written to by this view
rangenot used by this view
paramsrequest parameters, not used by this view
contentTypenot 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.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.