Interface HttpRequest

  • All Known Implementing Classes:
    ServletHttpRequest

    public interface HttpRequest
    Represents an incoming HTTP request and the contract to manipulate it.
    Author:
    Pedro Igor
    • Method Detail

      • getRelativePath

        String getRelativePath()
        Get the request path. This is the path relative to the context path. E.g.: for a HTTP GET request to http://my.appserver.com/my-application/path/sub-path this method is going to return /path/sub-path.
        Returns:
        the relative path
      • getMethod

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

        String getURI()
        Get the URI representation for the current request.
        Returns:
        a String representation for the current request
      • getHeaders

        List<String> getHeaders​(String name)
        Get a list of all of the values set for the specified header within the HTTP request.
        Parameters:
        name - the header name
        Returns:
        a list of the values set for this header, if the header is not set on the request then null should be returned
      • getFirstParam

        String getFirstParam​(String name)
        Get the first value for a parameter with the given name
        Parameters:
        name - the parameter name
        Returns:
        the value of the parameter
      • getCookieValue

        String getCookieValue​(String name)
        Get the first value for a cookie with the given name.
        Parameters:
        name - the parameter name
        Returns:
        the value of the cookie
      • getRemoteAddr

        String getRemoteAddr()
        Returns the client address.
        Returns:
        the client address.
      • isSecure

        boolean isSecure()
        Indicates if the request is coming from a secure channel through HTTPS.
        Returns:
        true if the HTTP scheme is set to 'https'. Otherwise, false
      • getHeader

        String getHeader​(String name)
        Get the first value for a HEADER with the given name.
        Parameters:
        name - the HEADER name
        Returns:
        the value of the HEADER
      • getInputStream

        InputStream getInputStream​(boolean buffered)
        Returns the request input stream
        Parameters:
        buffered - if the input stream should be buffered and support for multiple reads
        Returns:
        the request input stream