Interface HttpRequest


  • public interface HttpRequest
    An object that contains information about the current HTTP-Request.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getHeader​(java.lang.String name)
      Returns the value of the specified request header as a String.
      java.lang.String getMethod()
      Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
      java.lang.String getQueryString()
      Returns the query string that is contained in the request URL after the path.
      java.lang.Object getRequestObject()
      Returns the technology-specific request object.
      java.lang.String getRequestString()
      Returns the request URI including the optional query string.
      java.lang.String getRequestURI()
      Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
    • Method Detail

      • getRequestURI

        java.lang.String getRequestURI()
        Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.

        This is equivalent to javax.servlet.http.HttpServletRequest.getRequestURI().

        Returns:
        a String containing the part of the URL from the protocol name up to the query string
      • getQueryString

        java.lang.String getQueryString()
        Returns the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string.

        This is equivalent to javax.servlet.http.HttpServletRequest.getQueryString().

        Returns:
        a String containing the query string or null if the URL contains no query string.
      • getRequestString

        java.lang.String getRequestString()
        Returns the request URI including the optional query string.
        Returns:
        a String containing the content of getRequestURI() optionally followed by the query string.
      • getMethod

        java.lang.String getMethod()
        Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
        Returns:
        a String with the method name
      • getHeader

        java.lang.String getHeader​(java.lang.String name)
        Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first header in the request.

        Case sensitivity is handled by the technology-specific request object.

        This is equivalent to javax.servlet.http.HttpServletRequest.getHeader().

        Parameters:
        name - a String specifying the header name
        Returns:
        a String containing the value of the requested header, or null if the request does not have a header of that name
      • getRequestObject

        java.lang.Object getRequestObject()
        Returns the technology-specific request object.
        Returns:
        For servlet containers, a javax.servlet.http.HttpServletRequest, for Netty-HTTP/1 a io.netty.handler.codec.http.HttpRequest, for Netty-HTTP/2 a io.netty.handler.codec.http2.Http2Headers object