Package com.jcabi.http.request
Class BaseRequest
java.lang.Object
com.jcabi.http.request.BaseRequest
- All Implemented Interfaces:
Request
Base implementation of
Request.
// @checkstyle ClassDataAbstractionCoupling (500 lines)-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBaseRequest(Wire wre, String uri) Public ctor.BaseRequest(Wire wre, String uri, Iterable<Map.Entry<String, String>> headers, String method, byte[] body) Public ctor.BaseRequest(Wire wre, String uri, Iterable<Map.Entry<String, String>> headers, String method, byte[] body, int cnct, int rdd) 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 cnct, int rdd) Use this timeout values.toString()uri()Get destination URI.
-
Constructor Details
-
BaseRequest
Public ctor.- Parameters:
wre- Wireuri- The resource to work with
-
BaseRequest
public BaseRequest(Wire wre, String uri, Iterable<Map.Entry<String, String>> headers, String method, byte[] body) Public ctor.- Parameters:
wre- Wireuri- The resource to work withheaders- Headersmethod- HTTP methodbody- HTTP request body
-
BaseRequest
public BaseRequest(Wire wre, String uri, Iterable<Map.Entry<String, String>> headers, String method, byte[] body, int cnct, int rdd) Public ctor.- Parameters:
wre- Wireuri- The resource to work withheaders- Headersmethod- HTTP methodbody- HTTP request bodycnct- Connect timeout for http connectionrdd- Read timeout for http connection
-
-
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. -
toString
-