public class RestUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
XML_UTF_8_STANDARD_BOM |
Constructor and Description |
---|
RestUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
displayResponse(org.restlet.data.Response response)
Dev method to print in syso the content of a response
|
static java.lang.String |
formatMsgToXml(javax.servlet.http.HttpServletRequest request)
Get the info, warning and error messages in the request and in the session and
returns a xml with all this informations.
|
static java.lang.String |
formatMsgToXml(javax.servlet.http.HttpServletRequest request,
boolean displayInfo,
boolean displayWarning,
boolean displayError)
Get the info, warning and error messages in the request and in the session and
returns a xml with all this informations.
|
static java.lang.String |
formatXmlEntityError(java.lang.String code,
java.lang.String message)
Print an message in the following format (without indentation) :
code
|
static java.lang.String |
getExtension(org.restlet.data.MediaType mediaType)
Gives an possible extension from a mime-type.
|
static org.restlet.data.Form |
getForm(org.restlet.resource.Representation entity)
Gives a form representation of the parameters in the entity-body.
|
static org.restlet.data.Form |
getForm(java.lang.String queryString)
Gives a form representation of the parameters in the queryString.
|
static org.restlet.data.Reference |
getReferenceFromUriSuffix(java.lang.String uriSuffix,
javax.servlet.http.HttpServletRequest j2eeRequest)
Gives the complete URL from an external point of vue, from an uri with no context-path and "rest" prefix
|
static boolean |
isRest(javax.servlet.http.HttpServletRequest request) |
static void |
sendApplicationError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Get the messages in request or in session and put it formatted in the entity body of the response
and set CLIENT_ERROR_BAD_REQUEST (400) HTTP error code.
|
static void |
sendDetailedError(javax.servlet.http.HttpServletResponse response,
int errorCode,
java.lang.String applicationErrorCode,
java.lang.String applicationErrorMessage) |
static void |
sendError(javax.servlet.http.HttpServletResponse response,
int errorCode) |
static void |
sendError(javax.servlet.http.HttpServletResponse response,
int errorCode,
java.lang.String message) |
static void |
sendError(javax.servlet.http.HttpServletResponse response,
org.restlet.data.Status error) |
public static final java.lang.String XML_UTF_8_STANDARD_BOM
public static final boolean isRest(javax.servlet.http.HttpServletRequest request)
public static void sendError(javax.servlet.http.HttpServletResponse response, org.restlet.data.Status error) throws java.io.IOException
java.io.IOException
public static void sendError(javax.servlet.http.HttpServletResponse response, int errorCode, java.lang.String message) throws java.io.IOException
java.io.IOException
public static void sendError(javax.servlet.http.HttpServletResponse response, int errorCode) throws java.io.IOException
java.io.IOException
public static void sendDetailedError(javax.servlet.http.HttpServletResponse response, int errorCode, java.lang.String applicationErrorCode, java.lang.String applicationErrorMessage) throws java.io.IOException
java.io.IOException
public static java.lang.String formatXmlEntityError(java.lang.String code, java.lang.String message)
code
code
- message
- public static void displayResponse(org.restlet.data.Response response) throws java.io.IOException
response
- a Restlet responsejava.io.IOException
- if the text content of the entity body can't be retrievedpublic static java.lang.String formatMsgToXml(javax.servlet.http.HttpServletRequest request)
request
- the current requestpublic static java.lang.String formatMsgToXml(javax.servlet.http.HttpServletRequest request, boolean displayInfo, boolean displayWarning, boolean displayError)
request
- the current requestdisplayInfo
- if false, info message is skippeddisplayWarning
- if false, warning message is skippeddisplayError
- if false, error message is skippedpublic static void sendApplicationError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
request
- the current requestresponse
- the current responsejava.io.IOException
- if the printer is innaccessiblepublic static java.lang.String getExtension(org.restlet.data.MediaType mediaType)
mediaType
- public static org.restlet.data.Reference getReferenceFromUriSuffix(java.lang.String uriSuffix, javax.servlet.http.HttpServletRequest j2eeRequest)
uriSuffix
- the uriSuffix with no context-path and no "rest" prefixj2eeRequest
- The current J2EE requestpublic static org.restlet.data.Form getForm(java.lang.String queryString)
queryString
- the query stringpublic static org.restlet.data.Form getForm(org.restlet.resource.Representation entity)
entity
- A representationCopyright © 2001-2010 Jalios SA. All Rights Reserved.