| 程序包 | 说明 |
|---|---|
| cn.ponfee.commons.http |
| 限定符和类型 | 方法和说明 |
|---|---|
HttpRequest |
HttpRequest.accept(String accept)
Set the 'Accept' header to given value
|
HttpRequest |
HttpRequest.acceptCharset(String acceptCharset)
Set the 'Accept-Charset' header to given value
|
HttpRequest |
HttpRequest.acceptEncoding(String acceptEncoding)
Set the 'Accept-Encoding' header to given value
|
HttpRequest |
HttpRequest.acceptGzipEncoding()
Set the 'Accept-Encoding' header to 'gzip'
|
HttpRequest |
HttpRequest.acceptJson()
Set the 'Accept' header to 'application/json'
|
HttpRequest |
HttpRequest.authorization(String authorization)
Set the 'Authorization' header to given value
|
HttpRequest |
HttpRequest.basic(String name,
String password)
Set the 'Authorization' header to given values in Basic authentication
format
|
HttpRequest |
HttpRequest.body(AtomicReference<String> output)
Get the response body as a
String and set it as the value of the
given reference. |
HttpRequest |
HttpRequest.body(AtomicReference<String> output,
String charset)
Get the response body as a
String and set it as the value of the
given reference. |
HttpRequest |
HttpRequest.bufferSize(int size)
Set the size used when buffering and copying between streams
This size is also used for send and receive buffers created for both char
and byte arrays
The default buffer size is 8,192 bytes
|
HttpRequest |
HttpRequest.chunk(int size)
Set chunked streaming mode to the given size
|
protected HttpRequest |
HttpRequest.closeOutput()
Close output stream
|
protected HttpRequest |
HttpRequest.closeOutputQuietly()
|
HttpRequest |
HttpRequest.code(AtomicInteger output)
Set the value of the given
AtomicInteger to the status code of the
response |
HttpRequest |
HttpRequest.connectTimeout(int timeout)
Set connect timeout on connection to given value
|
HttpRequest |
HttpRequest.contentLength(int contentLength)
Set the 'Content-Length' request header to the given value
|
HttpRequest |
HttpRequest.contentLength(String contentLength)
Set the 'Content-Length' request header to the given value
|
HttpRequest |
HttpRequest.contentType(String contentType)
Set the 'Content-Type' request header to the given value
|
HttpRequest |
HttpRequest.contentType(String contentType,
String charset)
Set the 'Content-Type' request header to the given value and charset
|
protected HttpRequest |
HttpRequest.copy(InputStream input,
OutputStream output)
Copy from input stream to output stream
|
protected HttpRequest |
HttpRequest.copy(Reader input,
Writer output)
Copy from reader to writer
|
HttpRequest |
HttpRequest.decompress(boolean decompress)
Set whether or not the response body should be automatically decompress
when read from.
|
static HttpRequest |
HttpRequest.delete(CharSequence url)
Start a 'DELETE' request to the given URL
|
static HttpRequest |
HttpRequest.delete(CharSequence baseUrl,
boolean encode,
Object... params)
Start a 'DELETE' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.delete(CharSequence baseUrl,
Map<?,?> params,
boolean encode)
Start a 'DELETE' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.delete(URL url)
Start a 'DELETE' request to the given URL
|
HttpRequest |
HttpRequest.disconnect()
Disconnect the connection
|
HttpRequest |
HttpRequest.followRedirects(boolean followRedirects)
Set whether or not the underlying connection should follow redirects in
the response.
|
HttpRequest |
HttpRequest.form(Map.Entry<?,?> entry)
Write the key and value in the entry as form data to the request body
The pair specified will be URL-encoded in UTF-8 and sent with the
'application/x-www-form-urlencoded' content-type
|
HttpRequest |
HttpRequest.form(Map.Entry<?,?> entry,
String charset)
Write the key and value in the entry as form data to the request body
The pair specified will be URL-encoded and sent with the
'application/x-www-form-urlencoded' content-type
|
HttpRequest |
HttpRequest.form(Map<?,?> values)
Write the values in the map as form data to the request body
The pairs specified will be URL-encoded in UTF-8 and sent with the
'application/x-www-form-urlencoded' content-type
|
HttpRequest |
HttpRequest.form(Map<?,?> values,
String charset)
Write the values in the map as encoded form data to the request body
|
HttpRequest |
HttpRequest.form(Object name,
Object value)
Write the name/value pair as form data to the request body
The pair specified will be URL-encoded in UTF-8 and sent with the
'application/x-www-form-urlencoded' content-type
|
HttpRequest |
HttpRequest.form(Object name,
Object value,
String charset)
Write the name/value pair as form data to the request body
The values specified will be URL-encoded and sent with the
'application/x-www-form-urlencoded' content-type
|
static HttpRequest |
HttpRequest.get(CharSequence url)
Start a 'GET' request to the given URL
|
static HttpRequest |
HttpRequest.get(CharSequence baseUrl,
boolean encode,
Object... params)
Start a 'GET' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.get(CharSequence baseUrl,
Map<?,?> params,
boolean encode)
Start a 'GET' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.get(URL url)
Start a 'GET' request to the given URL
|
static HttpRequest |
HttpRequest.head(CharSequence url)
Start a 'HEAD' request to the given URL
|
static HttpRequest |
HttpRequest.head(CharSequence baseUrl,
boolean encode,
Object... params)
Start a 'GET' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.head(CharSequence baseUrl,
Map<?,?> params,
boolean encode)
Start a 'HEAD' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.head(URL url)
Start a 'HEAD' request to the given URL
|
HttpRequest |
HttpRequest.header(Map.Entry<String,String> header)
Set header to have given entry's key as the name and value as the value
|
HttpRequest |
HttpRequest.header(String name,
Number value)
Set header name to given value
|
HttpRequest |
HttpRequest.header(String name,
String value)
Set header name to given value
|
HttpRequest |
HttpRequest.headers(Map<String,String> headers)
Set all headers found in given map where the keys are the header names and
the values are the header values
|
HttpRequest |
HttpRequest.ifModifiedSince(long ifModifiedSince)
Set the 'If-Modified-Since' request header to the given value
|
HttpRequest |
HttpRequest.ifNoneMatch(String ifNoneMatch)
Set the 'If-None-Match' request header to the given value
|
HttpRequest |
HttpRequest.ignoreCloseExceptions(boolean ignore)
Set whether or not to ignore exceptions that occur from calling
Closeable.close()
The default value of this setting is true |
protected HttpRequest |
HttpRequest.openOutput()
Open output stream
|
static HttpRequest |
HttpRequest.options(CharSequence url)
Start an 'OPTIONS' request to the given URL
|
static HttpRequest |
HttpRequest.options(URL url)
Start an 'OPTIONS' request to the given URL
|
HttpRequest |
HttpRequest.part(String name,
File part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
InputStream part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
Number part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
File part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
Number part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
String part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
String contentType,
File part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
String contentType,
InputStream part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.part(String name,
String filename,
String contentType,
String part)
Write part of a multipart request to the request body
|
HttpRequest |
HttpRequest.partHeader(String name,
String value)
Write a multipart header to the response body
|
static HttpRequest |
HttpRequest.post(CharSequence url)
Start a 'POST' request to the given URL
|
static HttpRequest |
HttpRequest.post(CharSequence baseUrl,
boolean encode,
Object... params)
Start a 'POST' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.post(CharSequence baseUrl,
Map<?,?> params,
boolean encode)
Start a 'POST' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.post(URL url)
Start a 'POST' request to the given URL
|
HttpRequest |
HttpRequest.progress(HttpRequest.UploadProgress callback)
Set the UploadProgress callback for this request
|
HttpRequest |
HttpRequest.proxyAuthorization(String proxyAuthorization)
Set the 'Proxy-Authorization' header to given value
|
HttpRequest |
HttpRequest.proxyBasic(String name,
String password)
Set the 'Proxy-Authorization' header to given values in Basic authentication
format
|
static HttpRequest |
HttpRequest.put(CharSequence url)
Start a 'PUT' request to the given URL
|
static HttpRequest |
HttpRequest.put(CharSequence baseUrl,
boolean encode,
Object... params)
Start a 'PUT' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.put(CharSequence baseUrl,
Map<?,?> params,
boolean encode)
Start a 'PUT' request to the given URL along with the query params
|
static HttpRequest |
HttpRequest.put(URL url)
Start a 'PUT' request to the given URL
|
HttpRequest |
HttpRequest.readTimeout(int timeout)
Set read timeout on connection to given value
|
HttpRequest |
HttpRequest.receive(Appendable appendable)
Receive response into the given appendable
|
HttpRequest |
HttpRequest.receive(File file)
Stream response body to file
|
HttpRequest |
HttpRequest.receive(OutputStream output)
Stream response to given output stream
|
HttpRequest |
HttpRequest.receive(PrintStream output)
Stream response to given print stream
|
HttpRequest |
HttpRequest.receive(Writer writer)
Receive response into the given writer
|
HttpRequest |
HttpRequest.referer(String referer)
Set the 'Referer' header to given value
|
HttpRequest |
HttpRequest.send(byte[] input)
Write byte array to request body
|
HttpRequest |
HttpRequest.send(CharSequence value)
Write char sequence to request body
The charset configured via
contentType(String) will be used and
UTF-8 will be used if it is unset. |
HttpRequest |
HttpRequest.send(File input)
Write contents of file to request body
|
HttpRequest |
HttpRequest.send(InputStream input)
Write stream to request body
The given stream will be closed once sending completes
|
HttpRequest |
HttpRequest.send(Reader input)
Write reader to request body
The given reader will be closed once sending completes
|
HttpRequest |
HttpRequest.setSSLSocketFactory(SSLSocketFactory factory)
设置SSLSocketFactory
|
protected HttpRequest |
HttpRequest.startPart()
Start part of a multipart
|
static HttpRequest |
HttpRequest.trace(CharSequence url)
Start a 'TRACE' request to the given URL
|
static HttpRequest |
HttpRequest.trace(URL url)
Start a 'TRACE' request to the given URL
|
HttpRequest |
HttpRequest.trustAllCerts()
Configure HTTPS connection to trust all certificates
This method does nothing if the current request is not a HTTPS request
|
HttpRequest |
HttpRequest.trustAllHosts()
Configure HTTPS connection to trust all hosts using a custom
HostnameVerifier that always returns true for each
host verified
This method does nothing if the current request is not a HTTPS request |
HttpRequest |
HttpRequest.useCaches(boolean useCaches)
Set value of
URLConnection.setUseCaches(boolean) |
HttpRequest |
HttpRequest.useProxy(String proxyHost,
int proxyPort)
Configure an HTTP proxy on this connection.
|
HttpRequest |
HttpRequest.userAgent(String userAgent)
Set the 'User-Agent' header to given value
|
protected HttpRequest |
HttpRequest.writePartHeader(String name,
String filename)
Write part header
|
protected HttpRequest |
HttpRequest.writePartHeader(String name,
String filename,
String contentType)
Write part header
|
Copyright © 2023. All rights reserved.