View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package javax.faces.context;
20  
21  import javax.faces.component.UIComponent;
22  import java.io.IOException;
23  import java.io.Writer;
24  
25  /**
26   * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
27   */
28  public abstract class ResponseWriter extends Writer
29  {
30      public abstract String getContentType();
31  
32      public abstract String getCharacterEncoding();
33  
34      @Override
35      public abstract void flush() throws IOException;
36  
37      public abstract void startDocument() throws IOException;
38  
39      public abstract void endDocument() throws IOException;
40  
41      public abstract void startElement(String name, UIComponent component) throws IOException;
42  
43      public abstract void endElement(String name) throws IOException;
44      
45      public void startCDATA() throws IOException
46      {
47          write ("<![CDATA[");
48      }
49      
50      public void endCDATA() throws IOException
51      {
52          write ("]]>");
53      }
54      
55      public abstract void writeAttribute(String name, Object value, String property) throws IOException;
56  
57      public abstract void writeURIAttribute(String name, Object value, String property) throws IOException;
58  
59      public abstract void writeComment(Object comment) throws IOException;
60  
61      public abstract void writeText(Object text, String property) throws IOException;
62  
63      public abstract void writeText(char[] text, int off, int len) throws IOException;
64  
65      public abstract ResponseWriter cloneWithWriter(Writer writer);
66  
67      /**
68       * @since 1.2
69       */
70      public void writeText(Object object, UIComponent component, String string) throws IOException
71      {
72          writeText(object, string);
73      }
74  
75      /**
76       * @since 2.2
77       * @param preamble
78       * @throws IOException 
79       */
80      public void writePreamble(String preamble) throws IOException 
81      {
82          write(preamble);
83      }
84  
85      /**
86       * @since 2.2
87       * @param doctype
88       * @throws IOException 
89       */
90      public void writeDoctype(String doctype) throws IOException
91      {
92          write(doctype);
93      }
94  }