Package org.elasticsearch.http
Interface HttpRequest
- All Known Implementing Classes:
HttpPipelinedRequest
public interface HttpRequest
A basic http request abstraction. Http modules needs to implement this interface to integrate with the
server package's rest handling.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classHttpRequest.HttpVersion -
Method Summary
Modifier and Type Method Description default java.util.List<java.lang.String>allHeaders(java.lang.String name)BytesReferencecontent()HttpResponsecreateResponse(RestStatus status, BytesReference content)Create an http response from this request and the supplied status and content.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaders()Get all of the headers and values associated with the headers.java.lang.ExceptiongetInboundException()default java.lang.Stringheader(java.lang.String name)RestRequest.Methodmethod()Returns the HTTP method used in the HTTP request.HttpRequest.HttpVersionprotocolVersion()voidrelease()Release any resources associated with this request.HttpRequestreleaseAndCopy()If this instances uses any pooled resources, creates a copy of this instance that does not use any pooled resources and releases any resources associated with this instance.HttpRequestremoveHeader(java.lang.String header)java.util.List<java.lang.String>strictCookies()java.lang.Stringuri()The uri of the rest request, with the query string.
-
Method Details
-
method
RestRequest.Method method()Returns the HTTP method used in the HTTP request.- Returns:
- the
RestRequest.Methodused in the REST request - Throws:
java.lang.IllegalArgumentException- if the HTTP method is invalid
-
uri
java.lang.String uri()The uri of the rest request, with the query string. -
content
BytesReference content() -
getHeaders
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()Get all of the headers and values associated with the headers. Modifications of this map are not supported. -
header
default java.lang.String header(java.lang.String name) -
allHeaders
default java.util.List<java.lang.String> allHeaders(java.lang.String name) -
strictCookies
java.util.List<java.lang.String> strictCookies() -
protocolVersion
HttpRequest.HttpVersion protocolVersion() -
removeHeader
-
createResponse
Create an http response from this request and the supplied status and content. -
getInboundException
@Nullable java.lang.Exception getInboundException() -
release
void release()Release any resources associated with this request. Implementations should be idempotent. The behavior ofcontent()after this method has been invoked is undefined and implementation specific. -
releaseAndCopy
HttpRequest releaseAndCopy()If this instances uses any pooled resources, creates a copy of this instance that does not use any pooled resources and releases any resources associated with this instance. If the instance does not use any shared resources, returns itself.- Returns:
- a safe unpooled http request
-