java.lang.Object
com.djrapitops.plan.delivery.web.resolver.request.Request

public final class Request extends Object
Represents a HTTP request to use with Resolver.
  • Constructor Details

    • Request

      public Request(String method, URIPath path, URIQuery query, WebUser user, Map<String,String> headers, byte[] requestBody)
      Constructor.
      Parameters:
      method - HTTP method, GET, PUT, POST, etc
      path - Requested path /example/target
      query - Request parameters ?param=value etc
      user - Web user doing the request (if authenticated)
      headers - Request headers Documentation
      requestBody - Raw body as bytes, if present
    • Request

      public Request(String method, String target, WebUser user, Map<String,String> headers)
      Special constructor that figures out URIPath and URIQuery from "/path/and?query=params" and has no request body.
      Parameters:
      method - HTTP requst method
      target - The requested path and query, e.g. "/path/and?query=params"
      user - User that made the request
      headers - HTTP request headers
  • Method Details

    • getMethod

      public String getMethod()
      Get HTTP method.
      Returns:
      GET, PUT, POST, etc
    • getPath

      public URIPath getPath()
      Get the Requested path.
      Returns:
      URIPath.
    • getQuery

      public URIQuery getQuery()
      Get the Request parameters.
      Returns:
      URIQuery.
    • getRequestBody

      public byte[] getRequestBody()
      Get the raw body, if present.
      Returns:
      byte[].
    • getUser

      public Optional<WebUser> getUser()
      Get the user making the request.
      Returns:
      the user if authentication is enabled
    • getHeader

      public Optional<String> getHeader(String key)
      Get a header in the request.
      Parameters:
      key - Documentation
      Returns:
      Value if it is present in the request.
    • omitFirstInPath

      public Request omitFirstInPath()
    • toString

      public String toString()
      Overrides:
      toString in class Object