public class HttpRequest extends Object
HttpRequest with HttpMethod,
URL, HttpHeader and request body.| Constructor and Description |
|---|
HttpRequest(HttpMethod httpMethod,
String url)
Create a new HttpRequest instance.
|
HttpRequest(HttpMethod httpMethod,
URL url)
Create a new HttpRequest instance.
|
HttpRequest(HttpMethod httpMethod,
URL url,
HttpHeaders headers,
Flux<ByteBuffer> body)
Create a new HttpRequest instance.
|
| Modifier and Type | Method and Description |
|---|---|
HttpRequest |
copy()
Creates a copy of the request.
|
Flux<ByteBuffer> |
getBody()
Get the request content.
|
HttpHeaders |
getHeaders()
Get the request headers.
|
HttpMethod |
getHttpMethod()
Get the request method.
|
URL |
getUrl()
Get the target address.
|
HttpRequest |
setBody(byte[] content)
Set the request content.
|
HttpRequest |
setBody(Flux<ByteBuffer> content)
Set request content.
|
HttpRequest |
setBody(String content)
Set the request content.
|
HttpRequest |
setHeader(String name,
String value)
Set a request header, replacing any existing value.
|
HttpRequest |
setHeaders(HttpHeaders headers)
Set the request headers.
|
HttpRequest |
setHttpMethod(HttpMethod httpMethod)
Set the request method.
|
HttpRequest |
setUrl(String url)
Set the target address to send the request to.
|
HttpRequest |
setUrl(URL url)
Set the target address to send the request to.
|
public HttpRequest(HttpMethod httpMethod, URL url)
httpMethod - the HTTP request methodurl - the target address to send the request topublic HttpRequest(HttpMethod httpMethod, String url)
httpMethod - the HTTP request methodurl - the target address to send the request toIllegalArgumentException - if url is null or it cannot be parsed into a valid URL.public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux<ByteBuffer> body)
httpMethod - the HTTP request methodurl - the target address to send the request toheaders - the HTTP headers to use with this requestbody - the request contentpublic HttpMethod getHttpMethod()
public HttpRequest setHttpMethod(HttpMethod httpMethod)
httpMethod - the request methodpublic URL getUrl()
public HttpRequest setUrl(URL url)
url - target address as URLpublic HttpRequest setUrl(String url)
url - target address as a StringIllegalArgumentException - if url is null or it cannot be parsed into a valid URL.public HttpHeaders getHeaders()
public HttpRequest setHeaders(HttpHeaders headers)
headers - the set of headerspublic HttpRequest setHeader(String name, String value)
value will remove the header if one with matching name exists.name - the header namevalue - the header valuepublic Flux<ByteBuffer> getBody()
public HttpRequest setBody(String content)
content - the request contentpublic HttpRequest setBody(byte[] content)
content - the request contentpublic HttpRequest setBody(Flux<ByteBuffer> content)
content - the request contentpublic HttpRequest copy()
Copyright © 2020 Microsoft Corporation. All rights reserved.