Request.BeginListener, Request.CommitListener, Request.ContentListener, Request.FailureListener, Request.HeadersListener, Request.Listener, Request.QueuedListener, Request.RequestListener, Request.SuccessListener
Modifier | Constructor and Description |
---|---|
protected |
HttpRequest(HttpClient client,
HttpConversation conversation,
URI uri) |
protected HttpRequest(HttpClient client, HttpConversation conversation, URI uri)
protected HttpConversation getConversation()
public String getScheme()
public String getHost()
public int getPort()
public String getMethod()
public Request method(HttpMethod method)
public String getPath()
getPath
in interface Request
Request.getQuery()
public Request path(String path)
Request
UTF-8 URL encoded
.
For example, if the value for parameter "currency" is the euro symbol € then the
query string for this parameter must be "currency=%E2%82%AC".
For transparent encoding of parameter values, use Request.param(String, String)
.public String getQuery()
getQuery
in interface Request
Request.getPath()
,
Request.getParams()
public URI getURI()
public HttpVersion getVersion()
getVersion
in interface Request
public Request version(HttpVersion version)
public Request param(String name, String value)
Request
UTF-8 URL encoded
.public Fields getParams()
public String getAgent()
public Request header(String name, String value)
header
in interface Request
name
- the name of the headervalue
- the value of the headerRequest.header(HttpHeader, String)
public Request header(HttpHeader header, String value)
Request
Adds the given value
to the specified header
.
Multiple calls with the same parameters will add multiple values;
use the value null
to remove the header completely.
public List<HttpCookie> getCookies()
getCookies
in interface Request
public Request cookie(HttpCookie cookie)
public Map<String,Object> getAttributes()
getAttributes
in interface Request
public HttpFields getHeaders()
getHeaders
in interface Request
public <T extends Request.RequestListener> List<T> getRequestListeners(Class<T> type)
getRequestListeners
in interface Request
type
- the class of the listener, or null for all listeners classespublic Request listener(Request.Listener listener)
public Request onRequestQueued(Request.QueuedListener listener)
onRequestQueued
in interface Request
listener
- a listener for request queued eventpublic Request onRequestBegin(Request.BeginListener listener)
onRequestBegin
in interface Request
listener
- a listener for request begin eventpublic Request onRequestHeaders(Request.HeadersListener listener)
onRequestHeaders
in interface Request
listener
- a listener for request headers eventpublic Request onRequestCommit(Request.CommitListener listener)
onRequestCommit
in interface Request
listener
- a listener for request commit eventpublic Request onRequestContent(Request.ContentListener listener)
onRequestContent
in interface Request
listener
- a listener for request content eventspublic Request onRequestSuccess(Request.SuccessListener listener)
onRequestSuccess
in interface Request
listener
- a listener for request success eventpublic Request onRequestFailure(Request.FailureListener listener)
onRequestFailure
in interface Request
listener
- a listener for request failure eventpublic Request onResponseBegin(Response.BeginListener listener)
onResponseBegin
in interface Request
listener
- a listener for response begin eventpublic Request onResponseHeader(Response.HeaderListener listener)
onResponseHeader
in interface Request
listener
- a listener for response header eventpublic Request onResponseHeaders(Response.HeadersListener listener)
onResponseHeaders
in interface Request
listener
- a listener for response headers eventpublic Request onResponseContent(Response.ContentListener listener)
onResponseContent
in interface Request
listener
- a consuming listener for response content eventspublic Request onResponseContentAsync(Response.AsyncContentListener listener)
onResponseContentAsync
in interface Request
listener
- an asynchronous listener for response content eventspublic Request onResponseSuccess(Response.SuccessListener listener)
onResponseSuccess
in interface Request
listener
- a listener for response success eventpublic Request onResponseFailure(Response.FailureListener listener)
onResponseFailure
in interface Request
listener
- a listener for response failure eventpublic Request onComplete(Response.CompleteListener listener)
onComplete
in interface Request
listener
- a listener for complete eventpublic ContentProvider getContent()
getContent
in interface Request
public Request content(ContentProvider content)
public Request content(ContentProvider content, String contentType)
public Request file(Path file) throws IOException
Request
file
in interface Request
file
- the file to uploadIOException
- if the file does not exist or cannot be readpublic Request file(Path file, String contentType) throws IOException
Request
file
in interface Request
file
- the file to uploadcontentType
- the content type of the fileIOException
- if the file does not exist or cannot be readpublic boolean isFollowRedirects()
isFollowRedirects
in interface Request
public Request followRedirects(boolean follow)
followRedirects
in interface Request
follow
- whether this request follows redirectspublic long getIdleTimeout()
getIdleTimeout
in interface Request
public Request idleTimeout(long timeout, TimeUnit unit)
idleTimeout
in interface Request
timeout
- the idle timeout for this requestunit
- the idle timeout unitpublic long getTimeout()
getTimeout
in interface Request
public ContentResponse send() throws InterruptedException, TimeoutException, ExecutionException
Request
Request.send(Response.CompleteListener)
instead, passing your own Response.Listener
or a utility
listener such as InputStreamResponseListener
.
The method returns when the complete event
is fired.send
in interface Request
ContentResponse
for this requestInterruptedException
TimeoutException
ExecutionException
Response.CompleteListener.onComplete(Result)
public void send(Response.CompleteListener listener)
Request
public boolean abort(Throwable cause)
Request
public Throwable getAbortCause()
getAbortCause
in interface Request
Request.abort(Throwable)
,
or null if this request has not been abortedCopyright © 1995-2015 Webtide. All Rights Reserved.