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  
20  package org.apache.myfaces.tobago.internal.webapp;
21  
22  import org.apache.myfaces.tobago.component.Attributes;
23  import org.apache.myfaces.tobago.internal.util.Deprecation;
24  import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
25  import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
26  
27  import javax.faces.component.UIComponent;
28  import javax.faces.context.ResponseWriter;
29  import java.io.IOException;
30  import java.io.Writer;
31  
32  public class TobagoResponseWriterWrapper extends TobagoResponseWriter {
33  
34    private ResponseWriter responseWriter;
35  
36    public TobagoResponseWriterWrapper(final ResponseWriter responseWriter) {
37      this.responseWriter = responseWriter;
38    }
39  
40    public void startElement(final String name, final UIComponent component) throws IOException {
41      responseWriter.startElement(name, component);
42    }
43  
44    public void endElement(final String name) throws IOException {
45      responseWriter.endElement(name);
46    }
47  
48  
49    public void write(final String string) throws IOException {
50      responseWriter.write(string);
51    }
52  
53    public void writeComment(final Object comment) throws IOException {
54      responseWriter.writeComment(comment);
55    }
56  
57    public ResponseWriter cloneWithWriter(final Writer writer) {
58      return responseWriter.cloneWithWriter(writer);
59    }
60  
61    @Deprecated
62    public void writeAttribute(final String name, final Object value, final String property) throws IOException {
63      responseWriter.writeAttribute(name, value, property);
64    }
65  
66    @Deprecated
67    public void writeText(final Object text, final String property) throws IOException {
68      responseWriter.writeText(text, property);
69    }
70  
71    public void flush() throws IOException {
72      responseWriter.flush();
73    }
74  
75    public void writeAttribute(final String name, final String value, final boolean escape) throws IOException {
76      responseWriter.writeAttribute(name, value, null);
77    }
78  
79    @Override
80    @Deprecated
81    public String getStyleClasses() {
82      return null;
83    }
84  
85    /**
86     * @deprecated since Tobago 1.5.0
87     */
88    @Deprecated
89    public void writeClassAttribute() throws IOException {
90      Deprecation.LOG.warn("Please use writeClassAttribute(org.apache.myfaces.tobago.renderkit.css.Classes)");
91      responseWriter.writeAttribute(HtmlAttributes.CLASS, null, Attributes.STYLE_CLASS);
92    }
93  
94    public String getContentType() {
95      return responseWriter.getContentType();
96    }
97  
98    public String getCharacterEncoding() {
99      return responseWriter.getCharacterEncoding();
100   }
101 
102   public void startDocument() throws IOException {
103     responseWriter.startDocument();
104   }
105 
106   public void endDocument() throws IOException {
107     responseWriter.endDocument();
108   }
109 
110   public void writeURIAttribute(final String name, final Object value, final String property) throws IOException {
111     responseWriter.writeURIAttribute(name, value, property);
112   }
113 
114   public void writeText(final char[] text, final int off, final int len) throws IOException {
115     responseWriter.writeText(text, off, len);
116   }
117 
118   public void write(final char[] chars, final int i, final int i1) throws IOException {
119     responseWriter.write(chars, i, i1);
120   }
121 
122   public void close() throws IOException {
123     responseWriter.close();
124   }
125 }