|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.util.concurrent.Task<V>
org.apache.pivot.io.IOTask<V>
org.apache.pivot.web.Query<V>
V
- The type of the value retrieved or sent via the query. For GET operations,
it is Object
; for POST operations, the type is URL
. For PUT
and DELETE, it is Void
.public abstract class Query<V>
Abstract base class for web queries. A web query is an asynchronous operation that executes one of the following HTTP methods:
Nested Class Summary | |
---|---|
static class |
Query.Method
Supported HTTP methods. |
static class |
Query.Status
Query status codes. |
Nested classes/interfaces inherited from class org.apache.pivot.io.IOTask |
---|
IOTask.MonitoredInputStream, IOTask.MonitoredOutputStream |
Field Summary | |
---|---|
static int |
DEFAULT_PORT
|
Fields inherited from class org.apache.pivot.io.IOTask |
---|
bytesReceived, bytesSent |
Fields inherited from class org.apache.pivot.util.concurrent.Task |
---|
abort, DEFAULT_EXECUTOR_SERVICE, timeout |
Constructor Summary | |
---|---|
Query(String hostname,
int port,
String path,
boolean secure,
ExecutorService executorService)
Creates a new web query. |
Method Summary | |
---|---|
protected Object |
execute(Query.Method method,
Object value)
|
long |
getBytesExpected()
Gets the number of bytes that are expected to be received from the server in the body of the server's HTTP response. |
long |
getBytesReceived()
Gets the number of bytes that have been received from the server in the body of the server's HTTP response. |
long |
getBytesSent()
Gets the number of bytes that have been sent in the body of this query's HTTP request. |
String |
getHostname()
|
HostnameVerifier |
getHostnameVerifier()
|
URL |
getLocation()
|
abstract Query.Method |
getMethod()
|
QueryDictionary |
getParameters()
Returns the web query's parameter dictionary. |
String |
getPath()
|
int |
getPort()
|
Proxy |
getProxy()
Gets the proxy associated with this query. |
ListenerList<QueryListener<V>> |
getQueryListeners()
Returns the query listener list. |
QueryDictionary |
getRequestHeaders()
Returns the web query's request header dictionary. |
QueryDictionary |
getResponseHeaders()
Returns the web query's response header dictionary. |
Serializer<?> |
getSerializer()
Returns the serializer used to stream the value passed to or from the web query. |
int |
getStatus()
Returns the status of the most recent execution. |
boolean |
isSecure()
|
void |
setHostnameVerifier(HostnameVerifier hostnameVerifier)
|
void |
setProxy(Proxy proxy)
Sets the proxy associated with this query. |
void |
setSerializer(Serializer<?> serializer)
Sets the serializer used to stream the value passed to or from the web query. |
Methods inherited from class org.apache.pivot.util.concurrent.Task |
---|
abort, execute, execute, execute, getExecutorService, getFault, getResult, getTimeout, isPending, setTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PORT
Constructor Detail |
---|
public Query(String hostname, int port, String path, boolean secure, ExecutorService executorService)
hostname
- port
- path
- secure
- Method Detail |
---|
public abstract Query.Method getMethod()
public String getHostname()
public String getPath()
public int getPort()
public boolean isSecure()
public HostnameVerifier getHostnameVerifier()
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
public Proxy getProxy()
public void setProxy(Proxy proxy)
proxy
- This query's proxy, or null to use the default JVM proxy
settingspublic URL getLocation()
public QueryDictionary getParameters()
public QueryDictionary getRequestHeaders()
public QueryDictionary getResponseHeaders()
public int getStatus()
public Serializer<?> getSerializer()
JSONSerializer
is used.
public void setSerializer(Serializer<?> serializer)
serializer
- The serializer (must be non-null).public long getBytesSent()
For POST and PUT requests, this number will increment in between the
connected
and
requestSent
phases of the
QueryListener lifecycle methods. Interested listeners can poll
for this value during that phase.
public long getBytesReceived()
This number will increment in between the
requestSent
and
responseReceived
phases of
the QueryListener lifecycle methods. Interested listeners can
poll for this value during that phase.
public long getBytesExpected()
If the server did not specify a Content-Length HTTP response header, a value of -1 will be returned to indicate that this value is unknown.
protected Object execute(Query.Method method, Object value) throws QueryException
QueryException
public ListenerList<QueryListener<V>> getQueryListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |