- All Known Implementing Classes:
- HttpExchange,- HttpsExchange
public interface Request
A view of the immutable request state of an HTTP exchange.
- Since:
- 18
- 
Method Details- 
getRequestURIURI getRequestURI()Returns the requestURI.- Returns:
- the request URI
 
- 
getRequestMethodString getRequestMethod()Returns the request method.- Returns:
- the request method string
 
- 
getRequestHeadersHeaders getRequestHeaders()Returns an immutableHeaderscontaining the HTTP headers that were included with this request.The keys in this Headersare the header names, while the values are aListof Strings containing each value that was included in the request, in the order they were included. Header fields appearing multiple times are represented as multiple string values.The keys in Headersare case-insensitive.- Returns:
- a read-only Headerswhich can be used to access request headers.
 
- 
withReturns an identicalRequestwith an additional header.The returned Requesthas the same set ofheadersasthisrequest, but with the addition of the given header. All other request state remains unchanged.If thisrequest already contains a header with the same name as the givenheaderName, then its value is not replaced.- Implementation Requirements:
- The default implementation first creates a new Headers,h, then adds all the request headers fromthisrequest toh, then adds the given name-values mapping ifheaderNameis not present inh. Then an unmodifiable view,h', ofhand a newRequest,r, are created. ThegetRequestMethodandgetRequestURImethods ofrsimply invoke the equivalently named method ofthisrequest. ThegetRequestHeadersmethod returnsh'. Lastly,ris returned.
- Parameters:
- headerName- the header name
- headerValues- the list of header values
- Returns:
- a request
- Throws:
- NullPointerException- if any argument is null, or if any element of headerValues is null.
 
 
-