1 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 ; 22 import java.io.Writer ; 23 import java.util.HashSet ; 24 import java.util.Set ; 25 26 30 public class DummyFormResponseWriterWrapper 31 extends ResponseWriterWrapper 32 implements DummyFormResponseWriter 33 { 34 36 private Set _dummyFormParams = new HashSet (); 37 38 public DummyFormResponseWriterWrapper(ResponseWriter responseWriter) 39 { 40 super(responseWriter); 41 } 42 43 private DummyFormResponseWriterWrapper(ResponseWriter responseWriter, 44 Set 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 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 (); 68 } 69 } 70 71 public String getDummyFormName() 72 { 73 return DummyFormUtils.DUMMY_FORM_NAME; 74 } 75 76 public void addDummyFormParameter(String paramName) 77 { 78 _dummyFormParams.add(paramName); 79 } 80 81 } 82 | Popular Tags |