|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.rest.RestUtil
public class RestUtil
Provides utility static methods for both client and server side in REST communication.
Field Summary | |
---|---|
static String |
XML_UTF_8_STANDARD_BOM
|
Constructor Summary | |
---|---|
RestUtil()
|
Method Summary | |
---|---|
static void |
displayResponse(org.restlet.data.Response response)
Dev method to print in syso the content of a response |
static 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 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 String |
formatXmlEntityError(String code,
String message)
Print an message in the following format (without indentation) : code
|
static 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(String queryString)
Gives a form representation of the parameters in the queryString. |
static org.restlet.data.Reference |
getReferenceFromUriSuffix(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,
String applicationErrorCode,
String applicationErrorMessage)
|
static void |
sendError(javax.servlet.http.HttpServletResponse response,
int errorCode)
|
static void |
sendError(javax.servlet.http.HttpServletResponse response,
int errorCode,
String message)
|
static void |
sendError(javax.servlet.http.HttpServletResponse response,
org.restlet.data.Status error)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String XML_UTF_8_STANDARD_BOM
Constructor Detail |
---|
public RestUtil()
Method Detail |
---|
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 IOException
IOException
public static void sendError(javax.servlet.http.HttpServletResponse response, int errorCode, String message) throws IOException
IOException
public static void sendError(javax.servlet.http.HttpServletResponse response, int errorCode) throws IOException
IOException
public static void sendDetailedError(javax.servlet.http.HttpServletResponse response, int errorCode, String applicationErrorCode, String applicationErrorMessage) throws IOException
IOException
public static String formatXmlEntityError(String code, String message)
code
code
- message
-
public static void displayResponse(org.restlet.data.Response response) throws IOException
response
- a Restlet response
IOException
- if the text content of the entity body can't be retrievedpublic static String formatMsgToXml(javax.servlet.http.HttpServletRequest request)
request
- the current request
public static 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 skipped
public static void sendApplicationError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
request
- the current requestresponse
- the current response
IOException
- if the printer is innaccessiblepublic static String getExtension(org.restlet.data.MediaType mediaType)
mediaType
-
public static org.restlet.data.Reference getReferenceFromUriSuffix(String uriSuffix, javax.servlet.http.HttpServletRequest j2eeRequest)
uriSuffix
- the uriSuffix with no context-path and no "rest" prefixj2eeRequest
- The current J2EE request
public static org.restlet.data.Form getForm(String queryString)
queryString
- the query string
public static org.restlet.data.Form getForm(org.restlet.resource.Representation entity)
entity
- A representation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |