Class Request

    • Constructor Summary

      Constructors 
      Constructor Description
      Request()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getBody()
      Get HTTP request body as InputStream
      java.util.Map<java.lang.String,​java.lang.String> getHeaders()
      Get request headers
      java.lang.String getProtcol()
      Get the protocol line of http request, http/1.1 or http/2 for example.
      java.lang.String getQueryString()
      Get the query string part of request URL, typically it's the string after "?"
      java.lang.String getRemoteAddr()
      Get the client address string
      Request.Method getRequestMethod()
      Get the HTTP request method
      Request.Scheme getScheme()
      Get the request scheme, HTTP or HTTPS
      java.lang.String getServerName()
      Get the hostname of current server
      java.lang.Integer getServerPort()
      Get the serving port of current server
      java.security.cert.X509Certificate getSslClientCert()
      Get the TLS client certificate if available
      java.lang.String getUri()
      Get the request URI
      void setBody​(java.io.InputStream body)
      Set the HTTP request body
      void setHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
      Set the request headers
      void setProtcol​(java.lang.String protcol)
      Set the protocol line
      void setQueryString​(java.lang.String queryString)
      Set the query string
      void setRemoteAddr​(java.lang.String remoteAddr)
      Set the client address string
      void setRequestMethod​(Request.Method requestMethod)
      Set the request method
      void setScheme​(Request.Scheme scheme)
      Set current request scheme, HTTP or HTTPS
      void setServerName​(java.lang.String serverName)
      Set the hostname of current server
      void setServerPort​(java.lang.Integer serverPort)
      Set the serving port of current server
      void setSslClientCert​(java.security.cert.X509Certificate sslClientCert)
      Set the certificate for current request if any
      void setUri​(java.lang.String uri)
      Set the request URI
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Request

        public Request()
    • Method Detail

      • getServerPort

        @Nonnull
        public java.lang.Integer getServerPort()
        Get the serving port of current server
        Returns:
        the port number
      • setServerPort

        public void setServerPort​(@Nonnull
                                  java.lang.Integer serverPort)
        Set the serving port of current server
        Parameters:
        serverPort - the port number
      • getServerName

        @Nonnull
        public java.lang.String getServerName()
        Get the hostname of current server
        Returns:
        the hostname
      • setServerName

        public void setServerName​(@Nonnull
                                  java.lang.String serverName)
        Set the hostname of current server
        Parameters:
        serverName - the hostname
      • getRemoteAddr

        @Nonnull
        public java.lang.String getRemoteAddr()
        Get the client address string
        Returns:
        the client address
      • setRemoteAddr

        public void setRemoteAddr​(@Nonnull
                                  java.lang.String remoteAddr)
        Set the client address string
        Parameters:
        remoteAddr - the address string
      • getUri

        @Nonnull
        public java.lang.String getUri()
        Get the request URI
        Returns:
        the URI
      • setUri

        public void setUri​(@Nonnull
                           java.lang.String uri)
        Set the request URI
        Parameters:
        uri - the URI
      • getQueryString

        @Nullable
        public java.lang.String getQueryString()
        Get the query string part of request URL, typically it's the string after "?"
        Returns:
        the query string line
      • setQueryString

        public void setQueryString​(@Nullable
                                   java.lang.String queryString)
        Set the query string
        Parameters:
        queryString - the query string
      • getScheme

        @Nonnull
        public Request.Scheme getScheme()
        Get the request scheme, HTTP or HTTPS
        Returns:
        the scheme
      • setScheme

        public void setScheme​(@Nonnull
                              Request.Scheme scheme)
        Set current request scheme, HTTP or HTTPS
        Parameters:
        scheme - the scheme
      • getRequestMethod

        @Nonnull
        public Request.Method getRequestMethod()
        Get the HTTP request method
        Returns:
        the method
      • setRequestMethod

        public void setRequestMethod​(@Nonnull
                                     Request.Method requestMethod)
        Set the request method
        Parameters:
        requestMethod - the method
      • getProtcol

        @Nonnull
        public java.lang.String getProtcol()
        Get the protocol line of http request, http/1.1 or http/2 for example.
        Returns:
        the protocol line
      • setProtcol

        public void setProtcol​(@Nonnull
                               java.lang.String protcol)
        Set the protocol line
        Parameters:
        protcol - the protocol line
      • getSslClientCert

        @Nullable
        public java.security.cert.X509Certificate getSslClientCert()
        Get the TLS client certificate if available
        Returns:
        the certificate
      • setSslClientCert

        public void setSslClientCert​(@Nullable
                                     java.security.cert.X509Certificate sslClientCert)
        Set the certificate for current request if any
        Parameters:
        sslClientCert - the certificate
      • getHeaders

        @Nonnull
        public java.util.Map<java.lang.String,​java.lang.String> getHeaders()
        Get request headers
        Returns:
        the header map
      • setHeaders

        public void setHeaders​(@Nonnull
                               java.util.Map<java.lang.String,​java.lang.String> headers)
        Set the request headers
        Parameters:
        headers - the header map
      • getBody

        @Nullable
        public java.io.InputStream getBody()
        Get HTTP request body as InputStream
        Returns:
        the InputStream
      • setBody

        public void setBody​(@Nullable
                            java.io.InputStream body)
        Set the HTTP request body
        Parameters:
        body - the InputStream
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object