public class ClientUtil
extends java.lang.Object
| Constructor and Description | 
|---|
| ClientUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | addHttpHeader(org.restlet.data.Request request,
             java.lang.String key,
             java.lang.String value)Adds a header in a HTTP request represented by the request parameter. | 
| static boolean | getBoolean(JcmsResource resource,
          java.lang.String xpathExpression,
          boolean def)If the result of the XPath query is a boolean String, it is converted in Boolean. | 
| static java.util.Date | getDate(JcmsResource resource,
       java.lang.String xpathExpression,
       java.util.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).For more details, see http://www.w3.org/TR/NOTE-datetime , it is converted this Date. | 
| static org.jdom.Element | getFirstElement(JcmsResource resource,
               java.lang.String xpathExpression)Utility functions to use XPath expression to introspect xml contained in
 entity boby of HTTP response | 
| static long | getLong(JcmsResource resource,
       java.lang.String xpathExpression,
       long def)If the result of the XPath query is a long representation String, it is converted as an long. | 
| static java.util.List<?> | getNodeList(JcmsResource resource,
           java.lang.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 java.lang.Object | getSingleNode(JcmsResource resource,
             java.lang.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 java.lang.String | getString(JcmsResource resource,
         java.lang.String xpathExpression)Return the most pertinent String for the result of the XPath query in the body content
 of the given resource. | 
| static java.lang.String | getString(JcmsResource resource,
         java.lang.String xpathExpression,
         java.lang.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 | 
public static void addHttpHeader(org.restlet.data.Request request,
                                 java.lang.String key,
                                 java.lang.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, java.lang.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 requestorg.jdom.JDOMException - if the XPath expression is invalid or its evaluation on the specified context failed.public static java.lang.Object getSingleNode(JcmsResource resource, java.lang.String xpathExpression) throws org.jdom.JDOMException
resource - the search is done into the entity body of this resourcexpathExpression - the XPath expressionorg.jdom.JDOMException - if the XPath expression is invalid or its evaluation on the specified context failed.public static java.util.List<?> getNodeList(JcmsResource resource, java.lang.String xpathExpression) throws org.jdom.JDOMException
resource - the given resource get by a rest requestxpathExpression - the XPath expressionorg.jdom.JDOMException - if the XPath expression is invalid or its evaluation on the specified context failed.public static java.lang.String getString(JcmsResource resource, java.lang.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 requestorg.jdom.JDOMException - if the XPath expression is invalid or its evaluation on the specified context failed.public static java.lang.String getString(JcmsResource resource, java.lang.String xpathExpression, java.lang.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 valuepublic static boolean getBoolean(JcmsResource resource, java.lang.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 valuepublic static java.util.Date getDate(JcmsResource resource, java.lang.String xpathExpression, java.util.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 valuepublic static long getLong(JcmsResource resource, java.lang.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 valueCopyright © 2001-2021 Jalios SA. All Rights Reserved.