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.bridges.jsf.myfaces;
16  
17  import javax.faces.context.ResponseWriter;
18  
19  import javax.portlet.PortletContext;
20  import javax.portlet.PortletRequest;
21  import javax.portlet.PortletResponse;
22  
23  import org.apache.myfaces.context.ReleaseableExternalContext;
24  import org.apache.myfaces.context.servlet.ServletFacesContextImpl;
25  
26  /**
27   * <a href="MyFacesContextImpl.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Myunghun Kim
30   */
31  public class MyFacesContextImpl extends ServletFacesContextImpl {
32  
33      public MyFacesContextImpl(PortletContext portletContext,
34                                PortletRequest portletRequest,
35                                PortletResponse portletResponse) {
36  
37          super(portletContext, portletRequest, portletResponse);
38      }
39  
40      public void setResponseWriter(ResponseWriter responseWriter) {
41          if (responseWriter == null) {
42              throw new NullPointerException("responseWriter");
43          }
44  
45          _responseWriter = responseWriter;
46      }
47  
48      public ResponseWriter getResponseWriter() {
49          return _responseWriter;
50      }
51  
52      public void release() {
53          super.release();
54  
55          _responseWriter = null;
56      }
57  
58      public void setExternalContext(ReleaseableExternalContext extContext) {
59          _responseWriter = null;
60  
61          super.setExternalContext(extContext);
62      }
63  
64      private ResponseWriter _responseWriter = null;
65  
66  }