View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.context;
20  
21  import javax.el.ELContext;
22  import javax.faces.application.Application;
23  import javax.faces.application.FacesMessage;
24  import javax.faces.application.FacesMessage.Severity;
25  import javax.faces.component.UIViewRoot;
26  import javax.faces.context.ExternalContext;
27  import javax.faces.context.FacesContext;
28  import javax.faces.context.ResponseStream;
29  import javax.faces.context.ResponseWriter;
30  import javax.faces.render.RenderKit;
31  import java.util.Iterator;
32  
33  
34  /**
35   * Convenient class to wrap the current FacesContext.
36   * @author Manfred Geiler (latest modification by $Author: skitching $)
37   * @author Anton Koinov
38   * @version $Revision: 684465 $ $Date: 2008-08-10 06:38:21 -0500 (Sun, 10 Aug 2008) $
39   */
40  public class FacesContextWrapper
41      extends FacesContext
42  {
43      //~ Instance fields ----------------------------------------------------------------------------
44  
45      private FacesContext _facesContext;
46  
47      //~ Constructors -------------------------------------------------------------------------------
48  
49      public FacesContextWrapper(FacesContext facesContext)
50      {
51          _facesContext = facesContext;
52      }
53  
54      //~ Methods ------------------------------------------------------------------------------------
55  
56      public Application getApplication()
57      {
58          return _facesContext.getApplication();
59      }
60  
61      public Iterator getClientIdsWithMessages()
62      {
63          return _facesContext.getClientIdsWithMessages();
64      }
65  
66      public ExternalContext getExternalContext()
67      {
68          return _facesContext.getExternalContext();
69      }
70  
71      public Severity getMaximumSeverity()
72      {
73          return _facesContext.getMaximumSeverity();
74      }
75  
76      public Iterator getMessages()
77      {
78          return _facesContext.getMessages();
79      }
80  
81      public Iterator getMessages(String clientId)
82      {
83          return _facesContext.getMessages(clientId);
84      }
85  
86      public RenderKit getRenderKit()
87      {
88          return _facesContext.getRenderKit();
89      }
90  
91      public boolean getRenderResponse()
92      {
93          return _facesContext.getRenderResponse();
94      }
95  
96      public boolean getResponseComplete()
97      {
98          return _facesContext.getResponseComplete();
99      }
100 
101     public void setResponseStream(ResponseStream responsestream)
102     {
103         _facesContext.setResponseStream(responsestream);
104     }
105 
106     public ResponseStream getResponseStream()
107     {
108         return _facesContext.getResponseStream();
109     }
110 
111     public void setResponseWriter(ResponseWriter responsewriter)
112     {
113         _facesContext.setResponseWriter(responsewriter);
114     }
115 
116     public ResponseWriter getResponseWriter()
117     {
118         return _facesContext.getResponseWriter();
119     }
120 
121     public void setViewRoot(UIViewRoot viewRoot)
122     {
123         _facesContext.setViewRoot(viewRoot);
124     }
125 
126     public UIViewRoot getViewRoot()
127     {
128         return _facesContext.getViewRoot();
129     }
130 
131     public void addMessage(String clientId, FacesMessage message)
132     {
133         _facesContext.addMessage(clientId, message);
134     }
135 
136     public void release()
137     {
138         _facesContext.release();
139     }
140 
141     public void renderResponse()
142     {
143         _facesContext.renderResponse();
144     }
145 
146     public void responseComplete()
147     {
148         _facesContext.responseComplete();
149     }
150     
151     public ELContext getELContext()
152     {
153         return _facesContext.getELContext();
154     }
155 }