Class HttpRequest
java.lang.Object
com.sk89q.worldedit.util.net.HttpRequest
- All Implemented Interfaces:
Closeable, AutoCloseable
Deprecated, for removal: This API element is subject to removal in a future version.
Use the native JDK HttpClient API instead.
A class for making HTTP requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassDeprecated, for removal: This API element is subject to removal in a future version.Used to buffer the response in memory.static final classDeprecated, for removal: This API element is subject to removal in a future version.Used withbodyUrlEncodedForm(Form). -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Submit data.Deprecated, for removal: This API element is subject to removal in a future version.Submit form data.Deprecated, for removal: This API element is subject to removal in a future version.Submit form data.voidclose()Deprecated, for removal: This API element is subject to removal in a future version.execute()Deprecated, for removal: This API element is subject to removal in a future version.Execute the request.expectResponseCode(int... codes) Deprecated, for removal: This API element is subject to removal in a future version.Require that the response code is one of the given response codes.static HttpRequestDeprecated, for removal: This API element is subject to removal in a future version.Perform a GET request.Deprecated, for removal: This API element is subject to removal in a future version.Get the input stream.intDeprecated, for removal: This API element is subject to removal in a future version.Get the response code.Deprecated, for removal: This API element is subject to removal in a future version.Add a header.static HttpRequestDeprecated, for removal: This API element is subject to removal in a future version.Perform a POST request.static HttpRequestDeprecated, for removal: This API element is subject to removal in a future version.Perform a request.Deprecated, for removal: This API element is subject to removal in a future version.Buffer the returned response.saveContent(File file) Deprecated, for removal: This API element is subject to removal in a future version.Save the result to a file.saveContent(OutputStream out) Deprecated, for removal: This API element is subject to removal in a future version.Save the result to an output stream.static URLDeprecated, for removal: This API element is subject to removal in a future version.Create a newURLand throw aRuntimeExceptionif the URL is not valid.
-
Method Details
-
body
Deprecated, for removal: This API element is subject to removal in a future version.Submit data.- Returns:
- this object
-
bodyUrlEncodedForm
Deprecated, for removal: This API element is subject to removal in a future version.Submit form data.- Parameters:
form- the form- Returns:
- this object
-
bodyMultipartForm
Deprecated, for removal: This API element is subject to removal in a future version.Submit form data.- Parameters:
form- the form- Returns:
- this object
-
header
Deprecated, for removal: This API element is subject to removal in a future version.Add a header.- Parameters:
key- the header keyvalue- the header value- Returns:
- this object
-
execute
Deprecated, for removal: This API element is subject to removal in a future version.Execute the request.After execution,
close()should be called.- Returns:
- this object
- Throws:
IOException- on I/O error
-
expectResponseCode
Deprecated, for removal: This API element is subject to removal in a future version.Require that the response code is one of the given response codes.- Parameters:
codes- a list of codes- Returns:
- this object
- Throws:
IOException- if there is an I/O error or the response code is not expected
-
getResponseCode
Deprecated, for removal: This API element is subject to removal in a future version.Get the response code.- Returns:
- the response code
- Throws:
IOException- on I/O error
-
getInputStream
Deprecated, for removal: This API element is subject to removal in a future version.Get the input stream.- Returns:
- the input stream
-
returnContent
Deprecated, for removal: This API element is subject to removal in a future version.Buffer the returned response.- Returns:
- the buffered response
- Throws:
IOException- on I/O errorInterruptedException- on interruption
-
saveContent
Deprecated, for removal: This API element is subject to removal in a future version.Save the result to a file.- Parameters:
file- the file- Returns:
- this object
- Throws:
IOException- on I/O errorInterruptedException- on interruption
-
saveContent
Deprecated, for removal: This API element is subject to removal in a future version.Save the result to an output stream.- Parameters:
out- the output stream- Returns:
- this object
- Throws:
IOException- on I/O errorInterruptedException- on interruption
-
close
public void close()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
get
Deprecated, for removal: This API element is subject to removal in a future version.Perform a GET request.- Parameters:
url- the URL- Returns:
- a new request object
-
post
Deprecated, for removal: This API element is subject to removal in a future version.Perform a POST request.- Parameters:
url- the URL- Returns:
- a new request object
-
request
Deprecated, for removal: This API element is subject to removal in a future version.Perform a request.- Parameters:
method- the methodurl- the URL- Returns:
- a new request object
-
url
Deprecated, for removal: This API element is subject to removal in a future version.Create a newURLand throw aRuntimeExceptionif the URL is not valid.- Parameters:
url- the url- Returns:
- a URL object
- Throws:
RuntimeException- if the URL is invalid
-