mx4j.tools.adaptor.http

Class DefaultProcessor

Implemented Interfaces:
ProcessorMBean

public class DefaultProcessor
extends java.lang.Object
implements ProcessorMBean

DefaultPostProcessor doesn't alter the result, just publising the xml file
Version:
$Revision: 1.4 $

Method Summary

String
getName()
protected String
normalize(String s)
Normalizes the given string.
String
notFoundElement(String path, HttpOutputStream out, HttpInputStream in)
Let the processor load internally a not found element.
String
preProcess(String path)
Preprocess a path and return a replacement path.
protected void
print(PrintWriter out, Node node)
protected Attr[]
sortAttributes(NamedNodeMap attrs)
Returns a sorted list of attributes.
void
writeError(HttpOutputStream out, HttpInputStream in, Exception e)
The method will process the result exception and produce output.
void
writeResponse(HttpOutputStream out, HttpInputStream in, Document document)
The method will process the result string and produce an output.

Method Details

getName

public String getName()
Specified by:
getName in interface ProcessorMBean

normalize

protected String normalize(String s)
Normalizes the given string.
Parameters:
s - Description of Parameter
Returns:
Description of the Returned Value

notFoundElement

public String notFoundElement(String path,
                              HttpOutputStream out,
                              HttpInputStream in)
            throws IOException,
                   HttpException
Let the processor load internally a not found element. This can be used to load images, stylesheets and so on. If return is not null, the path is processed
Specified by:
notFoundElement in interface ProcessorMBean
Parameters:
path - The request element
out - The output stream
in - The input stream

preProcess

public String preProcess(String path)
Preprocess a path and return a replacement path. For instance the / path could be replaced by the server path
Specified by:
preProcess in interface ProcessorMBean
Parameters:
path - The original path
Returns:
the replacement path. If not modification the path param should be returned

print

protected void print(PrintWriter out,
                     Node node)

sortAttributes

protected Attr[] sortAttributes(NamedNodeMap attrs)
Returns a sorted list of attributes.
Parameters:
attrs - Description of Parameter
Returns:
Description of the Returned Value

writeError

public void writeError(HttpOutputStream out,
                       HttpInputStream in,
                       Exception e)
            throws IOException
The method will process the result exception and produce output. The implementor is also responsible to set the mime type, response code and send the headers before answering as follow: out.setCode(HttpConstants.STATUS_OKAY); out.setHeader("Content-type", "text/html"); out.sendHeaders(); out.write("some text");
Specified by:
writeError in interface ProcessorMBean
Parameters:
out - The output stream
in - The input stream
e - The exception to be reported

writeResponse

public void writeResponse(HttpOutputStream out,
                          HttpInputStream in,
                          Document document)
            throws IOException
The method will process the result string and produce an output. The implementor is also responsible to set the mime type, response code and send the headers before answering as follow: out.setCode(HttpConstants.STATUS_OKAY); out.setHeader("Content-type", "text/html"); out.sendHeaders(); out.write("some text");
Specified by:
writeResponse in interface ProcessorMBean
Parameters:
out - The output stream
in - The input stream
document - A document containing the data

Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.