|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jalios.rest.client.ClientUtil
public class ClientUtil
Utility functions (static public methods) used in Rest Clients.
Constructor Summary | |
---|---|
ClientUtil()
|
Method Summary | |
---|---|
static void |
addHttpHeader(org.restlet.data.Request request,
String key,
String value)
Adds a header in a HTTP request represented by the request parameter. |
static boolean |
getBoolean(JcmsResource resource,
String xpathExpression,
boolean def)
If the result of the XPath query is a boolean String, it is converted in Boolean. |
static Date |
getDate(JcmsResource resource,
String xpathExpression,
Date def)
If the result of the XPath query is a Date as defined by the W3C Date Time format (eg 1999-01-01T14:07:00+01:00 ). |
static org.jdom.Element |
getFirstElement(JcmsResource resource,
String xpathExpression)
Utility functions to use XPath expression to introspect xml contained in entity boby of HTTP response |
static long |
getLong(JcmsResource resource,
String xpathExpression,
long def)
If the result of the XPath query is a long representation String, it is converted as an long. |
static List<?> |
getNodeList(JcmsResource resource,
String xpathExpression)
Provide XPath feature : returns the list of Nodes in the xml in the entity body of the resource in first argument, with the xPathExpression in second argument. |
static org.restlet.data.Preference<org.restlet.data.MediaType> |
getPreferenceMediaType(org.restlet.data.MediaType mediaType)
|
static org.restlet.data.Request |
getRequest(org.restlet.data.Reference resourceRef,
org.restlet.data.Method method)
Instanciate the request with the uri and the HTTP method. |
static Object |
getSingleNode(JcmsResource resource,
String xpathExpression)
Provide XPath feature : returns the first of the Nodes in the xml in the entity body of the resource in first argument, with the xPathExpression in second argument. |
static String |
getString(JcmsResource resource,
String xpathExpression)
Return the most pertinent String for the result of the XPath query in the body content of the given resource. |
static String |
getString(JcmsResource resource,
String xpathExpression,
String def)
Return the most pertinent String for the result of the XPath query in the body content of the given resource. |
static void |
setPreferedMediaType(org.restlet.data.Request request,
org.restlet.data.MediaType[] mediaTypes)
In a Restlet Request object, set the prefered MediaType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClientUtil()
Method Detail |
---|
public static void addHttpHeader(org.restlet.data.Request request, String key, String value)
request
- The Restlet object representing an HTTP request.key
- The name of the given HTTP headervalue
- The name for the given HTTP headerpublic static org.restlet.data.Request getRequest(org.restlet.data.Reference resourceRef, org.restlet.data.Method method)
resourceRef
- method
-
public static void setPreferedMediaType(org.restlet.data.Request request, org.restlet.data.MediaType[] mediaTypes)
request
- The Restlet Request objectmediaTypes
- The prefered media typepublic static org.restlet.data.Preference<org.restlet.data.MediaType> getPreferenceMediaType(org.restlet.data.MediaType mediaType)
public static org.jdom.Element getFirstElement(JcmsResource resource, String xpathExpression) throws org.jdom.JDOMException
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the request
org.jdom.JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.public static Object getSingleNode(JcmsResource resource, String xpathExpression) throws org.jdom.JDOMException
resource
- the search is done into the entity body of this resourcexpathExpression
- the XPath expression
org.jdom.JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.public static List<?> getNodeList(JcmsResource resource, String xpathExpression) throws org.jdom.JDOMException
resource
- the given resource get by a rest requestxpathExpression
- the XPath expression
org.jdom.JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.public static String getString(JcmsResource resource, String xpathExpression) throws org.jdom.JDOMException
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the request
org.jdom.JDOMException
- if the XPath expression is invalid or its evaluation on the specified context failed.public static String getString(JcmsResource resource, String xpathExpression, String def)
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the requestdef
- the default value
public static boolean getBoolean(JcmsResource resource, String xpathExpression, boolean def)
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the requestdef
- the default value
public static Date getDate(JcmsResource resource, String xpathExpression, Date def)
1999-01-01T14:07:00+01:00
).
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the requestdef
- the default value
public static long getLong(JcmsResource resource, String xpathExpression, long def)
resource
- the given resource get by a rest requestxpathExpression
- an xpath expression to dig into the body content of the requestdef
- the default value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |