Package org.astrogrid.samp.httpd

# Class HttpServer.Request

java.lang.Object
org.astrogrid.samp.httpd.HttpServer.Request

Enclosing class:
  `HttpServer`

public static class HttpServer.Request extends Object
Represents a parsed HTTP client request.

## Constructor Summary

Constructors
Constructor
Description
`Request(String method, String url, Map headerMap, SocketAddress remoteAddress, byte[] body)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`byte[]`
`getBody()`
Returns the body of the HTTP request if there was one.
`Map`
`getHeaderMap()`
Returns a map of key-value pairs representing HTTP request headers.
`String`
`getMethod()`
Returns the request method string.
`SocketAddress`
`getRemoteAddress()`
Returns the address of the client which made this request.
`String`
`getUrl()`
Returns the request URL string.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Request

public Request(String method, String url, Map headerMap, SocketAddress remoteAddress, byte[] body)
Constructor.

Parameters:
  `method` - HTTP method string (GET, HEAD etc)
  `url` - requested URL path (should start "/")
  `headerMap` - map of HTTP request header key-value pairs
  `remoteAddress` - address of the client making the request
  `body` - bytes comprising request body, or null if none present

## Method Details

### getMethod

public String getMethod()
Returns the request method string.

Returns:
  GET, HEAD, or whatever

### getUrl

public String getUrl()
Returns the request URL string. This should be a path starting "/" (the hostname part is not present).

Returns:
  url path

### getHeaderMap

public Map 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); the `HttpServer.getHeader(java.util.Map, java.lang.String)` utility method can be used to interrogate the returned map.

Returns:
  header map

### getRemoteAddress

public SocketAddress 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

public String toString()

Overrides:
  `toString` in class `Object`