Class RequestLine

java.lang.Object
com.renomad.minum.web.RequestLine

public final class RequestLine extends Object
This class holds data and methods for dealing with the "start line" in an HTTP request. For example, GET /foo HTTP/1.1
  • Field Details

  • Constructor Details

    • RequestLine

      public RequestLine(RequestLine.Method method, PathDetails pathDetails, HttpVersion version, String rawValue, ILogger logger)
      Parameters:
      method - GET, POST, etc.
      pathDetails - See PathDetails
      version - the version of HTTP (1.0 or 1.1) we're receiving
      rawValue - the entire raw string of the start line
  • Method Details

    • queryString

      public Map<String,String> queryString()
      Returns a map of the key-value pairs in the URL, for example in http://foo.com?name=alice you have a key of name and a value of alice.
    • extractRequestLine

      public RequestLine extractRequestLine(String value)
      Given the string value of a Request Line (like GET /hello HTTP/1.1) validate and extract the values for our use.
    • getMethod

      public RequestLine.Method getMethod()
      Return the method of this request-line. For example, GET, PUT, POST...
    • getPathDetails

      public PathDetails getPathDetails()
      This returns an object which contains essential information about the path in the request line. For example, if the request line is "GET /sample?foo=bar HTTP/1.1", this would hold data for the path ("sample") and the query string ("foo=bar")
    • getVersion

      public HttpVersion getVersion()
      Gets the HTTP version, either 1.0 or 1.1
    • getRawValue

      public String getRawValue()
      Get the string value of this request line, such as "GET /sample.html HTTP/1.1"
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object