|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.io.rest.RestClient
public abstract class RestClient
Abtract REST client.
| Field Summary | |
|---|---|
protected RestClientConfiguration |
configuration
rest client configuration |
protected Map<String,RestRequestBuilder> |
requestBuilders
registred requests |
protected RestSession |
session
rest session |
| Constructor Summary | |
|---|---|
RestClient()
|
|
RestClient(RestClientConfiguration configuration)
|
|
| Method Summary | |
|---|---|
protected abstract void |
addDefaultRequests()
Add the default available requests for this client. |
void |
addRequestBuilder(RestRequestBuilder builder)
Add a request into the client. |
InputStream |
askData(RestRequest request)
Ask some data from the server |
void |
close()
Close the client. |
protected abstract void |
close(RestSession session)
Close the client. |
RestClientConfiguration |
getConfiguration()
|
RestRequest |
getRequest(String id,
Object... args)
Obtain a request given his id and the args given. |
RestSession |
getSession()
|
boolean |
isOpen()
Is the client opened ? |
void |
open()
Open the client. |
protected abstract void |
open(RestSession session)
Open the client. |
InputStream |
sendData(RestRequest request)
Send some datas to the server. |
void |
setConfiguration(RestClientConfiguration configuration)
Use a new configuration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RestClientConfiguration configuration
protected RestSession session
protected final Map<String,RestRequestBuilder> requestBuilders
| Constructor Detail |
|---|
public RestClient()
public RestClient(RestClientConfiguration configuration)
| Method Detail |
|---|
protected abstract void addDefaultRequests()
protected abstract void open(RestSession session)
throws IOException
isOpen() must returns true.
session - the rest session
IOException - if any pb
protected abstract void close(RestSession session)
throws IOException
isOpen() must returns false.
session - the rest session
IOException - if any pbpublic void addRequestBuilder(RestRequestBuilder builder)
builder - the new request to add
public RestRequest getRequest(String id,
Object... args)
id - id of the requestargs - args passed to build the request
public InputStream askData(RestRequest request)
throws RestException
request - request used for asking data
RestException - if any pb while asking data
public InputStream sendData(RestRequest request)
throws RestException
request - the request used for sending data
RestException - if any pb while sending data
public void open()
throws RestException
session and invoke
the method open(RestSession).
RestException - if any pb while opening session
public void close()
throws RestException
session and invoke
the method close(RestSession).
RestException - if any pb while closing sessionpublic boolean isOpen()
true if the internal session is opened,
false otherwise.public RestSession getSession()
sessionpublic RestClientConfiguration getConfiguration()
configurationpublic void setConfiguration(RestClientConfiguration configuration)
configuration - the new configuration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||