KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > adaptor > http > ProcessorMBean


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.tools.adaptor.http;
10
11 import java.io.IOException JavaDoc;
12
13 import org.w3c.dom.Document JavaDoc;
14
15 /**
16  * Processor ManagementBean, just defines a generic description
17  *
18  * @version $Revision: 1.3 $
19  */

20 public interface ProcessorMBean
21 {
22    public String JavaDoc getName();
23
24    /**
25     * The method will process the result string and produce an output. The
26     * implementor is also responsible to set the mime type, response code and
27     * send the headers before answering as follow:
28     * <code>
29     * out.setCode(HttpConstants.STATUS_OKAY);
30     * out.setHeader("Content-type", "text/html");
31     * out.sendHeaders();
32     * out.write("some text");
33     * </code>
34     *
35     * @param out The output stream
36     * @param in The input stream
37     * @param document A document containing the data
38     */

39    public void writeResponse(HttpOutputStream out, HttpInputStream in, Document JavaDoc document) throws IOException JavaDoc;
40
41    /**
42     * The method will process the result exception and produce output. The
43     * implementor is also responsible to set the mime type, response code and
44     * send the headers before answering as follow:
45     * <code>
46     * out.setCode(HttpConstants.STATUS_OKAY);
47     * out.setHeader("Content-type", "text/html");
48     * out.sendHeaders();
49     * out.write("some text");
50     * </code>
51     *
52     * @param out The output stream
53     * @param in The input stream
54     * @param e The exception to be reported
55     */

56    public void writeError(HttpOutputStream out, HttpInputStream in, Exception JavaDoc e) throws IOException JavaDoc;
57
58    /**
59     * Preprocess a path and return a replacement path. For instance the / path
60     * could be replaced by the server path
61     *
62     * @param path The original path
63     * @return the replacement path. If not modification the path param should
64     * be returned
65     */

66    public String JavaDoc preProcess(String JavaDoc path);
67
68    /**
69     * Let the processor load internally a not found element. This can be used
70     * to load images, stylesheets and so on. If return is not null, the path is
71     * processed
72     *
73     * @param path The request element
74     * @param out The output stream
75     * @param in The input stream
76     */

77    public String JavaDoc notFoundElement(String JavaDoc path, HttpOutputStream out, HttpInputStream in) throws IOException JavaDoc, HttpException;
78 }
79
Popular Tags