Class Request


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

      Constructors 
      Constructor Description
      Request​(java.lang.String method, URIPath path, URIQuery query, WebUser user, java.util.Map<java.lang.String,​java.lang.String> headers)
      Constructor.
      Request​(java.lang.String method, java.lang.String target, WebUser user, java.util.Map<java.lang.String,​java.lang.String> headers)  
    • Constructor Detail

      • Request

        public Request​(java.lang.String method,
                       URIPath path,
                       URIQuery query,
                       WebUser user,
                       java.util.Map<java.lang.String,​java.lang.String> headers)
        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 https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
      • Request

        public Request​(java.lang.String method,
                       java.lang.String target,
                       WebUser user,
                       java.util.Map<java.lang.String,​java.lang.String> headers)
    • Method Detail

      • getMethod

        public java.lang.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.
      • getUser

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

        public java.util.Optional<java.lang.String> getHeader​(java.lang.String key)
        Get a header in the request.
        Parameters:
        key - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
        Returns:
        Value if it is present in the request.
      • omitFirstInPath

        public Request omitFirstInPath()
      • toString

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