public class HttpRequest extends Object
| Constructor and Description |
|---|
HttpRequest(String callerMethod,
HttpMethod httpMethod,
URL url,
HttpHeaders headers,
io.reactivex.Flowable<ByteBuffer> body,
HttpResponseDecoder responseDecoder)
Create a new HttpRequest object.
|
HttpRequest(String callerMethod,
HttpMethod httpMethod,
URL url,
HttpResponseDecoder responseDecoder)
Create a new HttpRequest object with the provided HTTP method (GET, POST, PUT, etc.) and the
provided URL.
|
| Modifier and Type | Method and Description |
|---|---|
io.reactivex.Flowable<ByteBuffer> |
body()
Get the body for this HttpRequest.
|
HttpRequest |
buffer()
Performs a deep clone of this HTTP request.
|
String |
callerMethod()
Get the fully qualified method that was called to invoke this HTTP request.
|
Context |
context() |
HttpHeaders |
headers()
Get the headers for this request.
|
HttpMethod |
httpMethod()
Get the HTTP method that this request will use.
|
HttpResponseDecoder |
responseDecoder()
Get the
HttpResponseDecoder which decodes messages sent in response to this HttpRequest. |
URL |
url()
Get the URL that this request will be sent to.
|
HttpRequest |
withBody(byte[] body)
Set the body of this HTTP request, automatically setting the Content-Length header based on the given body's length.
|
HttpRequest |
withBody(io.reactivex.Flowable<ByteBuffer> body)
Set the body of this HTTP request, leaving request headers unmodified.
|
HttpRequest |
withBody(String body)
Set the body of this HTTP request.
|
HttpRequest |
withCallerMethod(String callerMethod)
Set the caller method for this request.
|
HttpRequest |
withContext(Context context) |
HttpRequest |
withHeader(String headerName,
String headerValue)
Add the provided headerName and headerValue to the list of headers for this request.
|
HttpRequest |
withHeaders(HttpHeaders headers)
Set the headers for this request.
|
HttpRequest |
withHttpMethod(HttpMethod httpMethod)
Set the HTTP method that this request will use.
|
HttpRequest |
withUrl(URL url)
Set the URL that this request will be sent to.
|
public HttpRequest(String callerMethod, HttpMethod httpMethod, URL url, HttpResponseDecoder responseDecoder)
callerMethod - The fully qualified method that was called to invoke this HTTP request.httpMethod - The HTTP method to use with this request.url - The URL where this HTTP request should be sent to.responseDecoder - the which decodes messages sent in response to this HttpRequest.public HttpRequest(String callerMethod, HttpMethod httpMethod, URL url, HttpHeaders headers, io.reactivex.Flowable<ByteBuffer> body, HttpResponseDecoder responseDecoder)
callerMethod - The fully qualified method that was called to invoke this HTTP request.httpMethod - The HTTP method to use with this request.url - The URL where this HTTP request should be sent to.headers - The HTTP headers to use with this request.body - The body of this HTTP request.responseDecoder - the which decodes messages sent in response to this HttpRequest.public String callerMethod()
public HttpRequest withCallerMethod(String callerMethod)
callerMethod - The fully qualified method that was called to invoke this HTTP request.public HttpMethod httpMethod()
public HttpRequest withHttpMethod(HttpMethod httpMethod)
httpMethod - The HTTP method to use, e.g. "GET".public URL url()
public HttpRequest withUrl(URL url)
url - The new URL that this request will be sent to.public HttpResponseDecoder responseDecoder()
HttpResponseDecoder which decodes messages sent in response to this HttpRequest.public HttpHeaders headers()
public HttpRequest withHeaders(HttpHeaders headers)
headers - The set of headers to send for this request.public HttpRequest withHeader(String headerName, String headerValue)
headerName - The name of the header.headerValue - The value of the header.public io.reactivex.Flowable<ByteBuffer> body()
public HttpRequest withBody(String body)
body - The body of this HTTP request.public HttpRequest withBody(byte[] body)
body - The body of this HTTP request.public HttpRequest withBody(io.reactivex.Flowable<ByteBuffer> body)
body - The body of this HTTP request.public HttpRequest withContext(Context context)
context - the context to associate with this HttpRequestpublic HttpRequest buffer()
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/