类 RedirectView

    • 方法详细资料

      • setContextRelative

        public void setContextRelative​(boolean contextRelative)
        Whether to interpret a given redirect URLs that starts with a slash ("/") as relative to the current context path (true, the default) or to the web server root (false).
      • isContextRelative

        public boolean isContextRelative()
        Whether to interpret URLs as relative to the current context path.
      • setPropagateQuery

        public void setPropagateQuery​(boolean propagateQuery)
        Whether to append the query string of the current URL to the redirect URL (true) or not (false, the default).
      • isPropagateQuery

        public boolean isPropagateQuery()
        Whether the query string of the current URL is appended to the redirect URL.
      • setHosts

        public void setHosts​(@Nullable
                             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.

        参数:
        hosts - one or more application hosts
      • isRedirectView

        public boolean isRedirectView()
        从接口复制的说明: View
        Whether this View does rendering by performing a redirect.
      • renderInternal

        protected reactor.core.publisher.Mono<VoidrenderInternal​(Map<String,​Object> model,
                                                                   @Nullable
                                                                   MediaType contentType,
                                                                   ServerWebExchange exchange)
        Convert model to request parameters and redirect to the given URL.
        指定者:
        renderInternal 在类中 AbstractView
        参数:
        model - combined output Map (never null), with dynamic values taking precedence over static attributes
        contentType - the content type selected to render with, which should match one of the supported media types
        exchange - current exchange
        返回:
        a Mono that represents when and if rendering succeeds
      • sendRedirect

        protected reactor.core.publisher.Mono<VoidsendRedirect​(String targetUrl,
                                                                 ServerWebExchange exchange)
        Send a redirect back to the HTTP client.
        参数:
        targetUrl - the target URL to redirect to
        exchange - current exchange
      • isRemoteHost

        protected boolean isRemoteHost​(String targetUrl)
        Whether the given targetUrl has a host that is a "foreign" system in which case HttpServletResponse.encodeRedirectURL(java.lang.String) will not be applied. This method returns true if the setHosts(String[]) property is configured and the target URL has a host that does not match.
        参数:
        targetUrl - the target redirect URL
        返回:
        true the target URL has a remote host, false if it the URL does not have a host or the "host" property is not configured.