net.spy.jwebkit.xml
Class XMLOutputServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.spy.jwebkit.JWHttpServlet
              extended by net.spy.jwebkit.xml.XMLOutputServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AjaxServlet, TopServlet

public class XMLOutputServlet
extends JWHttpServlet

Servlet that serializes DOM trees to the response.

See Also:
Serialized Form

Field Summary
static java.lang.String DOCUMENT
          Name of the request holding the DOM tree.
 
Constructor Summary
XMLOutputServlet()
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get an XML document from the request attribute and send it as text/xml.
protected  org.xml.sax.ContentHandler getContentHandler(javax.servlet.http.HttpServletResponse res)
          Get an XML Content handler for streaming SAXAbles.
protected  void sendXml(org.w3c.dom.Document doc, javax.servlet.http.HttpServletResponse response)
          Send an XML document as text/xml.
protected  void sendXml(net.spy.xml.SAXAble s, javax.servlet.http.HttpServletResponse response)
          Send a SAX response with the default XML type.
protected  void sendXml(java.lang.String type, org.w3c.dom.Document doc, javax.servlet.http.HttpServletResponse response)
          Send XML with a specific content type.
protected  void sendXml(java.lang.String type, net.spy.xml.SAXAble s, javax.servlet.http.HttpServletResponse response)
          Send a SAX response.
 
Methods inherited from class net.spy.jwebkit.JWHttpServlet
getContextRelativeFilePathParameter, getLogger, sendHTML, sendPlain, sendSimple, service, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT

public static final java.lang.String DOCUMENT
Name of the request holding the DOM tree.

See Also:
Constant Field Values
Constructor Detail

XMLOutputServlet

public XMLOutputServlet()
Method Detail

sendXml

protected void sendXml(java.lang.String type,
                       org.w3c.dom.Document doc,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException
Send XML with a specific content type.

Parameters:
type - the content type
doc - the document
response - the response
Throws:
java.io.IOException

sendXml

protected void sendXml(java.lang.String type,
                       net.spy.xml.SAXAble s,
                       javax.servlet.http.HttpServletResponse response)
                throws org.xml.sax.SAXException,
                       java.io.IOException
Send a SAX response.

Parameters:
s - the saxable
response - the response
Throws:
org.xml.sax.SAXException
java.io.IOException

sendXml

protected void sendXml(net.spy.xml.SAXAble s,
                       javax.servlet.http.HttpServletResponse response)
                throws org.xml.sax.SAXException,
                       java.io.IOException
Send a SAX response with the default XML type.

Parameters:
s - the SAXAble
response - the response object
Throws:
org.xml.sax.SAXException
java.io.IOException

sendXml

protected void sendXml(org.w3c.dom.Document doc,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException
Send an XML document as text/xml.

Parameters:
doc - the document
response - the response
Throws:
java.io.IOException

getContentHandler

protected org.xml.sax.ContentHandler getContentHandler(javax.servlet.http.HttpServletResponse res)
                                                throws java.io.IOException,
                                                       org.xml.sax.SAXException
Get an XML Content handler for streaming SAXAbles. Note that startDocument has been called on this handler before returning it.

Throws:
java.io.IOException
org.xml.sax.SAXException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Get an XML document from the request attribute and send it as text/xml.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException
java.io.IOException


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.