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.renderkit.html.HtmlElements;
23  import org.apache.myfaces.tobago.renderkit.html.HtmlTypes;
24  import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
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    @Override
41    public void startElement(final String name, final UIComponent component) throws IOException {
42      responseWriter.startElement(name, component);
43    }
44  
45    @Override
46    public void startElement(HtmlElements name) throws IOException {
47      responseWriter.startElement(name.getValue(), null);
48    }
49  
50    @Override
51    public void endElement(final String name) throws IOException {
52      responseWriter.endElement(name);
53    }
54  
55    @Override
56    public void endElement(HtmlElements name) throws IOException {
57      responseWriter.endElement(name.getValue());
58    }
59  
60    @Override
61    public void write(final String string) throws IOException {
62      responseWriter.write(string);
63    }
64  
65    @Override
66    public void writeComment(final Object comment) throws IOException {
67      responseWriter.writeComment(comment);
68    }
69  
70    @Override
71    public ResponseWriter cloneWithWriter(final Writer writer) {
72      return responseWriter.cloneWithWriter(writer);
73    }
74  
75    @Override
76    @Deprecated
77    public void writeAttribute(final String name, final Object value, final String property) throws IOException {
78      responseWriter.writeAttribute(name, value, property);
79    }
80  
81    @Override
82    @Deprecated
83    public void writeText(final Object text, final String property) throws IOException {
84      responseWriter.writeText(text, property);
85    }
86  
87    @Override
88    public void flush() throws IOException {
89      responseWriter.flush();
90    }
91  
92    @Override
93    public void writeAttribute(final MarkupLanguageAttributes name, final String value, final boolean escape)
94        throws IOException {
95      responseWriter.writeAttribute(name.getValue(), value, null);
96    }
97  
98    @Override
99    public void writeAttribute(final MarkupLanguageAttributes name, final HtmlTypes types)
100       throws IOException {
101     responseWriter.writeAttribute(name.getValue(), types.getValue(), null);
102   }
103 
104   @Override
105   public String getContentType() {
106     return responseWriter.getContentType();
107   }
108 
109   @Override
110   public String getCharacterEncoding() {
111     return responseWriter.getCharacterEncoding();
112   }
113 
114   @Override
115   public void startDocument() throws IOException {
116     responseWriter.startDocument();
117   }
118 
119   @Override
120   public void endDocument() throws IOException {
121     responseWriter.endDocument();
122   }
123 
124   @Override
125   public void writeURIAttribute(final String name, final Object value, final String property) throws IOException {
126     responseWriter.writeURIAttribute(name, value, property);
127   }
128 
129   @Override
130   public void writeURIAttribute(MarkupLanguageAttributes name, String string) throws IOException {
131     responseWriter.writeURIAttribute(name.getValue(), string, null);
132   }
133 
134   @Override
135   public void writeText(final char[] text, final int off, final int len) throws IOException {
136     responseWriter.writeText(text, off, len);
137   }
138 
139   @Override
140   public void write(final char[] chars, final int i, final int i1) throws IOException {
141     responseWriter.write(chars, i, i1);
142   }
143 
144   @Override
145   public void close() throws IOException {
146     responseWriter.close();
147   }
148 }