Interface WebRequest

All Known Implementing Classes:
AbstractWebRequest, BlockingWebRequest, NettyWebRequest, NonBlockingWebRequest

public interface WebRequest
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
    services.moleculer.stream.PacketStream
    Returns the request body as PacketStream.
    int
    Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE.
    Returns the MIME type of the body of the request, or null if the type is not known.
    Returns the value of the specified request header as a String.
    Returns an iterator of all the header names this request contains.
    Returns the internal object of this WebRequest.
    Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
    Returns any extra path information associated with the URL the client sent when it made this request.
    Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion.
    Returns the query string that is contained in the request URL after the path.
    boolean
    Checks if the Content-Type header defines a multipart request.
  • Method Details

    • getAddress

      String getAddress()
      Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.
      Returns:
      a String containing the IP address of the client that sent the request
    • getMethod

      String getMethod()
      Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.
      Returns:
      a String specifying the name of the method with which this request was made
    • getPath

      String getPath()
      Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character.
      Returns:
      a String, decoded by the web container, specifying extra path information that comes after the servlet path but before the query string in the request URL
    • getQuery

      String getQuery()
      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. Same as the value of the CGI variable QUERY_STRING.
      Returns:
      a String containing the query string or null if the URL contains no query string. The value is not decoded by the container
    • getContentLength

      int getContentLength()
      Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE. For HTTP servlets, same as the value of the CGI variable CONTENT_LENGTH.
      Returns:
      an integer containing the length of the request body or -1 if the length is not known or is greater than Integer.MAX_VALUE
    • getContentType

      String getContentType()
      Returns the MIME type of the body of the request, or null if the type is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_TYPE.
      Returns:
      a String containing the name of the MIME type of the request, or null if the type is not known
    • getBody

      services.moleculer.stream.PacketStream getBody()
      Returns the request body as PacketStream.
      Returns:
      Request body (or null)
    • getHeader

      String getHeader(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 head in the request.
      Parameters:
      name - 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
    • getHeaders

      Iterator<String> getHeaders()
      Returns an iterator of all the header names this request contains. If the request has no headers, this method returns an empty iterator.
      Returns:
      an iterator of all the header names sent with this request; if the request has no headers, an empty iterator
    • isMultipart

      boolean isMultipart()
      Checks if the Content-Type header defines a multipart request.
      Returns:
      true if the request is a multipart request, false otherwise
    • getProtocol

      String getProtocol()
      Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion.
      Returns:
      a String containing the protocol name and version number
    • getInternalObject

      Object getInternalObject()
      Returns the internal object of this WebRequest.
      Returns:
      internal object (HttpServletRequest or Netty Context)