NullServletResponse.java |
1 /** 2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved. 3 * 4 * This library is free software; you can redistribute it and/or modify it under 5 * the terms of the GNU Lesser General Public License as published by the Free 6 * Software Foundation; either version 2.1 of the License, or (at your option) 7 * any later version. 8 * 9 * This library is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 12 * details. 13 */ 14 15 package com.liferay.util.servlet; 16 17 import com.liferay.portal.kernel.io.unsync.UnsyncPrintWriter; 18 19 import java.io.PrintWriter; 20 21 import javax.servlet.ServletOutputStream; 22 import javax.servlet.http.HttpServletResponse; 23 import javax.servlet.http.HttpServletResponseWrapper; 24 25 /** 26 * <a href="NullServletResponse.java.html"><b><i>View Source</i></b></a> 27 * 28 * @author Brian Wing Shun Chan 29 */ 30 public class NullServletResponse extends HttpServletResponseWrapper { 31 32 public NullServletResponse(HttpServletResponse response) { 33 super(response); 34 35 _servletOutputStream = new NullServletOutputStream(); 36 _printWriter = new UnsyncPrintWriter(_servletOutputStream, true); 37 } 38 39 public ServletOutputStream getOutputStream() { 40 return _servletOutputStream; 41 } 42 43 public PrintWriter getWriter() { 44 return _printWriter; 45 } 46 47 /*public void sendError(int status) throws IOException { 48 } 49 50 public void sendError(int status, String msg) throws IOException { 51 } 52 53 public void sendRedirect(String location) throws IOException { 54 }*/ 55 56 private PrintWriter _printWriter; 57 private ServletOutputStream _servletOutputStream; 58 59 }