HttpRequest 类

定义

public class HttpRequest
继承
java.lang.Object
HttpRequest

构造函数

HttpRequest()
HttpRequest(URL url, HttpMethod method, byte[] body)

Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent.

HttpRequest(URL url, HttpMethod method, byte[] body, Proxy proxy)

Constructor. Takes a URL as an argument and returns an HTTPS request that is ready to be sent through an optional proxy.

字段

connection

The underlying HTTPS connection stream.

方法

send()

Executes the HTTPS request.

setConnectTimeoutMillis(int timeout)

Set the connect timeout, in milliseconds, for the request. The connect timeout is the allowed amount of time for the http connection to be established.

setHeaderField(String field, String value)

Sets the header field to the given value.

setReadTimeoutMillis(int timeout)

Sets the read timeout, in milliseconds, for the request. The read timeout is the number of milliseconds after the server receives a request and before the server sends data back.

适用于