T
- the class of the response typepublic abstract class BaseStreamRequest<T> extends java.lang.Object implements IHttpStreamRequest
Constructor and Description |
---|
BaseStreamRequest(java.lang.String requestUrl,
IBaseClient client,
java.util.List<? extends Option> options,
java.lang.Class<T> responseClass)
Creates the stream request.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(java.lang.String header,
java.lang.String value)
Adds a header to this request
|
java.util.List<HeaderOption> |
getHeaders()
Gets the headers
|
HttpMethod |
getHttpMethod()
Gets the HTTP method
|
java.util.List<Option> |
getOptions()
Gets the query options for this request
|
java.net.URL |
getRequestUrl()
Gets the request URL
|
boolean |
getUseCaches()
Gets useCaches parameter
|
protected java.io.InputStream |
send()
Sends this request
|
protected T |
send(byte[] fileContents)
Sends this request
|
protected void |
send(byte[] fileContents,
ICallback<T> callback)
Sends this request
|
protected void |
send(ICallback<java.io.InputStream> callback)
Sends this request
|
void |
setUseCaches(boolean useCaches)
Sets useCaches parameter to cache the response
|
public BaseStreamRequest(java.lang.String requestUrl, IBaseClient client, java.util.List<? extends Option> options, java.lang.Class<T> responseClass)
requestUrl
- the URL to make the request againstclient
- the client which can issue the requestoptions
- the options for this requestresponseClass
- the class for the responseprotected void send(ICallback<java.io.InputStream> callback)
callback
- the callback when this request complements. The caller needs to close the streamprotected java.io.InputStream send() throws ClientException
ClientException
- an exception occurs if there was an error while the request was sentprotected void send(byte[] fileContents, ICallback<T> callback)
fileContents
- the file to uploadcallback
- the callback when this request complements. The caller needs to close the streamprotected T send(byte[] fileContents)
fileContents
- the file to uploadpublic java.net.URL getRequestUrl()
getRequestUrl
in interface IHttpRequest
public HttpMethod getHttpMethod()
getHttpMethod
in interface IHttpRequest
public void addHeader(java.lang.String header, java.lang.String value)
addHeader
in interface IHttpRequest
header
- the name of the headervalue
- the value of the headerpublic void setUseCaches(boolean useCaches)
setUseCaches
in interface IHttpRequest
useCaches
- the value of useCachespublic boolean getUseCaches()
getUseCaches
in interface IHttpRequest
public java.util.List<HeaderOption> getHeaders()
getHeaders
in interface IHttpRequest
public java.util.List<Option> getOptions()
getOptions
in interface IHttpRequest