public class RequestData
extends java.lang.Object
Constructor and Description |
---|
RequestData(XDocument request)
RequestData constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getActionName()
Returns the name of the action that was called from the page.
|
JSONObject |
getAsJSON()
Returns the data for this request as a JSON object.
|
XDocument |
getAsXML()
Returns the data for this request as a XDocument object, which provides a wrapper
around the DOM Document.
|
protected XDocument |
getFinalData()
This function will be called once the Java Controller has finsihed so that the final data
can be retrieved.
|
java.lang.String |
getPageName()
Gets the name of the page that will be displayed once the processing has finished.
|
void |
setPageName(java.lang.String pageName)
Set the page to display once the processing has completed.
|
public RequestData(XDocument request)
request
- The XDocument object containing the initial data this object will manage.public java.lang.String getActionName()
public java.lang.String getPageName()
public void setPageName(java.lang.String pageName)
pageName
- The name of the page to display.public XDocument getAsXML()
Use this method if you are happy dealing with the data as XML. Any required changes to the data should be made directly in this XDocument.
Important: Only one of getAsXML and getAsJSON can be used for a given request.
public JSONObject getAsJSON() throws java.io.IOException
Use this method if you would prefer to deal with the data in a JSON format. Any required changes should be made directly to the returned JSONObject.
Once processing has finished the JSON data will be automatically converted back into XML to enable rendering of the next page.
Note: The XML -> JSON -> XML process can cause changes to the ordering of the data in some situations that you may need to ba aware of. For example, given an initial structure of:
parent item item another_item itemthe final structure will be
parent item item item another_itemdue to all the item elements becoming an array in the JSON data. If this is a problem, you should use getAsXML() instead. You could still convert parts of the data to JSON if needed by using the helper methods in
JSONUtils
.
Important: Only one of getAsXML and getAsJSON can be used for a given request.
java.io.IOException
- If an error occurrs during the conversion.protected XDocument getFinalData()
Copyright © 2007 Hyfinity Ltd. All Rights Reserved.