|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.4) E14255-03 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.bea.wlp.rest.results.GenericRestResult
public class GenericRestResult
A basic implementation of a RestResult that can be used to easily
associate a JavaBean result object with a result that can be returned
from a RestCommand. In most cases, custom implementations of
RestResult are not necessary, and this class can be used as
the result of a command.
This implementation handles formating for both XML and JSON,
including providing an appropriate content type string for each.
Overall command status of "ok" is always returned by this class, as it
is generally used either empty by itself when a command is successful, or
after a successful invokation of a RestCommand where a JavaBean is
supplied as the result.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.bea.wlp.rest.results.RestResult |
|---|
RestResult.FormatType |
| Field Summary | |
|---|---|
protected String |
contentType
|
protected static Debug |
debug
|
protected static HashMap<RestResult.FormatType,Formatter> |
formatters
|
static String |
JSON_CONTENT_TYPE
content type string form the JSON content type |
static String |
XML_CONTENT_TYPE
content type string for the XML content type |
| Constructor Summary | |
|---|---|
GenericRestResult()
|
|
| Method Summary | |
|---|---|
String |
getCharacterEncoding()
Get character encoding |
String |
getContentType(RestResult.FormatType formatType)
Gets the content type of your response, which can be used to set the content type of the response from the RestServlet. |
static HashMap<RestResult.FormatType,Formatter> |
getFormatters()
|
String |
getMessage()
For GenericRestResult, there is no message to return. |
String |
getResponse(RestResult.FormatType formatType)
Return the response in the specified format. |
Object |
getResponseBean()
Gets this RestResult as a JavaBean Object. |
int |
getStatus()
Gets the overall status of the RestResult. |
boolean |
isError()
Returns whether or not this RestResult is an
error type result. |
void |
setCharacterEncoding(String characterEncoding)
|
static void |
setFormatters(HashMap<RestResult.FormatType,Formatter> formatters)
|
void |
setResponseBean(Object responseBean)
Sets the JavaBean Object to be used as the result data for this RestResult. |
protected String |
toJSON()
Formats this result using the JSON formatter type. |
protected String |
toXML()
Formats this result using the XML formatter type. |
| 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_CONTENT_TYPE
public static final String JSON_CONTENT_TYPE
protected static final Debug debug
protected String contentType
protected static HashMap<RestResult.FormatType,Formatter> formatters
| Constructor Detail |
|---|
public GenericRestResult()
| Method Detail |
|---|
public String getResponse(RestResult.FormatType formatType)
getResponse in interface RestResultformatType - the desired FormatType to encode the result as
RestResultpublic Object getResponseBean()
RestResult as a JavaBean Object.
getResponseBean in interface RestResultpublic void setResponseBean(Object responseBean)
Object to be used as the result data for this RestResult.
responseBean - the JavaBean resultpublic String getContentType(RestResult.FormatType formatType)
RestServlet.
This implementation can return content type strings for either XML or JSON.
getContentType in interface RestResultformatType - the desired FormatType for the response.
Stringpublic int getStatus()
RestResult.
getStatus in interface RestResultRestResult.public String getMessage()
GenericRestResult, there is no message to return.
getMessage in interface RestResultpublic boolean isError()
RestResult is an
error type result.
isError in interface RestResultGenericRestResultpublic String getCharacterEncoding()
RestResult
getCharacterEncoding in interface RestResultpublic void setCharacterEncoding(String characterEncoding)
public static HashMap<RestResult.FormatType,Formatter> getFormatters()
public static void setFormatters(HashMap<RestResult.FormatType,Formatter> formatters)
protected String toXML()
RestResult formatted as XML.protected String toJSON()
RestResult formatted as JSON.
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.4) E14255-03 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||