azure-docs-sdk-java/docs-ref-autogen/com.azure.core.http.HttpReq...

324 строки
21 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.HttpRequest"
fullName: "com.azure.core.http.HttpRequest"
name: "HttpRequest"
nameWithType: "HttpRequest"
summary: "Represents an outgoing HTTP request."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public class **HttpRequest**"
constructors:
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, String url)"
name: "HttpRequest(HttpMethod httpMethod, String url)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, String url)"
summary: "Create a new Http<wbr>Request instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "the target address to send the request to"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpRequest(HttpMethod httpMethod, String url)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url)"
name: "HttpRequest(HttpMethod httpMethod, URL url)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url)"
summary: "Create a new Http<wbr>Request instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "the target address to send the request to"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
summary: "Create a new Http<wbr>Request instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "the target address to send the request to"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
- description: "the HTTP headers to use with this request"
name: "headers"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders,com.azure.core.util.BinaryData)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
summary: "Create a new Http<wbr>Request instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "the target address to send the request to"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
- description: "the HTTP headers to use with this request"
name: "headers"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- description: "the request content"
name: "body"
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, BinaryData body)"
desc: "Create a new HttpRequest instance."
- uid: "com.azure.core.http.HttpRequest.HttpRequest(com.azure.core.http.HttpMethod,java.net.URL,com.azure.core.http.HttpHeaders,reactor.core.publisher.Flux<java.nio.ByteBuffer>)"
fullName: "com.azure.core.http.HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux<ByteBuffer> body)"
name: "HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux<ByteBuffer> body)"
nameWithType: "HttpRequest.HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux<ByteBuffer> body)"
summary: "Create a new Http<wbr>Request instance."
parameters:
- description: "the HTTP request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "the target address to send the request to"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
- description: "the HTTP headers to use with this request"
name: "headers"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- description: "the request content"
name: "body"
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>&gt;"
syntax: "public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux<ByteBuffer> body)"
desc: "Create a new HttpRequest instance."
methods:
- uid: "com.azure.core.http.HttpRequest.copy()"
fullName: "com.azure.core.http.HttpRequest.copy()"
name: "copy()"
nameWithType: "HttpRequest.copy()"
summary: "Creates a copy of the request."
syntax: "public HttpRequest copy()"
desc: "Creates a copy of the request.\n\nThe main purpose of this is so that this HttpRequest can be changed and the resulting HttpRequest can be a backup. This means that the cloned HttpHeaders and body must not be able to change from side effects of this HttpRequest."
returns:
description: "a new HTTP request instance with cloned instances of all mutable properties."
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.getBody()"
fullName: "com.azure.core.http.HttpRequest.getBody()"
name: "getBody()"
nameWithType: "HttpRequest.getBody()"
summary: "Get the request content."
syntax: "public Flux<ByteBuffer> getBody()"
desc: "Get the request content."
returns:
description: "the content to be sent"
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>&gt;"
- uid: "com.azure.core.http.HttpRequest.getBodyAsBinaryData()"
fullName: "com.azure.core.http.HttpRequest.getBodyAsBinaryData()"
name: "getBodyAsBinaryData()"
nameWithType: "HttpRequest.getBodyAsBinaryData()"
summary: "Get the request content."
syntax: "public BinaryData getBodyAsBinaryData()"
desc: "Get the request content."
returns:
description: "the content to be sent"
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.getHeaders()"
fullName: "com.azure.core.http.HttpRequest.getHeaders()"
name: "getHeaders()"
nameWithType: "HttpRequest.getHeaders()"
summary: "Get the request headers."
syntax: "public HttpHeaders getHeaders()"
desc: "Get the request headers."
returns:
description: "headers to be sent"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.getHttpMethod()"
fullName: "com.azure.core.http.HttpRequest.getHttpMethod()"
name: "getHttpMethod()"
nameWithType: "HttpRequest.getHttpMethod()"
summary: "Get the request method."
syntax: "public HttpMethod getHttpMethod()"
desc: "Get the request method."
returns:
description: "the request method"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.getUrl()"
fullName: "com.azure.core.http.HttpRequest.getUrl()"
name: "getUrl()"
nameWithType: "HttpRequest.getUrl()"
summary: "Get the target address."
syntax: "public URL getUrl()"
desc: "Get the target address."
returns:
description: "the target address"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
- uid: "com.azure.core.http.HttpRequest.setBody(byte[])"
fullName: "com.azure.core.http.HttpRequest.setBody(byte[] content)"
name: "setBody(byte[] content)"
nameWithType: "HttpRequest.setBody(byte[] content)"
summary: "Set the request content."
parameters:
- description: "the request content"
name: "content"
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public HttpRequest setBody(byte[] content)"
desc: "Set the request content.\n\nThe Content-Length header will be set based on the given content's length."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setBody(com.azure.core.util.BinaryData)"
fullName: "com.azure.core.http.HttpRequest.setBody(BinaryData content)"
name: "setBody(BinaryData content)"
nameWithType: "HttpRequest.setBody(BinaryData content)"
summary: "Set request content."
parameters:
- description: "the request content"
name: "content"
type: "<xref href=\"com.azure.core.util.BinaryData?alt=com.azure.core.util.BinaryData&text=BinaryData\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpRequest setBody(BinaryData content)"
desc: "Set request content.\n\nIf provided content has known length, i.e. <xref uid=\"com.azure.core.util.BinaryData.getLength()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData#getLength()\"></xref> returns non-null then Content-Length header is updated. Otherwise, if provided content has unknown length, i.e. <xref uid=\"com.azure.core.util.BinaryData.getLength()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData#getLength()\"></xref> returns null then the caller must set the Content-Length header to indicate the length of the content, or use Transfer-Encoding: chunked."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setBody(java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setBody(String content)"
name: "setBody(String content)"
nameWithType: "HttpRequest.setBody(String content)"
summary: "Set the request content."
parameters:
- description: "the request content"
name: "content"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpRequest setBody(String content)"
desc: "Set the request content.\n\nThe Content-Length header will be set based on the given content's length."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setBody(reactor.core.publisher.Flux<java.nio.ByteBuffer>)"
fullName: "com.azure.core.http.HttpRequest.setBody(Flux<ByteBuffer> content)"
name: "setBody(Flux<ByteBuffer> content)"
nameWithType: "HttpRequest.setBody(Flux<ByteBuffer> content)"
summary: "Set request content."
parameters:
- description: "the request content"
name: "content"
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html\">Flux</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html\">ByteBuffer</a>&gt;"
syntax: "public HttpRequest setBody(Flux<ByteBuffer> content)"
desc: "Set request content.\n\nCaller must set the Content-Length header to indicate the length of the content, or use Transfer-Encoding: chunked."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setHeader(com.azure.core.http.HttpHeaderName,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setHeader(HttpHeaderName headerName, String value)"
name: "setHeader(HttpHeaderName headerName, String value)"
nameWithType: "HttpRequest.setHeader(HttpHeaderName headerName, String value)"
summary: "Set a request header, replacing any existing value."
parameters:
- description: "the header name"
name: "headerName"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
- description: "the header value"
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpRequest setHeader(HttpHeaderName headerName, String value)"
desc: "Set a request header, replacing any existing value. A null for `value` will remove the header if one with matching name exists."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setHeader(java.lang.String,java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setHeader(String name, String value)"
name: "setHeader(String name, String value)"
nameWithType: "HttpRequest.setHeader(String name, String value)"
summary: "Set a request header, replacing any existing value."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpRequest.setHeader(com.azure.core.http.HttpHeaderName,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#setHeader(HttpHeaderName, String)\"></xref> instead as is offers better performance."
parameters:
- description: "the header name"
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the header value"
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpRequest setHeader(String name, String value)"
desc: "Set a request header, replacing any existing value. A null for `value` will remove the header if one with matching name exists."
hasDeprecatedTag: true
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setHeaders(com.azure.core.http.HttpHeaders)"
fullName: "com.azure.core.http.HttpRequest.setHeaders(HttpHeaders headers)"
name: "setHeaders(HttpHeaders headers)"
nameWithType: "HttpRequest.setHeaders(HttpHeaders headers)"
summary: "Set the request headers."
parameters:
- description: "the set of headers"
name: "headers"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpRequest setHeaders(HttpHeaders headers)"
desc: "Set the request headers."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setHttpMethod(com.azure.core.http.HttpMethod)"
fullName: "com.azure.core.http.HttpRequest.setHttpMethod(HttpMethod httpMethod)"
name: "setHttpMethod(HttpMethod httpMethod)"
nameWithType: "HttpRequest.setHttpMethod(HttpMethod httpMethod)"
summary: "Set the request method."
parameters:
- description: "the request method"
name: "httpMethod"
type: "<xref href=\"com.azure.core.http.HttpMethod?alt=com.azure.core.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpRequest setHttpMethod(HttpMethod httpMethod)"
desc: "Set the request method."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setUrl(java.lang.String)"
fullName: "com.azure.core.http.HttpRequest.setUrl(String url)"
name: "setUrl(String url)"
nameWithType: "HttpRequest.setUrl(String url)"
summary: "Set the target address to send the request to."
parameters:
- description: "target address as a String"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpRequest setUrl(String url)"
desc: "Set the target address to send the request to."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpRequest.setUrl(java.net.URL)"
fullName: "com.azure.core.http.HttpRequest.setUrl(URL url)"
name: "setUrl(URL url)"
nameWithType: "HttpRequest.setUrl(URL url)"
summary: "Set the target address to send the request to."
parameters:
- description: "target address as <xref uid=\"java.net.URL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"URL\"></xref>"
name: "url"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/net/URL.html\">URL</a>"
syntax: "public HttpRequest setUrl(URL url)"
desc: "Set the target address to send the request to."
returns:
description: "this HttpRequest"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
type: "class"
desc: "Represents an outgoing HTTP request.\n\nThis class encapsulates an HTTP request, including the HTTP method, URL, headers, and body. It provides methods to set and get these properties.\n\nThis class is useful when you want to create an HTTP request to send to a server. For example, you can use it to create a GET request to retrieve a resource, a POST request to create a resource, a PUT request to update a resource, or a DELETE request to delete a resource.\n\nNote: This class provides a <xref uid=\"com.azure.core.http.HttpRequest.copy()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#copy()\"></xref> method to create a copy of the HTTP request. This is useful when you want to modify the HTTP request without affecting the original request."
metadata: {}
package: "com.azure.core.http"
artifact: com.azure:azure-core:1.52.0