Package com.jcabi.http.request
Class ApacheRequest
java.lang.Object
com.jcabi.http.request.ApacheRequest
- All Implemented Interfaces:
Request
Implementation of
Request,
based on Apache HTTP client.
The class is immutable and thread-safe.
- Since:
- 0.8
- To do:
- #200:30m TrustedWire does not support ApacheRequest. Investigate if it's possible for them to work together, if not see jcabi-http#178 for discussion about alternative solutions.
- Suppressed Checkstyle violations:
- ClassDataAbstractionCoupling (500 lines)
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionApacheRequest(String uri) Public ctor.ApacheRequest(URI uri) Public ctor.ApacheRequest(URL url) Public ctor. -
Method Summary
Modifier and TypeMethodDescriptionbody()Get request body.fetch()Execute it with a specified HTTP method.fetch(InputStream stream) Execute this request using the content provided by theInputStreambeing passed as the request body.Set request header.Use this method.Get multipart form (multipart/form-data) body.Remove all headers with this name.Send it through a decoratingWire.Send it through a decoratingWire.timeout(int connect, int read) Use this timeout values.uri()Get destination URI.
-
Constructor Details
-
ApacheRequest
Public ctor.- Parameters:
url- The resource to work with
-
ApacheRequest
Public ctor.- Parameters:
uri- The resource to work with
-
ApacheRequest
Public ctor.- Parameters:
uri- The resource to work with
-
-
Method Details
-
uri
Description copied from interface:RequestGet destination URI. -
header
Description copied from interface:RequestSet request header. -
reset
Description copied from interface:RequestRemove all headers with this name. -
body
Description copied from interface:RequestGet request body. -
multipartBody
Description copied from interface:RequestGet multipart form (multipart/form-data) body.- Specified by:
multipartBodyin interfaceRequest- Returns:
- New altered request
-
method
Description copied from interface:RequestUse this method. -
timeout
Description copied from interface:RequestUse this timeout values. -
fetch
Description copied from interface:RequestExecute it with a specified HTTP method.- Specified by:
fetchin interfaceRequest- Returns:
- Response
- Throws:
IOException- If fails to fetch HTTP request
-
fetch
Description copied from interface:RequestExecute this request using the content provided by theInputStreambeing passed as the request body. Note that the request MUST have an empty body when this method is being invoked, or it will throw anIllegalStateException.- Specified by:
fetchin interfaceRequest- Parameters:
stream- The input stream to use- Returns:
- Response
- Throws:
IOException- If fails to fetch HTTP request
-
through
Description copied from interface:RequestSend it through a decoratingWire. -
through
Description copied from interface:RequestSend it through a decoratingWire.
-