Class ServerWebRequest

  • All Implemented Interfaces:
    org.springframework.web.context.request.NativeWebRequest, org.springframework.web.context.request.RequestAttributes, org.springframework.web.context.request.WebRequest

    public class ServerWebRequest
    extends java.lang.Object
    implements org.springframework.web.context.request.NativeWebRequest
    The adapter implementation of NativeWebRequest based on ServerWebExchange
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    ServerWebExchange, ServerHttpRequest, ServerHttpResponse, NativeWebRequest
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String REFERENCE_KEY_REQUEST
      The reference key of the request.
      static java.lang.String REFERENCE_KEY_RESPONSE
      The reference key of the response.
      static java.lang.String REFERENCE_KEY_SESSION
      The reference key of the session.
      static java.lang.String REMOTE_USER_ATTRIBUTE_NAME
      The attribute name of the remote user in the request : "REMOTE_USER" .
      static java.lang.String SESSION_MUTEX_ATTRIBUTE_NAME
      The attribute name of the mutex for the session, used for synchronization on the session.
      • Fields inherited from interface org.springframework.web.context.request.RequestAttributes

        REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerWebRequest​(org.springframework.web.server.ServerWebExchange exchange)  
    • Constructor Detail

      • ServerWebRequest

        public ServerWebRequest​(org.springframework.web.server.ServerWebExchange exchange)
    • Method Detail

      • getNativeRequest

        @Nonnull
        public java.lang.Object getNativeRequest()
        Specified by:
        getNativeRequest in interface org.springframework.web.context.request.NativeWebRequest
      • getNativeResponse

        @Nonnull
        public java.lang.Object getNativeResponse()
        Specified by:
        getNativeResponse in interface org.springframework.web.context.request.NativeWebRequest
      • getNativeRequest

        @Nullable
        public <T> T getNativeRequest​(java.lang.Class<T> requiredType)
        Specified by:
        getNativeRequest in interface org.springframework.web.context.request.NativeWebRequest
      • getNativeResponse

        @Nullable
        public <T> T getNativeResponse​(java.lang.Class<T> requiredType)
        Specified by:
        getNativeResponse in interface org.springframework.web.context.request.NativeWebRequest
      • getHeader

        @Nullable
        public java.lang.String getHeader​(java.lang.String headerName)
        Specified by:
        getHeader in interface org.springframework.web.context.request.WebRequest
      • getHeaderValues

        @Nullable
        public java.lang.String[] getHeaderValues​(java.lang.String headerName)
        Specified by:
        getHeaderValues in interface org.springframework.web.context.request.WebRequest
      • getHeaderNames

        @Nonnull
        public java.util.Iterator<java.lang.String> getHeaderNames()
        Specified by:
        getHeaderNames in interface org.springframework.web.context.request.WebRequest
      • getParameter

        @Nullable
        public java.lang.String getParameter​(java.lang.String paramName)
        Specified by:
        getParameter in interface org.springframework.web.context.request.WebRequest
      • getParameterValues

        @Nullable
        public java.lang.String[] getParameterValues​(java.lang.String paramName)
        Specified by:
        getParameterValues in interface org.springframework.web.context.request.WebRequest
      • getParameterNames

        @Nonnull
        public java.util.Iterator<java.lang.String> getParameterNames()
        Specified by:
        getParameterNames in interface org.springframework.web.context.request.WebRequest
      • getParameterMap

        @Nonnull
        public java.util.Map<java.lang.String,​java.lang.String[]> getParameterMap()
        Specified by:
        getParameterMap in interface org.springframework.web.context.request.WebRequest
      • getLocale

        @Nullable
        public java.util.Locale getLocale()
        Specified by:
        getLocale in interface org.springframework.web.context.request.WebRequest
      • getContextPath

        @Nonnull
        public java.lang.String getContextPath()
        Specified by:
        getContextPath in interface org.springframework.web.context.request.WebRequest
      • getRemoteUser

        @Nullable
        public java.lang.String getRemoteUser()
        Specified by:
        getRemoteUser in interface org.springframework.web.context.request.WebRequest
      • getUserPrincipal

        @Nullable
        public java.security.Principal getUserPrincipal()
        Specified by:
        getUserPrincipal in interface org.springframework.web.context.request.WebRequest
      • isUserInRole

        public boolean isUserInRole​(java.lang.String role)
        Specified by:
        isUserInRole in interface org.springframework.web.context.request.WebRequest
      • isSecure

        public boolean isSecure()
        Specified by:
        isSecure in interface org.springframework.web.context.request.WebRequest
      • checkNotModified

        public boolean checkNotModified​(long lastModifiedTimestamp)
        Specified by:
        checkNotModified in interface org.springframework.web.context.request.WebRequest
      • checkNotModified

        public boolean checkNotModified​(java.lang.String etag)
        Specified by:
        checkNotModified in interface org.springframework.web.context.request.WebRequest
      • checkNotModified

        public boolean checkNotModified​(java.lang.String etag,
                                        long lastModifiedTimestamp)
        Specified by:
        checkNotModified in interface org.springframework.web.context.request.WebRequest
      • getDescription

        @Nonnull
        public java.lang.String getDescription​(boolean includeClientInfo)
        Specified by:
        getDescription in interface org.springframework.web.context.request.WebRequest
      • getAttribute

        @Nullable
        public java.lang.Object getAttribute​(java.lang.String name,
                                             int scope)
        Specified by:
        getAttribute in interface org.springframework.web.context.request.RequestAttributes
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value,
                                 int scope)
        Specified by:
        setAttribute in interface org.springframework.web.context.request.RequestAttributes
      • removeAttribute

        public void removeAttribute​(java.lang.String name,
                                    int scope)
        Specified by:
        removeAttribute in interface org.springframework.web.context.request.RequestAttributes
      • getAttributeNames

        @Nonnull
        public java.lang.String[] getAttributeNames​(int scope)
        Specified by:
        getAttributeNames in interface org.springframework.web.context.request.RequestAttributes
      • registerDestructionCallback

        public void registerDestructionCallback​(java.lang.String name,
                                                java.lang.Runnable callback,
                                                int scope)
        Specified by:
        registerDestructionCallback in interface org.springframework.web.context.request.RequestAttributes
      • resolveReference

        @Nullable
        public java.lang.Object resolveReference​(java.lang.String key)
        Specified by:
        resolveReference in interface org.springframework.web.context.request.RequestAttributes
      • getSessionId

        @Nonnull
        public java.lang.String getSessionId()
        Specified by:
        getSessionId in interface org.springframework.web.context.request.RequestAttributes
      • getSessionMutex

        @Nonnull
        public java.lang.Object getSessionMutex()
        Specified by:
        getSessionMutex in interface org.springframework.web.context.request.RequestAttributes
      • getExchange

        @Nonnull
        public org.springframework.web.server.ServerWebExchange getExchange()
        Get the ServerWebExchange
        Returns:
        the ServerWebExchange
      • getRequest

        @Nonnull
        public org.springframework.http.server.reactive.ServerHttpRequest getRequest()
        Get the ServerHttpRequest
        Returns:
        the ServerHttpRequest
      • getResponse

        @Nonnull
        public org.springframework.http.server.reactive.ServerHttpResponse getResponse()
        Get the ServerHttpResponse
        Returns:
        the ServerHttpResponse
      • getRequestHeaders

        @Nonnull
        public org.springframework.http.HttpHeaders getRequestHeaders()
        Get the HttpHeaders
        Returns:
        the mutable HttpHeaders
      • getQueryParams

        @Nonnull
        @Immutable
        public org.springframework.util.MultiValueMap<java.lang.String,​java.lang.String> getQueryParams()
        Get a read-only map with parsed and decoded query parameter values.
        Returns:
        a read-only map with parsed and decoded query parameter values
      • getSession

        @Nonnull
        public org.springframework.web.server.WebSession getSession()
      • toArray

        @Nullable
        protected java.lang.String[] toArray​(java.util.List<java.lang.String> values)