com.esri.adf.web.faces.renderkit.xml.ajax
Class AJAXUtil

java.lang.Object
  extended by com.esri.adf.web.faces.renderkit.xml.ajax.AJAXUtil

public class AJAXUtil
extends Object

Utility class.


Constructor Summary
AJAXUtil()
           
 
Method Summary
static Element appendViewState(javax.faces.context.FacesContext facesContext, Document doc, Element parent)
          Deprecated.  
static Element appendViewState(javax.faces.context.FacesContext facesContext, Document doc, Element parent, String viewElementName)
          Gets the current serialized view ID and add to the document as a element with the specified name.
static Document createErrorResponse(String message)
           Renders an XML document with a root error tag.
static String serializeView(javax.faces.context.FacesContext facesContext)
          Serializes the view of the faces context in server side.
static void writeResponse(javax.faces.context.FacesContext facesContext, Document doc)
           This method is the preferred way to render AJAX XML responses to be returned to the client.
static void writeResponse(javax.faces.context.FacesContext facesContext, Document doc, Properties outputFormat)
           This method is the preferred way to render AJAX XML responses to be returned to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AJAXUtil

public AJAXUtil()
Method Detail

writeResponse

public static void writeResponse(javax.faces.context.FacesContext facesContext,
                                 Document doc)
                          throws IOException

This method is the preferred way to render AJAX XML responses to be returned to the client.

   Document doc = XMLUtil.newDocument();
   ... add content to xml document ...
   AJAXUtil.writeResponse(facesContext, doc);
   facesContext.responseComplete();
 

This method gets the current response object from the external context, writes the response and then closes the response writer.

Parameters:
facesContext - Current FacesContext instance
doc - XML Document with content to be returned to client
Throws:
IOException

writeResponse

public static void writeResponse(javax.faces.context.FacesContext facesContext,
                                 Document doc,
                                 Properties outputFormat)
                          throws IOException

This method is the preferred way to render AJAX XML responses to be returned to the client.

   Document doc = XMLUtil.newDocument();
   ... add content to xml document ...
   AJAXUtil.writeResponse(facesContext, doc);
   facesContext.responseComplete();
 

This method gets the current response object from the external context, writes the response and then closes the response writer.

Parameters:
facesContext - Current FacesContext instance
doc - XML Document with content to be returned to client
outputFormat - the output properties that used for transformation
Throws:
IOException
See Also:
Transformer.setOutputProperties(Properties)

createErrorResponse

public static Document createErrorResponse(String message)

Renders an XML document with a root error tag.


Some error message to display

Parameters:
message - to be rendered within tag


serializeView

public static String serializeView(javax.faces.context.FacesContext facesContext)
                            throws Exception
Serializes the view of the faces context in server side.

Parameters:
facesContext -
Returns:
the state structure.
Throws:
Exception

appendViewState

public static Element appendViewState(javax.faces.context.FacesContext facesContext,
                                      Document doc,
                                      Element parent)
Deprecated. 

Gets the current serialized view ID and add to the document as a element.

Parameters:
facesContext - the current faces-context
doc - the doc to add the element
parent - the new "com.sun.faces.VIEW" will be appended to the given parent element.
Returns:
the "com.sun.faces.VIEW" element.

appendViewState

public static Element appendViewState(javax.faces.context.FacesContext facesContext,
                                      Document doc,
                                      Element parent,
                                      String viewElementName)
Gets the current serialized view ID and add to the document as a element with the specified name.

Parameters:
facesContext - the current faces-context
doc - the doc to add the element
parent - the new element containing the view state will be appended to the given parent element.
viewElementName - the name given to the new element. Default value is "com.sun.faces.VIEW"
Returns:
the new element containing the view state.