KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > renderkit > html > util > DummyFormResponseWriterWrapper


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.renderkit.html.util;
17
18 import org.apache.myfaces.context.ResponseWriterWrapper;
19
20 import javax.faces.context.ResponseWriter;
21 import java.io.IOException JavaDoc;
22 import java.io.Writer JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.Set JavaDoc;
25
26 /**
27  * @author Manfred Geiler (latest modification by $Author: matze $)
28  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:51:01 $
29  */

30 public class DummyFormResponseWriterWrapper
31         extends ResponseWriterWrapper
32         implements DummyFormResponseWriter
33 {
34     //private static final Log log = LogFactory.getLog(DummyFormResponseWriterWrapper.class);
35

36     private Set JavaDoc _dummyFormParams = new HashSet JavaDoc();
37
38     public DummyFormResponseWriterWrapper(ResponseWriter responseWriter)
39     {
40         super(responseWriter);
41     }
42
43     private DummyFormResponseWriterWrapper(ResponseWriter responseWriter,
44                                            Set JavaDoc dummyFormParams)
45     {
46         super(responseWriter);
47         _dummyFormParams = dummyFormParams;
48     }
49
50     public ResponseWriter cloneWithWriter(Writer writer)
51     {
52         return new DummyFormResponseWriterWrapper(_responseWriter.cloneWithWriter(writer),
53                                                   _dummyFormParams);
54     }
55
56     public void endDocument() throws IOException JavaDoc
57     {
58         super.flush();
59         DummyFormUtils.writeDummyForm(_responseWriter, _dummyFormParams);
60         super.endDocument();
61     }
62
63     public void setWriteDummyForm(boolean writeDummyForm)
64     {
65         if (writeDummyForm == false)
66         {
67             throw new IllegalArgumentException JavaDoc();
68         }
69     }
70
71     public String JavaDoc getDummyFormName()
72     {
73         return DummyFormUtils.DUMMY_FORM_NAME;
74     }
75
76     public void addDummyFormParameter(String JavaDoc paramName)
77     {
78         _dummyFormParams.add(paramName);
79     }
80
81 }
82
Popular Tags