Package com.jalios.rest.client
Class RestQuery
- java.lang.Object
-
- com.jalios.rest.client.RestQuery
-
public class RestQuery extends java.lang.Object
An instance of this class represents a HTTP query in the context of a rest query.- Author:
- dissert
-
-
Constructor Summary
Constructors Constructor Description RestQuery(ClientSession session, java.lang.String resourcePath)
RestQuery(ClientSession session, org.restlet.data.Reference reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestQuery
addFormMultipartFile(java.lang.String filename, java.io.File file)
If this method is called, the Content-Type is form-multipart and it is also the format of the entity body, even if the file in parameter is null or empty.RestQuery
addRelateds(Relateds relateds)
Add relateds parameter to the query (as parameters in the queryString)org.restlet.data.Response
delete()
Executes this rest query as a HTTP query with a GET method.JcmsResource
get()
Executes this rest query as a HTTP query with a GET method.org.restlet.data.Response
post()
Executes this rest query as a HTTP query with a POST method.org.restlet.data.Response
put()
Executes this rest query as a HTTP query with a PUT method.RestQuery
setAuthentication(Authentication authentication)
A specific authentification may be used for this query.RestQuery
setForm(org.restlet.data.Form form)
Add a list of parameters to the current query.RestQuery
setParam(java.lang.String key, java.lang.String value)
Add one parameter to the current query.
-
-
-
Constructor Detail
-
RestQuery
public RestQuery(ClientSession session, java.lang.String resourcePath)
-
RestQuery
public RestQuery(ClientSession session, org.restlet.data.Reference reference)
-
-
Method Detail
-
setParam
public RestQuery setParam(java.lang.String key, java.lang.String value)
Add one parameter to the current query. Given the HTTP method used, the parameters may be set in the query string (for GET and DELETE method) or in the entity body (for POST query).- Parameters:
key
-value
-- Returns:
- the current RestQuery (for method chaining)
-
setForm
public RestQuery setForm(org.restlet.data.Form form)
Add a list of parameters to the current query. Given the HTTP method used, the parameters may be set in the query string (for GET and DELETE method) or in the entity body (for POST query).- Parameters:
form
-- Returns:
- the current RestQuery (for method chaining)
-
setAuthentication
public RestQuery setAuthentication(Authentication authentication)
A specific authentification may be used for this query. If specified, it overrides the main authentication declared in the ClientSession.- Parameters:
authentication
-- Returns:
- the current RestQuery (for method chaining)
-
addFormMultipartFile
public RestQuery addFormMultipartFile(java.lang.String filename, java.io.File file)
If this method is called, the Content-Type is form-multipart and it is also the format of the entity body, even if the file in parameter is null or empty.- Parameters:
filename
-file
-- Returns:
- the current RestQuery
- Since:
- JCMS-6.1
-
get
public JcmsResource get() throws RestException
Executes this rest query as a HTTP query with a GET method.- Returns:
- A JcmsResource, giving acces to the HTTP response.
- Throws:
RestException
- thrown if the status is not succeded. The acces to the response os possible by RestException.getResponse()
-
post
public org.restlet.data.Response post()
Executes this rest query as a HTTP query with a POST method.- Returns:
- A JcmsResource, giving acces to the HTTP response.
-
put
public org.restlet.data.Response put()
Executes this rest query as a HTTP query with a PUT method.- Returns:
- A JcmsResource, giving acces to the HTTP response.
-
delete
public org.restlet.data.Response delete()
Executes this rest query as a HTTP query with a GET method.- Returns:
- A JcmsResource, giving acces to the HTTP response.
-
-