@Immutable @Loggable(value=1) public final class ApacheRequest extends Object implements Request
Request,
based on Apache HTTP client.
The class is immutable and thread-safe.
| Constructor and Description |
|---|
ApacheRequest(String uri)
Public ctor.
|
ApacheRequest(URI uri)
Public ctor.
|
ApacheRequest(URL url)
Public ctor.
|
| Modifier and Type | Method and Description |
|---|---|
RequestBody |
body()
Get request body.
|
Response |
fetch()
Execute it with a specified HTTP method.
|
Request |
header(String name,
Object value)
Set request header.
|
Request |
method(String method)
Use this method.
|
Request |
reset(String name)
Remove all headers with this name.
|
<T extends Wire> |
through(Class<T> type,
Object... args)
Send it through a decorating
Wire. |
RequestURI |
uri()
Get destination URI.
|
public ApacheRequest(@NotNull(message="URL can\'t be NULL") URL url)
url - The resource to work withpublic ApacheRequest(@NotNull(message="URI can\'t be NULL") URI uri)
uri - The resource to work with@NotNull public RequestURI uri()
Requestpublic Request header(@NotNull(message="header name can\'t be NULL") String name, @NotNull(message="header value can\'t be NULL") Object value)
Requestpublic Request reset(@NotNull(message="header name can\'t be NULL") String name)
Requestpublic RequestBody body()
Requestpublic Request method(@NotNull(message="method can\'t be NULL") String method)
Requestpublic Response fetch() throws IOException
Requestfetch in interface RequestIOException - If fails to fetch HTTP requestCopyright © 2012–2014 jcabi.com. All rights reserved.