KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infohazard > maverick > flow > TransformStep


1 /*
2  * $Id: TransformStep.java,v 1.4 2003/04/12 06:10:51 lhoriman Exp $
3  * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/flow/TransformStep.java,v $
4  */

5
6 package org.infohazard.maverick.flow;
7
8 import java.io.IOException JavaDoc;
9 import java.io.Writer JavaDoc;
10 import java.io.Reader JavaDoc;
11 import javax.servlet.ServletException JavaDoc;
12 import javax.servlet.http.HttpServletResponse JavaDoc;
13 import javax.xml.transform.Source JavaDoc;
14 import org.xml.sax.ContentHandler JavaDoc;
15
16 /**
17  * The TransformStep defines a transformation step in a single request. It
18  * is used and then disposed of. It provides convenient facades for most
19  * of the usual output mechanisms that views and previous transforms might
20  * want.
21  *
22  * Unlike a Transform, a TransformStep is used in a single request and
23  * then thrown away.
24  */

25 public interface TransformStep
26 {
27     /**
28      * Your steps should always return false. The last step, which
29      * is not really a step at all - it's the real output stream,
30      * will return true.
31      */

32     public boolean isLast();
33     
34     /**
35      * This method allows content-type information to be passed into the
36      * subsequent step. It is equivalent to getResponse().setContentType(),
37      * however it can be used for all the other output methods (which
38      * do not provide a HttpServletResponse interface. Calling this method
39      * is optional but recommended so that prematurely halted transformations
40      * can have an intelligently set content-type.
41      */

42     public void setContentType(String JavaDoc contentType);
43     
44     /**
45      * Must call done() when finished.
46      */

47     public ContentHandler JavaDoc getSAXHandler() throws IOException JavaDoc, ServletException JavaDoc;
48     
49     /**
50      * Must call done() when finished.
51      */

52     public HttpServletResponse JavaDoc getResponse() throws IOException JavaDoc, ServletException JavaDoc;
53
54     /**
55      * Must call done() when finished.
56      */

57     public Writer JavaDoc getWriter() throws IOException JavaDoc, ServletException JavaDoc;
58     
59     /**
60      * This should be called after writing is complete.
61      */

62     public void done() throws IOException JavaDoc, ServletException JavaDoc;
63
64     //
65
//
66
// OR one of the below methods can be called. Note that these
67
// do not require the use of done(), although it doesn't hurt.
68
//
69
//
70

71     /**
72      * This is available if it is more convenient.
73      */

74     public void go(Source JavaDoc input) throws IOException JavaDoc, ServletException JavaDoc;
75
76     /**
77      * This is available if it is more convenient.
78      */

79     public void go(Reader JavaDoc input) throws IOException JavaDoc, ServletException JavaDoc;
80     
81     /**
82      * This is available if it is more convenient.
83      */

84     public void go(String JavaDoc input) throws IOException JavaDoc, ServletException JavaDoc;
85 }
86
Popular Tags