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.custom.redirectTracker;
20  
21  import javax.faces.context.FacesContext;
22  import javax.faces.context.ExternalContext;
23  import javax.faces.context.ResponseStream;
24  import javax.faces.context.ResponseWriter;
25  import javax.faces.application.Application;
26  import javax.faces.application.FacesMessage;
27  import javax.faces.render.RenderKit;
28  import javax.faces.component.UIViewRoot;
29  import java.util.Iterator;
30  
31  /**
32   * Convenient class to wrap the current FacesContext.
33   * @author Manfred Geiler (latest modification by $Author: skitching $)
34   * @author Anton Koinov
35   * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (Thu, 03 Jul 2008) $
36   */
37  public class FacesContextWrapper
38      extends FacesContext
39  {
40      //~ Instance fields ----------------------------------------------------------------------------
41  
42      private FacesContext _facesContext;
43  
44      //~ Constructors -------------------------------------------------------------------------------
45  
46      public FacesContextWrapper(FacesContext facesContext)
47      {
48          _facesContext = facesContext;
49      }
50  
51      //~ Methods ------------------------------------------------------------------------------------
52  
53      public Application getApplication()
54      {
55          return _facesContext.getApplication();
56      }
57  
58      public Iterator getClientIdsWithMessages()
59      {
60          return _facesContext.getClientIdsWithMessages();
61      }
62  
63      public ExternalContext getExternalContext()
64      {
65          return _facesContext.getExternalContext();
66      }
67  
68      public FacesMessage.Severity getMaximumSeverity()
69      {
70          return _facesContext.getMaximumSeverity();
71      }
72  
73      public Iterator getMessages()
74      {
75          return _facesContext.getMessages();
76      }
77  
78      public Iterator getMessages(String clientId)
79      {
80          return _facesContext.getMessages(clientId);
81      }
82  
83      public RenderKit getRenderKit()
84      {
85          return _facesContext.getRenderKit();
86      }
87  
88      public boolean getRenderResponse()
89      {
90          return _facesContext.getRenderResponse();
91      }
92  
93      public boolean getResponseComplete()
94      {
95          return _facesContext.getResponseComplete();
96      }
97  
98      public void setResponseStream(ResponseStream responsestream)
99      {
100         _facesContext.setResponseStream(responsestream);
101     }
102 
103     public ResponseStream getResponseStream()
104     {
105         return _facesContext.getResponseStream();
106     }
107 
108     public void setResponseWriter(ResponseWriter responsewriter)
109     {
110         _facesContext.setResponseWriter(responsewriter);
111     }
112 
113     public ResponseWriter getResponseWriter()
114     {
115         return _facesContext.getResponseWriter();
116     }
117 
118     public void setViewRoot(UIViewRoot viewRoot)
119     {
120         _facesContext.setViewRoot(viewRoot);
121     }
122 
123     public UIViewRoot getViewRoot()
124     {
125         return _facesContext.getViewRoot();
126     }
127 
128     public void addMessage(String clientId, FacesMessage message)
129     {
130         _facesContext.addMessage(clientId, message);
131     }
132 
133     public void release()
134     {
135         _facesContext.release();
136     }
137 
138     public void renderResponse()
139     {
140         _facesContext.renderResponse();
141     }
142 
143     public void responseComplete()
144     {
145         _facesContext.responseComplete();
146     }
147 
148     public FacesContext getWrappedFacesContext()
149     {
150         return _facesContext;
151     }
152 }