|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
xml.pipeline.XmlServlet
This base class provides utility functions making it easy for servlets to send and receive XML data structures through an XML processing pipeline.
This means that either the request to the servlet, or its response, or both of these, may be viewed as a stage in an XML processing pipeline. The request will always be an input; the response, an output. It's easy to convert to DOM or text representations at any point. Other types of event producers and consumers can work with specialized representations that have been tuned to application requirements.
Perhaps the simpest subclass would just add a method something like the following one:
public void doPost ( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { EventProducer producer = getXmlInput (request); EventConsumer consumer = getXmlOutput (response); consumer = PipelineFactory.createPipeline ( " ... filter pipeline descriptor goes here ...", consumer); producer.produce (consumer); }
Used in conjuction with a CallFilter, such a servlet could be used by clients to pass data through processing components which need any facilities (such as application resources, or mediated interactions) which are not available to that client.
CallFilter
,
PipelineFactory
Constructor Summary | |
XmlServlet()
The default constructor does nothing. |
Method Summary | |
Document |
getDocument(xml.pipeline.HttpServletRequest req)
Returns the input document provided in this request in the form of a single DOM Document. |
EntityResolver |
getEntityResolver()
Returns an entity resolver that is set up with some locally established mappings from public identifiers to files. |
ErrorHandler |
getErrorHandler()
Returns any error handler that will, by default, be provided to event producers. |
TextConsumer |
getXhtmlOutput(xml.pipeline.HttpServletResponse res)
Returns an event consumer which will treat all of its input callbacks as requests to write that portion of an XHTML document to the specified response. |
EventProducer |
getXmlInput(xml.pipeline.HttpServletRequest req)
Returns the XML input to this servlet in the form of an event producer, which will fire a stream of events to a event consumer. |
TextConsumer |
getXmlOutput(xml.pipeline.HttpServletResponse res)
Returns an event consumer which will treat all of its input callbacks as requests to write that portion of an XML document to the specified response. |
void |
setEntityResolver(EntityResolver r)
Assigns an error handler that will, by default, be provided to event producers. |
void |
setErrorHandler(ErrorHandler e)
Assigns an error handler that will, by default, be provided to event producers. |
void |
writeOutput(xml.pipeline.HttpServletResponse res,
Document document)
Writes the response of this servlet as an XML document, encoded in UTF-8 and with the correct MIME type. |
Constructor Detail |
public XmlServlet()
Method Detail |
public EventProducer getXmlInput(xml.pipeline.HttpServletRequest req) throws java.io.IOException, SAXException
NOTE: No multipart mime support at this time.
public TextConsumer getXmlOutput(xml.pipeline.HttpServletResponse res) throws java.io.IOException
public TextConsumer getXhtmlOutput(xml.pipeline.HttpServletResponse res) throws java.io.IOException
public Document getDocument(xml.pipeline.HttpServletRequest req) throws java.io.IOException, SAXException
public void writeOutput(xml.pipeline.HttpServletResponse res, Document document) throws java.io.IOException, SAXException
public EntityResolver getEntityResolver()
This uses the xhtml1.dtd-dir application parameter (context attribute) to identify the name of a directory with a local copy of the XHTML1 DTDs. (Subject to change.)
public void setEntityResolver(EntityResolver r)
public ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler e)
|
Source code is GPL'd at http://xmlconf.sourceforge.net. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |