azure-docs-sdk-java/docs-ref-autogen/com.microsoft.azure.sdk.iot...

239 строки
16 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection"
name: "HttpConnection"
nameWithType: "HttpConnection"
summary: "A wrapper for the Java SE class Https<wbr>URLConnection."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "<xref href=\"java.lang.Object?alt=java.lang.Object&text=Object\" data-throw-if-not-resolved=\"False\" />"
methodsRef:
- "<xref href=\"java.lang.Object.clone()?alt=java.lang.Object.clone&text=clone\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.equals(java.lang.Object)?alt=java.lang.Object.equals&text=equals\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.finalize()?alt=java.lang.Object.finalize&text=finalize\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.getClass()?alt=java.lang.Object.getClass&text=getClass\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.hashCode()?alt=java.lang.Object.hashCode&text=hashCode\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notify()?alt=java.lang.Object.notify&text=notify\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notifyAll()?alt=java.lang.Object.notifyAll&text=notifyAll\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.toString()?alt=java.lang.Object.toString&text=toString\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait()?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long,int)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
syntax: "public class **HttpConnection**"
constructors:
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection()"
name: "HttpConnection()"
nameWithType: "HttpConnection.HttpConnection()"
modifiers:
- "protected"
syntax: "protected HttpConnection()"
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection(java.net.URL,com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection(URL url, HttpMethod method)"
name: "HttpConnection(URL url, HttpMethod method)"
nameWithType: "HttpConnection.HttpConnection(URL url, HttpMethod method)"
summary: "Constructor."
parameters:
- description: "The URL for the HTTPS connection."
name: "url"
type: "<xref href=\"java.net.URL?alt=java.net.URL&text=URL\" data-throw-if-not-resolved=\"False\" />"
- description: "The HTTPS method (i.e. GET)."
name: "method"
type: "<xref href=\"com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod?alt=com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpConnection(URL url, HttpMethod method)"
exceptions:
- description: "This exception is thrown if the connection was unable to be opened."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Constructor. Opens a connection to the given URL."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection(java.net.URL,com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod,java.net.Proxy)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.HttpConnection(URL url, HttpMethod method, Proxy proxy)"
name: "HttpConnection(URL url, HttpMethod method, Proxy proxy)"
nameWithType: "HttpConnection.HttpConnection(URL url, HttpMethod method, Proxy proxy)"
summary: "Constructor."
parameters:
- description: "The URL for the HTTPS connection."
name: "url"
type: "<xref href=\"java.net.URL?alt=java.net.URL&text=URL\" data-throw-if-not-resolved=\"False\" />"
- description: "The HTTPS method (i.e. GET)."
name: "method"
type: "<xref href=\"com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod?alt=com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
- description: "The proxy to send the connection through"
name: "proxy"
type: "<xref href=\"java.net.Proxy?alt=java.net.Proxy&text=Proxy\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpConnection(URL url, HttpMethod method, Proxy proxy)"
exceptions:
- description: "This exception is thrown if the connection was unable to be opened."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Constructor. Opens a connection to the given URL."
fields:
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.body"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.body"
name: "body"
nameWithType: "HttpConnection.body"
summary: "The body."
modifiers:
- "protected"
field:
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "protected byte[] body"
desc: "The body. HttpsURLConnection silently calls connect() when the output stream is written to. We buffer the body and defer writing to the output stream until connect() is called."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.connection"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.connection"
name: "connection"
nameWithType: "HttpConnection.connection"
summary: "The underlying HTTPS connection."
modifiers:
- "protected"
- "final"
field:
type: "<xref href=\"javax.net.ssl.HttpsURLConnection?alt=javax.net.ssl.HttpsURLConnection&text=HttpsURLConnection\" data-throw-if-not-resolved=\"False\" />"
syntax: "protected final HttpsURLConnection connection"
desc: "The underlying HTTPS connection."
methods:
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.connect()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.connect()"
name: "connect()"
nameWithType: "HttpConnection.connect()"
summary: "Sends the request to the URL given in the constructor."
syntax: "public void connect()"
exceptions:
- description: "This exception thrown if the connection could not be established,\n or the server responded with a bad status code."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Sends the request to the URL given in the constructor."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.getResponseHeaders()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.getResponseHeaders()"
name: "getResponseHeaders()"
nameWithType: "HttpConnection.getResponseHeaders()"
summary: "Returns the response headers as a Map, where the key is the header field name and the values are the values associated with the header field name."
syntax: "public Map<String,List<String>> getResponseHeaders()"
exceptions:
- description: "This exception thrown if no response was received."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Returns the response headers as a Map, where the key is the header field name and the values are the values associated with the header field name."
returns:
description: "the response headers."
type: "<xref href=\"java.util.Map?alt=java.util.Map&text=Map\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />,<xref href=\"java.util.List?alt=java.util.List&text=List\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.getResponseStatus()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.getResponseStatus()"
name: "getResponseStatus()"
nameWithType: "HttpConnection.getResponseStatus()"
summary: "Returns the response status code."
syntax: "public int getResponseStatus()"
exceptions:
- description: "This exception thrown if no response was received."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Returns 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.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readError()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readError()"
name: "readError()"
nameWithType: "HttpConnection.readError()"
summary: "Reads from the error stream and returns the error reason."
syntax: "public byte[] readError()"
exceptions:
- description: "This exception thrown if the input stream could not be\n accessed, for example if the server could not be reached."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Reads from the error stream and returns the error reason."
returns:
description: "The error reason."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readInput()"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readInput()"
name: "readInput()"
nameWithType: "HttpConnection.readInput()"
summary: "Reads from the input stream (response stream) and returns the response."
syntax: "public byte[] readInput()"
exceptions:
- description: "This exception thrown if the input stream could not be\n accessed, for example if the server could not be reached."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Reads from the input stream (response stream) and returns the response."
returns:
description: "The response body."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readInputStream(java.io.InputStream)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.readInputStream(InputStream stream)"
name: "readInputStream(InputStream stream)"
nameWithType: "HttpConnection.readInputStream(InputStream stream)"
summary: "Reads the input stream until the stream is empty."
modifiers:
- "protected"
- "static"
parameters:
- description: "The input stream."
name: "stream"
type: "<xref href=\"java.io.InputStream?alt=java.io.InputStream&text=InputStream\" data-throw-if-not-resolved=\"False\" />"
syntax: "protected static byte[] readInputStream(InputStream stream)"
exceptions:
- description: "This exception thrown if the input stream could not be read from."
type: "<xref href=\"java.io.IOException?alt=java.io.IOException&text=IOException\" data-throw-if-not-resolved=\"False\" />"
desc: "Reads the input stream until the stream is empty."
returns:
description: "The content of the input stream."
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setConnectTimeoutMillis(int)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setConnectTimeoutMillis(int timeout)"
name: "setConnectTimeoutMillis(int timeout)"
nameWithType: "HttpConnection.setConnectTimeoutMillis(int timeout)"
summary: "Sets the connect timeout in milliseconds."
parameters:
- description: "The connect timeout."
name: "timeout"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setConnectTimeoutMillis(int timeout)"
desc: "Sets the connect timeout in milliseconds. The connect timeout is the allowed amount of time for the http connection to be established."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setReadTimeoutMillis(int)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setReadTimeoutMillis(int timeout)"
name: "setReadTimeoutMillis(int timeout)"
nameWithType: "HttpConnection.setReadTimeoutMillis(int timeout)"
summary: "Sets the read timeout in milliseconds."
parameters:
- description: "The read timeout."
name: "timeout"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setReadTimeoutMillis(int timeout)"
desc: "Sets the read timeout in milliseconds. The read timeout is the number of milliseconds after the server receives a request and before the server sends data back."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setRequestHeader(java.lang.String,java.lang.String)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setRequestHeader(String field, String value)"
name: "setRequestHeader(String field, String value)"
nameWithType: "HttpConnection.setRequestHeader(String field, String value)"
summary: "Sets the request header field to the given value."
parameters:
- description: "The header field name."
name: "field"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
- description: "The header field value."
name: "value"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setRequestHeader(String field, String value)"
desc: "Sets the request header field to the given value."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setRequestMethod(com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod)"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.setRequestMethod(HttpMethod method)"
name: "setRequestMethod(HttpMethod method)"
nameWithType: "HttpConnection.setRequestMethod(HttpMethod method)"
summary: "Sets the request method (i.<wbr>e."
parameters:
- description: "The request method."
name: "method"
type: "<xref href=\"com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod?alt=com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod&text=HttpMethod\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setRequestMethod(HttpMethod method)"
desc: "Sets the request method (i.e. POST)."
- uid: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.writeOutput(byte[])"
fullName: "com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection.writeOutput(byte[] body)"
name: "writeOutput(byte[] body)"
nameWithType: "HttpConnection.writeOutput(byte[] body)"
summary: "Saves the body to be sent with the request."
parameters:
- description: "The request body."
name: "body"
type: "<xref href=\"byte?alt=byte&text=byte\" data-throw-if-not-resolved=\"False\" />[]"
syntax: "public void writeOutput(byte[] body)"
desc: "Saves the body to be sent with the request."
type: "class"
desc: "A wrapper for the Java SE class HttpsURLConnection. Used to avoid compatibility issues when testing with the mocking framework JMockit, as well as to avoid some undocumented side effects when using HttpsURLConnection.\n\nThe underlying HttpsURLConnection is transparently managed by Java. To reuse connections, for each time connect() is called, the input streams (input stream or error stream, if input stream is not accessible) must be completely read. Otherwise, the data remains in the stream and the connection will not be reusable."
metadata: {}
package: "com.microsoft.azure.sdk.iot.service.transport.http"
artifact: com.microsoft.azure.sdk.iot:iot-service-client:1.30.0