1 16 package org.apache.cocoon.components.jsp; 17 18 import java.io.IOException ; 19 import java.io.PrintWriter ; 20 import java.util.Locale ; 21 22 import javax.servlet.ServletOutputStream ; 23 import javax.servlet.http.Cookie ; 24 import javax.servlet.http.HttpServletResponse ; 25 26 27 30 public class JSPEngineServletResponse implements HttpServletResponse { 31 32 private final HttpServletResponse servletResponse; 33 private final JSPEngineServletOutputStream output; 34 35 private boolean hasWriter = false; 36 private boolean hasOutputStream = false; 37 38 public JSPEngineServletResponse(HttpServletResponse servletResponse, JSPEngineServletOutputStream output) { 39 this.servletResponse = servletResponse; 40 this.output = output; 41 } 42 public String getCharacterEncoding() { 43 return this.servletResponse.getCharacterEncoding(); 44 } 45 public Locale getLocale(){ 46 return this.servletResponse.getLocale(); 47 } 48 public PrintWriter getWriter() { 49 if (this.hasOutputStream) { 50 throw new IllegalStateException ("getOutputStream was already called."); 51 } 52 this.hasWriter = true; 53 return this.output.getWriter(); 54 } 55 public void setContentLength(int len) { 56 servletResponse.setContentLength(len); 58 } 59 public void setContentType(java.lang.String type) { 60 servletResponse.setContentType(type); 61 } 62 public void setLocale(java.util.Locale loc) { 63 servletResponse.setLocale(loc); 64 } 65 public ServletOutputStream getOutputStream() { 66 if (this.hasWriter) { 67 throw new IllegalStateException ("getWriter was already called."); 68 } 69 this.hasOutputStream = true; 70 return this.output; 71 } 72 public void addCookie(Cookie cookie){ 73 servletResponse.addCookie(cookie); 74 } 75 public boolean containsHeader(String s){ 76 return servletResponse.containsHeader(s); 77 } 78 79 public String encodeUrl(String s){ 80 return servletResponse.encodeUrl(s); 81 } 82 public String encodeURL(String s){ 83 return servletResponse.encodeURL(s); 84 } 85 86 public String encodeRedirectUrl(String s){ 87 return servletResponse.encodeRedirectUrl(s); 88 } 89 public String encodeRedirectURL(String s){ 90 return servletResponse.encodeRedirectURL(s); 91 } 92 public void sendError(int i, String s) throws IOException { 93 servletResponse.sendError(i,s); 94 } 95 public void sendError(int i) throws IOException { 96 servletResponse.sendError(i); 97 } 98 public void sendRedirect(String s) throws IOException { 99 servletResponse.sendRedirect(s); 100 } 101 public void setDateHeader(String s, long l) { 102 servletResponse.setDateHeader(s, l); 103 } 104 public void addDateHeader(String s, long l) { 105 servletResponse.addDateHeader(s, l); 106 } 107 public void setHeader(String s, String s1) { 108 servletResponse.setHeader(s, s1); 109 } 110 public void addHeader(String s, String s1) { 111 servletResponse.addHeader(s, s1); 112 } 113 public void setIntHeader(String s, int i) { 114 servletResponse.setIntHeader(s, i); 115 } 116 public void addIntHeader(String s, int i) { 117 servletResponse.addIntHeader(s, i); 118 } 119 public void setStatus(int i){ 120 servletResponse.setStatus(i); 121 } 122 123 public void setStatus(int i, String s){ 124 servletResponse.setStatus(i, s); 125 } 126 public void resetBuffer() {} 127 public void reset() {} 128 public int getBufferSize() { return 1024; } 129 public void setBufferSize(int size) {} 130 public void flushBuffer() throws IOException {} 131 public boolean isCommitted() { return false; } 132 133 } 134 | Popular Tags |