By default HttpStatus#SEE_OTHER is used but alternate status codes
may be supplied via constructor or setters arguments.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private String[] | |
| private boolean | |
| private HttpStatusCode | |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | RedirectView(String redirectUrl, HttpStatusCode statusCode)
Create a new |
| Modifier and Type | Method and Description |
|---|---|
| protected StringBuilder | appendCurrentRequestQuery(String targetUrl, ServerHttpRequest request)
Append the query of the current request to the target redirect URL. |
| public boolean | checkResourceExists(Locale
the desired Locale that we're looking for locale)Implements abstract org. Check whether the resource for the configured URL actually exists. |
| protected final String | createTargetUrl(Map<String, Object> model, ServerWebExchange exchange)
Create the target URL and, if necessary, pre-pend the contextPath, expand
URI template variables, append the current request query, and apply the
configured |
| private String | |
| protected StringBuilder | |
| private Map | |
| public String[] | |
| public HttpStatusCode | |
| public boolean | |
| public boolean | |
| public boolean | isRedirectView()
Overrides default org. Whether this View does render by performing a redirect. |
| protected boolean | Returns: true if the target URL has a remote host, false if
the URL does not have a host or the "host" property is not configuredthe target redirect URL targetUrl)Whether the given targetUrl has a host that is a "foreign" system in which
case |
| protected Mono | renderInternal(Map<String, Object>
combined output Map (never model, MediaType null),
with dynamic values taking precedence over static attributesthe content type selected to render with, which should
match one of the supported media types contentType, ServerWebExchange current exchange exchange)Implements abstract org. Convert model to request parameters and redirect to the given URL. |
| protected Mono | sendRedirect(String
the target URL to redirect to targetUrl, ServerWebExchange current exchange exchange)Send a redirect back to the HTTP client. |
| public void | setContextRelative(boolean contextRelative)
Whether to interpret a given redirect URL that starts with a slash ("/")
as relative to the current context path ( |
| public void | |
| public void | setPropagateQuery(boolean propagateQuery)
Whether to append the query string of the current URL to the redirect URL
( |
| public void | setStatusCode(HttpStatusCode statusCode)
Set an alternate redirect status code such as
|
| contextRelative | back to summary |
|---|---|
| private boolean contextRelative | |
| hosts | back to summary |
|---|---|
| private String[] hosts
| |
| propagateQuery | back to summary |
|---|---|
| private boolean propagateQuery | |
| statusCode | back to summary |
|---|---|
| private HttpStatusCode statusCode | |
| URI_TEMPLATE_VARIABLE_PATTERN | back to summary |
|---|---|
| private static final Pattern URI_TEMPLATE_VARIABLE_PATTERN | |
| RedirectView | back to summary |
|---|---|
| public RedirectView() Constructor for use as a bean. | |
| RedirectView | back to summary |
|---|---|
| public RedirectView(String redirectUrl) Create a new Status code | |
| RedirectView | back to summary |
|---|---|
| public RedirectView(String redirectUrl, HttpStatusCode statusCode) Create a new | |
| appendCurrentRequestQuery | back to summary |
|---|---|
| protected StringBuilder appendCurrentRequestQuery(String targetUrl, ServerHttpRequest request) Append the query of the current request to the target redirect URL. | |
| checkResourceExists | back to summary |
|---|---|
| public boolean checkResourceExists(Locale locale) throws Exception Implements abstract org. Doc from org. Check whether the resource for the configured URL actually exists. | |
| createTargetUrl | back to summary |
|---|---|
| protected final String createTargetUrl(Map<String, Object> model, ServerWebExchange exchange) Create the target URL and, if necessary, pre-pend the contextPath, expand
URI template variables, append the current request query, and apply the
configured | |
| encodeUriVariable | back to summary |
|---|---|
| private String encodeUriVariable(String text) | |
| expandTargetUrlTemplate | back to summary |
|---|---|
| protected StringBuilder expandTargetUrlTemplate(String targetUrl, Map<String, Object> model, Map<String, String> uriVariables) Expand URI template variables in the target URL with either model attribute values or as a fallback with URI variable values from the current request. Values are encoded. | |
| getCurrentUriVariables | back to summary |
|---|---|
| private Map | |
| getHosts | back to summary |
|---|---|
| public String[] getHosts() Return the configured application hosts.
| |
| getStatusCode | back to summary |
|---|---|
| public HttpStatusCode getStatusCode() Get the redirect status code to use. | |
| isContextRelative | back to summary |
|---|---|
| public boolean isContextRelative() Whether to interpret URLs as relative to the current context path. | |
| isPropagateQuery | back to summary |
|---|---|
| public boolean isPropagateQuery() Whether the query string of the current URL is appended to the redirect URL. | |
| isRedirectView | back to summary |
|---|---|
| public boolean isRedirectView() Overrides default org. Doc from org. Whether this View does render by performing a redirect.
| |
| isRemoteHost | back to summary |
|---|---|
| protected boolean isRemoteHost(String targetUrl) Whether the given targetUrl has a host that is a "foreign" system in which
case This method returns
| |
| renderInternal | back to summary |
|---|---|
| protected Mono Implements abstract org. Convert model to request parameters and redirect to the given URL.
| |
| sendRedirect | back to summary |
|---|---|
| protected Mono Send a redirect back to the HTTP client.
| |
| setContextRelative | back to summary |
|---|---|
| public void setContextRelative(boolean contextRelative) Whether to interpret a given redirect URL that starts with a slash ("/")
as relative to the current context path ( | |
| setHosts | back to summary |
|---|---|
| public void setHosts(String... hosts) Configure one or more hosts associated with the application. All other hosts will be considered external hosts. In effect this provides a way turn off encoding for URLs that have a host and that host is not listed as a known host. If not set (the default) all redirect URLs are encoded.
| |
| setPropagateQuery | back to summary |
|---|---|
| public void setPropagateQuery(boolean propagateQuery) Whether to append the query string of the current URL to the redirect URL
( | |
| setStatusCode | back to summary |
|---|---|
| public void setStatusCode(HttpStatusCode statusCode) Set an alternate redirect status code such as
| |