1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }