|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.client.Restlet
org.restlet.client.Connector
org.restlet.client.Client
public class Client
Connector acting as a generic client. It internally uses one of the available
connector helpers registered with the Restlet engine.
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.
Constructor Summary | |
---|---|
Client(Context context,
java.util.List<Protocol> protocols)
Constructor. |
|
Client(Context context,
java.util.List<Protocol> protocols,
java.lang.String helperClass)
Constructor. |
|
Client(Context context,
Protocol protocol)
Constructor. |
|
Client(java.util.List<Protocol> protocols)
Constructor. |
|
Client(Protocol protocol)
Constructor. |
|
Client(java.lang.String protocolName)
Constructor. |
Method Summary | |
---|---|
int |
getConnectTimeout()
Returns the connection timeout in milliseconds. |
void |
handle(Request request,
Response response)
Handles a call. |
void |
handle(Request request,
Response response,
Uniform onResponseCallback)
Handles a call. |
void |
handle(Request request,
Uniform onReceivedCallback)
Handles a call. |
boolean |
isAvailable()
Indicates the underlying connector helper is available. |
void |
setConnectTimeout(int connectTimeout)
Sets the connection timeout in milliseconds. |
void |
start()
Starts the Restlet. |
void |
stop()
Stops the Restlet. |
Methods inherited from class org.restlet.client.Connector |
---|
getProtocols, setProtocols |
Methods inherited from class org.restlet.client.Restlet |
---|
finalize, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, setName, setOwner |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Client(Context context, java.util.List<Protocol> protocols)
context
- The context.protocols
- The connector protocols.public Client(Context context, java.util.List<Protocol> protocols, java.lang.String helperClass)
context
- The context.protocols
- The connector protocols.helperClass
- Optional helper class name.public Client(Context context, Protocol protocol)
context
- The context.protocol
- The connector protocol.public Client(java.util.List<Protocol> protocols)
protocols
- The connector protocols.public Client(Protocol protocol)
protocol
- The connector protocol.public Client(java.lang.String protocolName)
protocolName
- The connector protocol.Method Detail |
---|
public int getConnectTimeout()
public void handle(Request request, Response response)
Restlet
Context#setCurrent(Context)
method and by attempting to start it, unless it was already started. If
an exception is thrown during the start action, then the response status
is set to Status.SERVER_ERROR_INTERNAL
.
Subclasses overriding this method should make sure that they call super.handle(request, response) before adding their own logic.
handle
in interface Uniform
handle
in class Restlet
request
- The request to handle.response
- The response to update.public void handle(Request request, Response response, Uniform onResponseCallback)
request
- The request to handle.response
- The response to update.onResponseCallback
- The callback invoked upon response reception.public final void handle(Request request, Uniform onReceivedCallback)
request
- The request to handle.onReceivedCallback
- The callback invoked upon request reception.public boolean isAvailable()
isAvailable
in class Connector
public void setConnectTimeout(int connectTimeout)
connectTimeout
- The connection timeout.public void start() throws java.lang.Exception
Restlet
start
in class Restlet
java.lang.Exception
public void stop() throws java.lang.Exception
Restlet
stop
in class Restlet
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |