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

231 строка
18 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.HttpResponse"
fullName: "com.azure.core.http.HttpResponse"
name: "HttpResponse"
nameWithType: "HttpResponse"
summary: "Represents an incoming HTTP response."
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 abstract class **HttpResponse**</br> implements <a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html\">Closeable</a>"
constructors:
- uid: "com.azure.core.http.HttpResponse.HttpResponse(com.azure.core.http.HttpRequest)"
fullName: "com.azure.core.http.HttpResponse.HttpResponse(HttpRequest request)"
name: "HttpResponse(HttpRequest request)"
nameWithType: "HttpResponse.HttpResponse(HttpRequest request)"
summary: "Creates an instance of <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpResponse\"></xref>."
modifiers:
- "protected"
parameters:
- description: "The <xref uid=\"com.azure.core.http.HttpRequest\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpRequest\"></xref> that resulted in this <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpResponse\"></xref>."
name: "request"
type: "<xref href=\"com.azure.core.http.HttpRequest?alt=com.azure.core.http.HttpRequest&text=HttpRequest\" data-throw-if-not-resolved=\"False\" />"
syntax: "protected HttpResponse(HttpRequest request)"
desc: "Creates an instance of <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpResponse\"></xref>."
methods:
- uid: "com.azure.core.http.HttpResponse.buffer()"
fullName: "com.azure.core.http.HttpResponse.buffer()"
name: "buffer()"
nameWithType: "HttpResponse.buffer()"
summary: "Gets a new <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"response\"></xref> object wrapping this response with its content buffered into memory."
syntax: "public HttpResponse buffer()"
desc: "Gets a new <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"response\"></xref> object wrapping this response with its content buffered into memory."
returns:
description: "A new <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"response\"></xref> with the content buffered."
type: "<xref href=\"com.azure.core.http.HttpResponse?alt=com.azure.core.http.HttpResponse&text=HttpResponse\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpResponse.close()"
fullName: "com.azure.core.http.HttpResponse.close()"
name: "close()"
nameWithType: "HttpResponse.close()"
summary: "Closes the response content stream, if any."
syntax: "public void close()"
desc: "Closes the response content stream, if any."
- uid: "com.azure.core.http.HttpResponse.getBody()"
fullName: "com.azure.core.http.HttpResponse.getBody()"
name: "getBody()"
nameWithType: "HttpResponse.getBody()"
summary: "Get the publisher emitting response content chunks."
modifiers:
- "abstract"
syntax: "public abstract Flux<ByteBuffer> getBody()"
desc: "Get the publisher emitting response content chunks.\n\nReturns a stream of the response's body content. Emissions may occur on Reactor threads which should not be blocked. Blocking should be avoided as much as possible/practical in reactive programming but if you do use methods like `block()` on the stream then be sure to use `publishOn` before the blocking call."
returns:
description: "The response's content as a stream of <xref uid=\"java.nio.ByteBuffer\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ByteBuffer\"></xref>."
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.HttpResponse.getBodyAsBinaryData()"
fullName: "com.azure.core.http.HttpResponse.getBodyAsBinaryData()"
name: "getBodyAsBinaryData()"
nameWithType: "HttpResponse.getBodyAsBinaryData()"
summary: "Gets the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that represents the body of the response."
syntax: "public BinaryData getBodyAsBinaryData()"
desc: "Gets the <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> that represents the body of the response.\n\nSubclasses should override this method."
returns:
description: "The <xref uid=\"com.azure.core.util.BinaryData\" data-throw-if-not-resolved=\"false\" data-raw-source=\"BinaryData\"></xref> response body."
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.HttpResponse.getBodyAsByteArray()"
fullName: "com.azure.core.http.HttpResponse.getBodyAsByteArray()"
name: "getBodyAsByteArray()"
nameWithType: "HttpResponse.getBodyAsByteArray()"
summary: "Gets the response content as a `byte[]`."
modifiers:
- "abstract"
syntax: "public abstract Mono<byte[]> getBodyAsByteArray()"
desc: "Gets the response content as a `byte[]`."
returns:
description: "The response content as a <code>byte[]</code>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]&gt;"
- uid: "com.azure.core.http.HttpResponse.getBodyAsInputStream()"
fullName: "com.azure.core.http.HttpResponse.getBodyAsInputStream()"
name: "getBodyAsInputStream()"
nameWithType: "HttpResponse.getBodyAsInputStream()"
summary: "Gets the response content as an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
syntax: "public Mono<InputStream> getBodyAsInputStream()"
desc: "Gets the response content as an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
returns:
description: "The response content as an <xref uid=\"java.io.InputStream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"InputStream\"></xref>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html\">InputStream</a>&gt;"
- uid: "com.azure.core.http.HttpResponse.getBodyAsString()"
fullName: "com.azure.core.http.HttpResponse.getBodyAsString()"
name: "getBodyAsString()"
nameWithType: "HttpResponse.getBodyAsString()"
summary: "Gets the response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
modifiers:
- "abstract"
syntax: "public abstract Mono<String> getBodyAsString()"
desc: "Gets the response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>.\n\nBy default, this method will inspect the response body for containing a byte order mark (BOM) to determine the encoding of the string (UTF-8, UTF-16, etc.). If a BOM isn't found this will default to using UTF-8 as the encoding, if a specific encoding is required use <xref uid=\"com.azure.core.http.HttpResponse.getBodyAsString(java.nio.charset.Charset)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getBodyAsString(Charset)\"></xref>."
returns:
description: "The response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
- uid: "com.azure.core.http.HttpResponse.getBodyAsString(java.nio.charset.Charset)"
fullName: "com.azure.core.http.HttpResponse.getBodyAsString(Charset charset)"
name: "getBodyAsString(Charset charset)"
nameWithType: "HttpResponse.getBodyAsString(Charset charset)"
summary: "Gets the response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
modifiers:
- "abstract"
parameters:
- description: "The <xref uid=\"java.nio.charset.Charset\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Charset\"></xref> to use as the string encoding."
name: "charset"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html\">Charset</a>"
syntax: "public abstract Mono<String> getBodyAsString(Charset charset)"
desc: "Gets the response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
returns:
description: "The response content as a <xref uid=\"java.lang.String\" data-throw-if-not-resolved=\"false\" data-raw-source=\"String\"></xref>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
- uid: "com.azure.core.http.HttpResponse.getHeaderValue(com.azure.core.http.HttpHeaderName)"
fullName: "com.azure.core.http.HttpResponse.getHeaderValue(HttpHeaderName headerName)"
name: "getHeaderValue(HttpHeaderName headerName)"
nameWithType: "HttpResponse.getHeaderValue(HttpHeaderName headerName)"
summary: "Lookup a response header with the provider <xref uid=\"com.azure.core.http.HttpHeaderName\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaderName\"></xref>."
parameters:
- description: "the name of the header to lookup."
name: "headerName"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
syntax: "public String getHeaderValue(HttpHeaderName headerName)"
desc: "Lookup a response header with the provider <xref uid=\"com.azure.core.http.HttpHeaderName\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaderName\"></xref>."
returns:
description: "the value of the header, or null if the header doesn't exist in the response."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.core.http.HttpResponse.getHeaderValue(java.lang.String)"
fullName: "com.azure.core.http.HttpResponse.getHeaderValue(String name)"
name: "getHeaderValue(String name)"
nameWithType: "HttpResponse.getHeaderValue(String name)"
summary: "Lookup a response header with the provided name."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpResponse.getHeaderValue(com.azure.core.http.HttpHeaderName)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getHeaderValue(HttpHeaderName)\"></xref> as it provides better performance."
modifiers:
- "abstract"
parameters:
- description: "the name of the header to lookup."
name: "name"
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 abstract String getHeaderValue(String name)"
desc: "Lookup a response header with the provided name."
hasDeprecatedTag: true
returns:
description: "the value of the header, or null if the header doesn't exist in the response."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.core.http.HttpResponse.getHeaders()"
fullName: "com.azure.core.http.HttpResponse.getHeaders()"
name: "getHeaders()"
nameWithType: "HttpResponse.getHeaders()"
summary: "Get all response headers."
modifiers:
- "abstract"
syntax: "public abstract HttpHeaders getHeaders()"
desc: "Get all response headers."
returns:
description: "the response headers"
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.HttpResponse.getRequest()"
fullName: "com.azure.core.http.HttpResponse.getRequest()"
name: "getRequest()"
nameWithType: "HttpResponse.getRequest()"
summary: "Gets the <xref uid=\"com.azure.core.http.HttpRequest\" data-throw-if-not-resolved=\"false\" data-raw-source=\"request\"></xref> which resulted in this response."
modifiers:
- "final"
syntax: "public final HttpRequest getRequest()"
desc: "Gets the <xref uid=\"com.azure.core.http.HttpRequest\" data-throw-if-not-resolved=\"false\" data-raw-source=\"request\"></xref> which resulted in this response."
returns:
description: "The <xref uid=\"com.azure.core.http.HttpRequest\" data-throw-if-not-resolved=\"false\" data-raw-source=\"request\"></xref> which resulted in this response."
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.HttpResponse.getStatusCode()"
fullName: "com.azure.core.http.HttpResponse.getStatusCode()"
name: "getStatusCode()"
nameWithType: "HttpResponse.getStatusCode()"
summary: "Get the response status code."
modifiers:
- "abstract"
syntax: "public abstract int getStatusCode()"
desc: "Get the response status code."
returns:
description: "The response status code"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpResponse.writeBodyTo(java.nio.channels.WritableByteChannel)"
fullName: "com.azure.core.http.HttpResponse.writeBodyTo(WritableByteChannel channel)"
name: "writeBodyTo(WritableByteChannel channel)"
nameWithType: "HttpResponse.writeBodyTo(WritableByteChannel channel)"
summary: "Transfers body bytes to the <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>."
parameters:
- description: "The destination <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>."
name: "channel"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/channels/WritableByteChannel.html\">WritableByteChannel</a>"
syntax: "public void writeBodyTo(WritableByteChannel channel)"
exceptions:
- description: "When I/O operation fails."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html\">IOException</a>"
desc: "Transfers body bytes to the <xref uid=\"java.nio.channels.WritableByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"WritableByteChannel\"></xref>."
- uid: "com.azure.core.http.HttpResponse.writeBodyToAsync(java.nio.channels.AsynchronousByteChannel)"
fullName: "com.azure.core.http.HttpResponse.writeBodyToAsync(AsynchronousByteChannel channel)"
name: "writeBodyToAsync(AsynchronousByteChannel channel)"
nameWithType: "HttpResponse.writeBodyToAsync(AsynchronousByteChannel channel)"
summary: "Transfers body bytes to the <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>."
parameters:
- description: "The destination <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>."
name: "channel"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/nio/channels/AsynchronousByteChannel.html\">AsynchronousByteChannel</a>"
syntax: "public Mono<Void> writeBodyToAsync(AsynchronousByteChannel channel)"
desc: "Transfers body bytes to the <xref uid=\"java.nio.channels.AsynchronousByteChannel\" data-throw-if-not-resolved=\"false\" data-raw-source=\"AsynchronousByteChannel\"></xref>."
returns:
description: "A <xref uid=\"reactor.core.publisher.Mono\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Mono\"></xref> that completes when transfer is completed."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html\">Void</a>&gt;"
type: "class"
desc: "Represents an incoming HTTP response.\n\nThis class encapsulates an HTTP response, including the HTTP status code, headers, and body. It provides methods to get these properties.\n\nThis class is useful when you want to process an HTTP response received from a server. For example, you can use it to get the status code to check if the request was successful, get the headers to check for any additional information, and get the body to process the content of the response.\n\nNote: This class implements <xref uid=\"java.io.Closeable\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Closeable\"></xref>, so you should call the <xref uid=\"com.azure.core.http.HttpResponse.close()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#close()\"></xref> method when you're done with the HTTP response to free any resources associated with it."
implements:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html\">Closeable</a>"
metadata: {}
package: "com.azure.core.http"
artifact: com.azure:azure-core:1.52.0