1 20 21 package com.methodhead.shim; 22 23 import javax.servlet.http.HttpServletResponse ; 24 import javax.servlet.ServletResponse ; 25 import javax.servlet.ServletOutputStream ; 26 import java.util.Locale ; 27 import java.io.PrintWriter ; 28 import javax.servlet.http.Cookie ; 29 30 34 public class NullHttpServletResponse 35 implements 36 HttpServletResponse { 37 38 40 public NullHttpServletResponse() { 41 out_ = new NullServletOutputStream(); 42 } 43 44 46 48 private static class NullServletOutputStream 49 extends 50 ServletOutputStream { 51 52 public void write( int b ) { 53 } 55 } 56 57 59 public void flushBuffer() { 60 } 61 62 public int getBufferSize() { 63 return 0; 64 } 65 66 public String getCharacterEncoding() { 67 return ""; 68 } 69 70 public Locale getLocale() { 71 return Locale.getDefault(); 72 } 73 74 public ServletOutputStream getOutputStream() { 75 return out_; 76 } 77 78 public PrintWriter getWriter() { 79 return new PrintWriter ( out_ ); 80 } 81 82 public boolean isCommitted() { 83 return false; 84 } 85 86 public void reset() { 87 } 88 89 public void resetBuffer() { 90 } 91 92 public void setBufferSize( int size ) { 93 } 94 95 public void setContentLength( int len ) { 96 } 97 98 public void setContentType( String type ) { 99 } 100 101 public void setLocale( Locale loc ) { 102 } 103 104 public void setResponse( ServletResponse response ) { 105 } 106 107 public void addCookie( Cookie cookie ) { 108 } 109 110 public void addDateHeader( String name, long date ) { 111 } 112 113 public void addHeader( String name, String value ) { 114 } 115 116 public void addIntHeader( String name, int value ) { 117 } 118 119 public boolean containsHeader( String name ) { 120 return false; 121 } 122 123 public String encodeRedirectUrl( String url ) { 124 return url; 125 } 126 127 public String encodeRedirectURL( String url ) { 128 return url; 129 } 130 131 public String encodeUrl( String url ) { 132 return url; 133 } 134 135 public String encodeURL( String url ) { 136 return url; 137 } 138 139 public void sendError( int sc ) { 140 } 141 142 public void sendError( int sc, String msg ) { 143 } 144 145 public void sendRedirect( String location ) { 146 } 147 148 public void setDateHeader( String name, long date ) { 149 } 150 151 public void setHeader( String name, String value ) { 152 } 153 154 public void setIntHeader( String name, int value ) { 155 } 156 157 public void setStatus( int sc ) { 158 } 159 160 public void setStatus( int sc, String sm ) { 161 } 162 163 165 ServletOutputStream out_ = null; 166 167 } 169 | Popular Tags |