Package org.astrogrid.samp.httpd
Class HttpServer.Request
java.lang.Object
org.astrogrid.samp.httpd.HttpServer.Request
- Enclosing class:
HttpServer
Represents a parsed HTTP client request.
-
Constructor Summary
ConstructorsConstructorDescriptionRequest
(String method, String url, Map headerMap, SocketAddress remoteAddress, byte[] body) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBody()
Returns the body of the HTTP request if there was one.Returns a map of key-value pairs representing HTTP request headers.Returns the request method string.Returns the address of the client which made this request.getUrl()
Returns the request URL string.toString()
-
Constructor Details
-
Request
Constructor.- Parameters:
method
- HTTP method string (GET, HEAD etc)url
- requested URL path (should start "/")headerMap
- map of HTTP request header key-value pairsremoteAddress
- address of the client making the requestbody
- bytes comprising request body, or null if none present
-
-
Method Details
-
getMethod
Returns the request method string.- Returns:
- GET, HEAD, or whatever
-
getUrl
Returns the request URL string. This should be a path starting "/" (the hostname part is not present).- Returns:
- url path
-
getHeaderMap
Returns a map of key-value pairs representing HTTP request headers. Note that for HTTP usage, header keys are case-insensitive (RFC2616 sec 4.2); theHttpServer.getHeader(java.util.Map, java.lang.String)
utility method can be used to interrogate the returned map.- Returns:
- header map
-
getRemoteAddress
Returns the address of the client which made this request.- Returns:
- requesting client's socket address
-
getBody
public byte[] getBody()Returns the body of the HTTP request if there was one.- Returns:
- body bytes or null
-
toString
-