1 16 package org.apache.cocoon.environment.portlet; 17 18 import javax.portlet.PortletPreferences; 19 import javax.portlet.PortletURL; 20 21 import java.io.IOException ; 22 import java.io.OutputStream ; 23 import java.io.PrintWriter ; 24 import java.util.Locale ; 25 26 34 public final class RenderResponse extends PortletResponse { 35 36 private String contentType = null; 37 38 41 protected RenderResponse(javax.portlet.RenderResponse response, 42 PortletPreferences preferences) { 43 super(response, preferences); 44 } 45 46 47 public String getCharacterEncoding() { 48 return getRenderResponse().getCharacterEncoding(); 49 } 50 51 public Locale getLocale() { 52 return getRenderResponse().getLocale(); 53 } 54 55 59 public void addHeader(String name, String value) { 60 if (PortletEnvironment.HEADER_PORTLET_TITLE.equals(name)) { 61 getRenderResponse().setTitle(value); 62 } else { 63 super.addHeader(name, value); 64 } 65 } 66 67 71 public void setHeader(String name, String value) { 72 if (PortletEnvironment.HEADER_PORTLET_TITLE.equals(name)) { 73 getRenderResponse().setTitle(value); 74 } else { 75 super.setHeader(name, value); 76 } 77 } 78 79 80 82 87 public javax.portlet.RenderResponse getRenderResponse() { 88 return (javax.portlet.RenderResponse) getPortletResponse(); 89 } 90 91 public PortletURL createActionURL() { 92 return getRenderResponse().createActionURL(); 93 } 94 95 public PortletURL createRenderURL() { 96 return getRenderResponse().createRenderURL(); 97 } 98 99 public void flushBuffer() throws IOException { 100 getRenderResponse().flushBuffer(); 101 } 102 103 public int getBufferSize() { 104 return getRenderResponse().getBufferSize(); 105 } 106 107 public String getContentType() { 108 return getRenderResponse().getContentType(); 109 } 110 111 public String getNamespace() { 112 return getRenderResponse().getNamespace(); 113 } 114 115 public OutputStream getPortletOutputStream() throws IOException { 116 return getRenderResponse().getPortletOutputStream(); 117 } 118 119 public PrintWriter getWriter() throws IOException { 120 return getRenderResponse().getWriter(); 121 } 122 123 public boolean isCommitted() { 124 return getRenderResponse().isCommitted(); 125 } 126 127 public void reset() { 128 getRenderResponse().reset(); 129 } 130 131 public void resetBuffer() { 132 getRenderResponse().resetBuffer(); 133 } 134 135 public void setBufferSize(int size) { 136 getRenderResponse().setBufferSize(size); 137 } 138 139 public void setContentType(String type) { 140 this.contentType = type; 141 getRenderResponse().setContentType(type); 142 } 143 144 public void setTitle(String title) { 145 getRenderResponse().setTitle(title); 146 } 147 148 149 151 OutputStream getOutputStream() throws IOException { 152 if (this.contentType == null) { 154 setContentType("text/html"); 155 } 156 157 return getRenderResponse().getPortletOutputStream(); 158 } 159 } 160 | Popular Tags |