Package com.jcabi.http
Interface Wire
- All Known Implementing Classes:
AbstractHeaderBasedCachingWire,AutoRedirectingWire,BasicAuthWire,CachingWire,CookieOptimizingWire,ETagCachingWire,FcWire,LastModifiedCachingWire,OneMinuteWire,RetryWire,TrustedWire,UserAgentWire,VerboseWire
@Immutable
public interface Wire
Wire.
An instance of this interface can be used in
Request.through(Class,Object...) to decorate
an existing wire, for example:
String html = new JdkRequest("http://google.com")
.through(VerboseWire.class)
.through(RetryWire.class)
.header("Accept", "text/html")
.fetch()
.body();
Every Wire decorator passed to through() method
wraps a previously existing one.
- Since:
- 0.9
-
Method Summary
Modifier and TypeMethodDescriptionsend(Request req, String home, String method, Collection<Map.Entry<String, String>> headers, InputStream content, int connect, int read) Send request and return response.
-
Method Details
-
send
Response send(Request req, String home, String method, Collection<Map.Entry<String, String>> headers, InputStream content, int connect, int read) throws IOExceptionSend request and return response.- Parameters:
req- Requesthome- URI to fetchmethod- HTTP methodheaders- Headerscontent- HTTP bodyconnect- The connect timeoutread- The read timeout- Returns:
- Response obtained
- Throws:
IOException- if fails
-