java.lang.Object
org.codelibs.curl.Curl
The Curl class provides a simple interface for creating HTTP requests using various HTTP methods.
It includes static methods for each HTTP method that return a CurlRequest object.
Example usage:
CurlRequest request = Curl.get("http://example.com");
Supported HTTP methods:
- GET
- POST
- PUT
- DELETE
- HEAD
- OPTIONS
- CONNECT
The Curl class also defines an enum Curl.Method which lists all supported HTTP methods.
The temporary directory used by Curl is defined by the tmpDir field, which is initialized
to the system's temporary directory.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CurlRequestCreates a new CurlRequest with the CONNECT method for the specified URL.static CurlRequestCreates a new CurlRequest with the DELETE method for the specified URL.static CurlRequestCreates a new CurlRequest with the HTTP GET method for the specified URL.static CurlRequestCreates a new CurlRequest with the HTTP HEAD method for the specified URL.static CurlRequestCreates a new CurlRequest with the HTTP OPTIONS method for the specified URL.static CurlRequestCreates a new CurlRequest with the HTTP POST method for the specified URL.static CurlRequestCreates a new CurlRequest with the HTTP PUT method for the specified URL.
-
Field Details
-
tmpDir
-
-
Constructor Details
-
Curl
protected Curl()
-
-
Method Details
-
get
Creates a new CurlRequest with the HTTP GET method for the specified URL.- Parameters:
url- the URL to send the GET request to- Returns:
- a CurlRequest object configured with the GET method and the specified URL
-
post
Creates a new CurlRequest with the HTTP POST method for the specified URL.- Parameters:
url- the URL to which the POST request will be sent- Returns:
- a new CurlRequest object configured with the POST method and the specified URL
-
put
Creates a new CurlRequest with the HTTP PUT method for the specified URL.- Parameters:
url- the URL to which the PUT request will be sent- Returns:
- a new CurlRequest object configured with the PUT method and the specified URL
-
delete
Creates a new CurlRequest with the DELETE method for the specified URL.- Parameters:
url- the URL to which the DELETE request will be sent- Returns:
- a CurlRequest object configured with the DELETE method and the specified URL
-
head
Creates a new CurlRequest with the HTTP HEAD method for the specified URL.- Parameters:
url- the URL to which the HEAD request is to be made- Returns:
- a CurlRequest object configured with the HEAD method and the specified URL
-
options
Creates a new CurlRequest with the HTTP OPTIONS method for the specified URL.- Parameters:
url- the URL to which the OPTIONS request is sent- Returns:
- a new CurlRequest object configured with the OPTIONS method and the specified URL
-
connect
Creates a new CurlRequest with the CONNECT method for the specified URL.- Parameters:
url- the URL to connect to- Returns:
- a new CurlRequest object with the CONNECT method
-