com.jalios.rest.client
Class RestQuery

java.lang.Object
  extended by 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
RestQuery(ClientSession session, org.restlet.data.Reference reference)
           
RestQuery(ClientSession session, java.lang.String resourcePath)
           
 
Method Summary
 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.
 boolean isNoRedirectExpected()
           
 org.restlet.data.Response post()
          Executes this rest query as a HTTP query with a POST 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 setNoRedirectExpected()
          Indicates no redirect is expected.
 RestQuery setParam(java.lang.String key, java.lang.String value)
          Add one parameter to the current query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

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.

addRelateds

public RestQuery addRelateds(Relateds relateds)
Add relateds parameter to the query (as parameters in the queryString)

Parameters:
relateds -
Returns:
the current RestQuery
Since:
JCMS-6.1

setNoRedirectExpected

public RestQuery setNoRedirectExpected()
Indicates no redirect is expected. Used mainly to indicates that acces to a forbidden resource must not generate a 302 Redirect, but a 401 Unauthorized.

Returns:
current RestQuery
Since:
JCMS-6.1

isNoRedirectExpected

public boolean isNoRedirectExpected()
Returns:
the noRedirectExpected
Since:
JCMS-6.1


Copyright © 2001-2010 Jalios SA. All Rights Reserved.