You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sl...@apache.org on 2009/01/08 00:54:31 UTC

svn commit: r732562 - in /myfaces/core/branches/2_0_0: api/src/main/java/javax/faces/context/FacesContext.java api/src/main/java/javax/faces/context/PartialViewContext.java impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java

Author: slessard
Date: Wed Jan  7 15:54:31 2009
New Revision: 732562

URL: http://svn.apache.org/viewvc?rev=732562&view=rev
Log:
MYFACES-2083 - FacesContext contains several unnecessary methods

Applied the provided patch more or less as provided, but also reflected the changes in the impl class. Still missing impl for two methods in FacesContextImpl.java

Added:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/PartialViewContext.java
Modified:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java
    myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java?rev=732562&r1=732561&r2=732562&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java Wed Jan  7 15:54:31 2009
@@ -32,39 +32,32 @@
 
 /**
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
- *
+ * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 public abstract class FacesContext
 {
-    public static final String NO_PARTIAL_PHASE_CLIENT_IDS = "none";
-    public static final String PARTIAL_EXECUTE_PARAM_NAME = "javax.faces.partial.execute";
-    public static final String PARTIAL_RENDER_PARAM_NAME = "javax.faces.partial.render";
 
     /**
      * Return the context within which all EL-expressions are evaluated.
      * <p>
-     * A JSF implementation is expected to provide a full implementation of this
-     * class. However JSF also explicitly allows user code to apply the "decorator"
-     * pattern to this type, by overriding the FacesContextFactory class. In that
-     * pattern, the decorating class has a reference to an "underlying" implementation
-     * and forward calls to it, possibly after taking other related actions.
+     * A JSF implementation is expected to provide a full implementation of this class. However JSF also explicitly
+     * allows user code to apply the "decorator" pattern to this type, by overriding the FacesContextFactory class. In
+     * that pattern, the decorating class has a reference to an "underlying" implementation and forward calls to it,
+     * possibly after taking other related actions.
      * <p>
-     * The decorator pattern does have difficulties with backwards-compatibility when
-     * new methods are added to the class being decorated, as with this method which
-     * was added in JSF1.2. Decorator classes that were written for JSF1.1 will subclass
-     * this class, but will not override this method to pass the call on to the 
-     * "underlying" instance. This base implementation therefore must do that for it.
+     * The decorator pattern does have difficulties with backwards-compatibility when new methods are added to the class
+     * being decorated, as with this method which was added in JSF1.2. Decorator classes that were written for JSF1.1
+     * will subclass this class, but will not override this method to pass the call on to the "underlying" instance.
+     * This base implementation therefore must do that for it.
      * <p>
-     * Unfortunately the JSF designers stuffed up the design; this base class has no way
-     * of knowing what the "underlying" instance is! The current implementation here
-     * is therefore to delegate directly to the very <i>first</i> FacesContext instance
-     * registered within this request (via setCurrentInstance). This instance should
-     * be the "full" implementation provided by the JSF framework. The drawback is that
-     * when any decorator class is present which defaults to this base implementation,
-     * then any following decorator instances that do override this method do not get
-     * it invoked.
+     * Unfortunately the JSF designers stuffed up the design; this base class has no way of knowing what the
+     * "underlying" instance is! The current implementation here is therefore to delegate directly to the very
+     * <i>first</i> FacesContext instance registered within this request (via setCurrentInstance). This instance should
+     * be the "full" implementation provided by the JSF framework. The drawback is that when any decorator class is
+     * present which defaults to this base implementation, then any following decorator instances that do override this
+     * method do not get it invoked.
      * <p>
      * It is believed that the Sun JSF implementation (Mojarra) does something similar.
      * 
@@ -80,15 +73,14 @@
         // also occurs.
         //
         // As noted above, we really want to do something like
-        //   ctx = getWrappedInstance();
-        // where the subclass can return the object it is delegating to. 
+        // ctx = getWrappedInstance();
+        // where the subclass can return the object it is delegating to.
         // As there is no such method, however, the best we can do is pass the
         // method call on to the first-registered FacesContext instance. That
         // instance will never be "this", as the real original FacesContext
         // object will provide a proper implementation of this method.
         FacesContext ctx = _firstInstance.get();
-        
-        
+
         if (ctx == null)
         {
             throw new NullPointerException(FacesContext.class.getName());
@@ -103,15 +95,10 @@
 
         return elctx;
     }
-    
-    public void enableResponseWriting(boolean enable)
-    {
-        //do nothing per default we switch in the derived classes!
-    }
-    
+
     public abstract Application getApplication();
 
-    public Map<Object,Object> getAttributes()
+    public Map<Object, Object> getAttributes()
     {
         // TODO: JSF 2.0 #32
         // VALIDATE: Should this be asbtract or throws UnsupportedOperationException? Check with the EG
@@ -119,17 +106,11 @@
     }
 
     public abstract Iterator<String> getClientIdsWithMessages();
-    
+
     public PhaseId getCurrentPhaseId()
     {
         throw new UnsupportedOperationException();
     }
-    
-    public List<String> getExecutePhaseClientIds()
-    {
-        // TODO: JSF 2.0 #49
-        return null;
-    }
 
     public abstract ExternalContext getExternalContext();
 
@@ -138,48 +119,24 @@
     public abstract Iterator<FacesMessage> getMessages();
 
     public abstract Iterator<FacesMessage> getMessages(String clientId);
-    
-    public ResponseWriter getPartialResponseWriter()
+
+    public List<FacesMessage> getMessageList()
     {
-        // TODO: JSF 2.0 #58
-        return null;
+        throw new UnsupportedOperationException();
+    }
+
+    public List<FacesMessage> getMessageList(String clientId)
+    {
+        throw new UnsupportedOperationException();
     }
 
     public abstract RenderKit getRenderKit();
 
     public abstract boolean getRenderResponse();
-    
-    public List<String> getRenderPhaseClientIds()
-    {
-        //according to the spec the getRenderPhaseClientIds
-        //always at least must return an empty list
-        //according to the specs isRenderAll must
-        //check for an empty list as result of
-        //the call on this method
-        //the null value is not stated!
-        
-        // TODO: JSF 2.0 #59
-        return (List<String>) Collections.EMPTY_LIST;
-    }
 
     public abstract boolean getResponseComplete();
 
     public abstract ResponseStream getResponseStream();
-    
-    public void setExecutePhaseClientIds(List<String> executePhaseClientIds)
-    {
-        // TODO: JSF 2.0 #50
-    }
-    
-    public void setRenderAll(boolean renderAll)
-    {
-        // TODO: JSF 2.0 #55
-    }
-    
-    public void setRenderPhaseClientIds(List<String> renderPhaseClientIds)
-    {
-        // TODO: JSF 2.0 #56
-    }
 
     public abstract void setResponseStream(ResponseStream responseStream);
 
@@ -188,46 +145,22 @@
     public abstract void setResponseWriter(ResponseWriter responseWriter);
 
     public abstract UIViewRoot getViewRoot();
-    
-    public boolean isAjaxRequest()
-    {
-        // TODO: JSF 2.0 #51
-        return false;
-    }
-    
-    public boolean isExecuteNone()
-    {
-        // TODO: JSF 2.0 #52
-        return false;
-    }
-    
+
     public boolean isPostback()
     {
         throw new UnsupportedOperationException();
     }
-    
-    public boolean isRenderAll()
-    {
-        // TODO: JSF 2.0 #53
-        return false;
-    }
-    
-    public boolean isRenderNone()
-    {
-        // TODO: JSF 2.0 #54
-        return false;
-    }
-    
+
     public ExceptionHandler getExceptionHandler()
     {
         throw new UnsupportedOperationException();
     }
-    
+
     public void setExceptionHandler(ExceptionHandler exceptionHandler)
     {
         throw new UnsupportedOperationException();
     }
-    
+
     public void setCurrentPhaseId(PhaseId currentPhaseId)
     {
         throw new UnsupportedOperationException();
@@ -262,11 +195,28 @@
         else
         {
             _currentInstance.set(context);
-            
+
             if (_firstInstance.get() == null)
             {
                 _firstInstance.set(context);
             }
         }
     }
+
+    /**
+     * <p>
+     * Return the PartialViewContext for this request. The PartialViewContext is used to control the processing of
+     * specified components during the execute portion of the request processing lifecycle (known as partial processing)
+     * and the rendering of specified components (known as partial rendering). This method must return a new
+     * PartialViewContext if one does not already exist.
+     * </p>
+     * 
+     * @return The PartialViewContext
+     * @throws IllegalStateException
+     *             if this method is called after this instance has been released
+     */
+    public PartialViewContext getPartialViewContext()
+    {
+        throw new UnsupportedOperationException();
+    }
 }

Added: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/PartialViewContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/PartialViewContext.java?rev=732562&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/PartialViewContext.java (added)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/PartialViewContext.java Wed Jan  7 15:54:31 2009
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.context;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Simon Lessard (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2009-01-07 18:36:53 -0400 (mer., 17 sept. 2008) $
+ *
+ * @since 2.0
+ */
+public abstract class PartialViewContext
+{
+    public static final String NO_PARTIAL_PHASE_CLIENT_IDS = "none";
+    public static final String PARTIAL_EXECUTE_PARAM_NAME = "javax.faces.partial.execute";
+    public static final String PARTIAL_RENDER_PARAM_NAME = "javax.faces.partial.render";
+    
+    public abstract void enableResponseWriting(boolean enable);
+    
+    public abstract Map<Object,Object> getAttributes();
+    
+    public abstract List<String> getExecutePhaseClientIds();
+    
+    public abstract ResponseWriter getPartialResponseWriter();
+    
+    public abstract List<String> getRenderPhaseClientIds();
+    
+    public abstract boolean isAjaxRequest();
+    
+    public abstract boolean isExecuteNone();
+    
+    public abstract boolean isRenderAll();
+    
+    public abstract boolean isRenderNone();
+    
+    public abstract void release();
+    
+    public abstract void setExecutePhaseClientIds(List<String> executePhaseClientIds);
+    
+    public abstract void setRenderAll(boolean renderAll);
+    
+    public abstract void setRenderPhaseClientIds(List<String> renderPhaseClientIds);
+}

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java?rev=732562&r1=732561&r2=732562&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java Wed Jan  7 15:54:31 2009
@@ -42,6 +42,7 @@
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
 import javax.faces.context.ResponseStream;
 import javax.faces.context.ResponseWriter;
 import javax.faces.event.PhaseId;
@@ -62,7 +63,8 @@
  * @author Anton Koinov
  * @version $Revision$ $Date$
  */
-public class FacesContextImpl extends FacesContext {
+public class FacesContextImpl extends FacesContext
+{
 
     public static final String METHOD_ISAJAXREQUEST = "isAjaxRequest";
     private static final String METHOD_ADDMESSAGE = "addMessage";
@@ -121,50 +123,59 @@
     private List<String> _executePhaseClientIds = null;
     private Boolean _renderAll = null;
 
-    /*helper to speed things up on the isAjaxRequest method*/
+    /* helper to speed things up on the isAjaxRequest method */
     private Boolean _ajaxRequest = null;
 
     // ~ Constructors -------------------------------------------------------------------------------
     public FacesContextImpl(final ServletContext servletContext, final ServletRequest servletRequest,
-            final ServletResponse servletResponse) {
-        try {
-            //we wrap the servlet response to get our switching behavior!
+                            final ServletResponse servletResponse)
+    {
+        try
+        {
+            // we wrap the servlet response to get our switching behavior!
             _responseWrapper = new ResponseSwitch(servletResponse);
             init(new ServletExternalContextImpl(servletContext, servletRequest, _responseWrapper));
-        } catch (IOException ex) {
+        }
+        catch (IOException ex)
+        {
             Log log = LogFactory.getLog(this.getClass());
             log.fatal("Could not obtain the response writers! Detail:" + ex.toString());
         }
     }
 
-    private void init(final ReleaseableExternalContext externalContext) {
-        _application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).getApplication();
+    private void init(final ReleaseableExternalContext externalContext)
+    {
+        _application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY))
+                .getApplication();
         _renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
         _externalContext = externalContext;
         FacesContext.setCurrentInstance(this); // protected method, therefore must be called from here
     }
 
-
     // ~ Methods ------------------------------------------------------------------------------------
     @Override
-    public final ExternalContext getExternalContext() {
+    public final ExternalContext getExternalContext()
+    {
         assertNotReleased(METHOD_GETEXTERNALCONTEXT);
 
         return (ExternalContext) _externalContext;
     }
 
     @Override
-    public final FacesMessage.Severity getMaximumSeverity() {
+    public final FacesMessage.Severity getMaximumSeverity()
+    {
         assertNotReleased(METHOD_GETMAXIMUMSEVERITY);
 
         return _maximumSeverity;
     }
 
     @Override
-    public final Iterator<FacesMessage> getMessages() {
+    public final Iterator<FacesMessage> getMessages()
+    {
         assertNotReleased(METHOD_GETMESSAGES);
 
-        if (_messages == null) {
+        if (_messages == null)
+        {
             return NullIterator.instance();
         }
 
@@ -172,17 +183,20 @@
     }
 
     @Override
-    public final Application getApplication() {
+    public final Application getApplication()
+    {
         assertNotReleased(METHOD_GETAPPLICATION);
 
         return _application;
     }
 
     @Override
-    public final Iterator<String> getClientIdsWithMessages() {
+    public final Iterator<String> getClientIdsWithMessages()
+    {
         assertNotReleased(METHOD_GETCLIENTIDSWITHMESSAGES);
 
-        if (_messages == null || _messages.isEmpty()) {
+        if (_messages == null || _messages.isEmpty())
+        {
             return NullIterator.instance();
         }
 
@@ -192,30 +206,39 @@
     }
 
     @Override
-    public PhaseId getCurrentPhaseId() {
+    public PhaseId getCurrentPhaseId()
+    {
         assertNotReleased(METHOD_GETCURRENTPHASEID);
 
         return _currentPhaseId;
     }
 
     @Override
-    public final Iterator<FacesMessage> getMessages(final String clientId) {
+    public final Iterator<FacesMessage> getMessages(final String clientId)
+    {
 
         assertNotReleased(METHOD_GETMESSAGES);
 
-        if (_messages == null) {
+        if (_messages == null)
+        {
             return NullIterator.instance();
         }
 
         List<FacesMessage> lst = new ArrayList<FacesMessage>();
-        for (int i = 0; i < _messages.size(); i++) {
+        for (int i = 0; i < _messages.size(); i++)
+        {
             Object savedClientId = _messageClientIds.get(i);
-            if (clientId == null) {
-                if (savedClientId == null) {
+            if (clientId == null)
+            {
+                if (savedClientId == null)
+                {
                     lst.add(_messages.get(i));
                 }
-            } else {
-                if (clientId.equals(savedClientId)) {
+            }
+            else
+            {
+                if (clientId.equals(savedClientId))
+                {
                     lst.add(_messages.get(i));
                 }
             }
@@ -223,18 +246,28 @@
 
         return lst.iterator();
     }
+    
+    @Override
+    public PartialViewContext getPartialViewContext()
+    {
+        // TODO: JSF 2.0
+        return null;
+    }
 
     @Override
-    public final RenderKit getRenderKit() {
+    public final RenderKit getRenderKit()
+    {
         assertNotReleased(METHOD_GETRENDERKIT);
 
-        if (getViewRoot() == null) {
+        if (getViewRoot() == null)
+        {
             return null;
         }
 
         String renderKitId = getViewRoot().getRenderKitId();
 
-        if (renderKitId == null) {
+        if (renderKitId == null)
+        {
             return null;
         }
 
@@ -242,112 +275,130 @@
     }
 
     @Override
-    public final boolean getRenderResponse() {
+    public final boolean getRenderResponse()
+    {
         assertNotReleased(METHOD_GETRESPONSECOMPLETE);
 
         return _renderResponse;
     }
 
     @Override
-    public final boolean getResponseComplete() {
+    public final boolean getResponseComplete()
+    {
         assertNotReleased(METHOD_GETRESPONSECOMPLETE);
 
         return _responseComplete;
     }
 
     @Override
-    public final void setResponseStream(final ResponseStream responseStream) {
+    public final void setResponseStream(final ResponseStream responseStream)
+    {
         assertNotReleased(METHOD_SETRESPONSESTREAM);
 
-        if (responseStream == null) {
+        if (responseStream == null)
+        {
             throw new NullPointerException("responseStream");
         }
         _responseStream = responseStream;
     }
 
     @Override
-    public final ResponseStream getResponseStream() {
+    public final ResponseStream getResponseStream()
+    {
         assertNotReleased(METHOD_GETRESPONSESTREAM);
 
         return _responseStream;
     }
 
     @Override
-    public final void setResponseWriter(final ResponseWriter responseWriter) {
+    public final void setResponseWriter(final ResponseWriter responseWriter)
+    {
         assertNotReleased(METHOD_SETRESPONSEWRITER);
 
-        if (responseWriter == null) {
+        if (responseWriter == null)
+        {
             throw new NullPointerException(METHOD_RESPONSEWRITER);
         }
         _responseWriter = responseWriter;
     }
 
     @Override
-    public final ResponseWriter getResponseWriter() {
+    public final ResponseWriter getResponseWriter()
+    {
         assertNotReleased(METHOD_GETRESPONSEWRITER);
 
         return _responseWriter;
     }
 
     @Override
-    public final void setViewRoot(final UIViewRoot viewRoot) {
+    public final void setViewRoot(final UIViewRoot viewRoot)
+    {
         assertNotReleased(METHOD_SETVIEWROOT);
 
-        if (viewRoot == null) {
+        if (viewRoot == null)
+        {
             throw new NullPointerException("viewRoot");
         }
         _viewRoot = viewRoot;
     }
 
     @Override
-    public final UIViewRoot getViewRoot() {
+    public final UIViewRoot getViewRoot()
+    {
         assertNotReleased(METHOD_GETVIEWROOT);
 
         return _viewRoot;
     }
 
     @Override
-    public final void addMessage(final String clientId, final FacesMessage message) {
+    public final void addMessage(final String clientId, final FacesMessage message)
+    {
         assertNotReleased(METHOD_ADDMESSAGE);
 
-        if (message == null) {
+        if (message == null)
+        {
             throw new NullPointerException("message");
         }
 
-        if (_messages == null) {
+        if (_messages == null)
+        {
             _messages = new ArrayList<FacesMessage>();
             _messageClientIds = new ArrayList<String>();
         }
         _messages.add(message);
         _messageClientIds.add((clientId != null) ? clientId : null);
         FacesMessage.Severity serSeverity = message.getSeverity();
-        if (serSeverity != null) {
-            if (_maximumSeverity == null) {
+        if (serSeverity != null)
+        {
+            if (_maximumSeverity == null)
+            {
                 _maximumSeverity = serSeverity;
-            } else if (serSeverity.compareTo(_maximumSeverity) > 0) {
+            }
+            else if (serSeverity.compareTo(_maximumSeverity) > 0)
+            {
                 _maximumSeverity = serSeverity;
             }
         }
     }
 
     @Override
-    public final void release() {
+    public final void release()
+    {
         assertNotReleased(METHOD_RELEASE);
 
-        if (_externalContext != null) {
+        if (_externalContext != null)
+        {
             _externalContext.release();
             _externalContext = null;
         }
 
         /*
-         * Spec JSF 2 section getAttributes
-         * when release is called the attributes map
-         * must!!! be cleared!
-         *
-         * (probably to trigger some clearance methods
-         * on possible added entries before nullifying everything)
+         * Spec JSF 2 section getAttributes when release is called the attributes map must!!! be cleared!
+         * 
+         * (probably to trigger some clearance methods on possible added entries before nullifying everything)
          */
-        if (_attributes != null) {
+        if (_attributes != null)
+        {
             _attributes.clear();
             _attributes = null;
         }
@@ -359,34 +410,37 @@
         _responseWriter = null;
         _viewRoot = null;
 
-
         _released = true;
         FacesContext.setCurrentInstance(null);
     }
 
     @Override
-    public boolean isPostback() {
+    public boolean isPostback()
+    {
         assertNotReleased(METHOD_RENDERRESPONSE);
 
         return getRenderKit().getResponseStateManager().isPostback(this);
     }
 
     @Override
-    public final void renderResponse() {
+    public final void renderResponse()
+    {
         assertNotReleased(METHOD_RENDERRESPONSE);
 
         _renderResponse = true;
     }
 
     @Override
-    public final void responseComplete() {
+    public final void responseComplete()
+    {
         assertNotReleased(METHOD_RESPONSECOMPLETE);
 
         _responseComplete = true;
     }
 
     @Override
-    public void setCurrentPhaseId(PhaseId currentPhaseId) {
+    public void setCurrentPhaseId(PhaseId currentPhaseId)
+    {
         assertNotReleased(METHOD_SETCURRENTPHASEID);
 
         _currentPhaseId = currentPhaseId;
@@ -394,7 +448,8 @@
 
     // Portlet need to do this to change from ActionRequest/Response to
     // RenderRequest/Response
-    public final void setExternalContext(ReleaseableExternalContext extContext) {
+    public final void setExternalContext(ReleaseableExternalContext extContext)
+    {
         assertNotReleased(METHOD_SETEXTERNALCONTEXT);
 
         _externalContext = extContext;
@@ -402,17 +457,20 @@
     }
 
     @Override
-    public final ELContext getELContext() {
+    public final ELContext getELContext()
+    {
         assertNotReleased(METHOD_GETELCONTEXT);
 
-        if (_elContext != null) {
+        if (_elContext != null)
+        {
             return _elContext;
         }
 
         _elContext = new FacesELContext(getApplication().getELResolver(), this);
 
         ELContextEvent event = new ELContextEvent(_elContext);
-        for (ELContextListener listener : getApplication().getELContextListeners()) {
+        for (ELContextListener listener : getApplication().getELContextListeners())
+        {
             listener.contextCreated(event);
         }
 
@@ -420,289 +478,320 @@
     }
 
     /**
-     * Returns a mutable map of attributes associated
-     * with this faces context
-     * when {@link javax.faces.context.FacesContext.release} is called
-     * the map must be cleared!
-     *
-     * Note this map is not associated with the request map
-     * the request map still is accessible via the
-     * {@link javax.faces.context.FacesContext.getExternalContext.getRequestMap}
-     * method!
-     *
-     * Also the scope is different to the request map, this map has the scope
-     * of the context, and is cleared once the release method
-     * on the context is called!
-     *
+     * Returns a mutable map of attributes associated with this faces context when
+     * {@link javax.faces.context.FacesContext.release} is called the map must be cleared!
+     * 
+     * Note this map is not associated with the request map the request map still is accessible via the
+     * {@link javax.faces.context.FacesContext.getExternalContext.getRequestMap} method!
+     * 
+     * Also the scope is different to the request map, this map has the scope of the context, and is cleared once the
+     * release method on the context is called!
+     * 
      * Also the map does not cause any events according to the spec!
-     *
+     * 
      * @since JSF 2.0
-     *
-     * @throws IllegalStateException if the current context already is released!
+     * 
+     * @throws IllegalStateException
+     *             if the current context already is released!
      */
     @Override
-    public Map<Object, Object> getAttributes() {
+    public Map<Object, Object> getAttributes()
+    {
         assertNotReleased(METHOD_GETATTRIBUTES);
 
-        if (_attributes == null) {
+        if (_attributes == null)
+        {
             _attributes = new HashMap<Object, Object>();
         }
         return _attributes;
     }
 
     /**
-     * if set to false the response writing is suppressed
-     * this construct has been added to deal with
-     * subview lifecycles in the ajax cycle
-     *
-     * @param enable if set to true the response is routed through if set to false
-     * the response is suppressed!
-     *
-     * @throws IllegalStateException if the current context already is released!
-     */
-    @Override
-    public void enableResponseWriting(boolean enable) {
-        assertNotReleased(METHOD_ENABLERESPONSEWRITING);
-
-        _responseWrapper.setEnabled(enable);
-        super.enableResponseWriting(enable);
-    }
-
-    /**
-     * @return the list of client ids to be processed in the execute phase
-     * null if all have to be processed
-     * The client ids either must be set via the setter
-     * or being present by having a PARTIAL_EXECUTE_PARAM_NAME with a value set
-     * non existent or NO_PARTIAL_PHASE_CLIENT_IDS values in the request map
-     * and a non set local list result in an empty list as return value!
-     *
-     * @since 2.0
-     * @throws IllegalStateException if the current context already is released!
-     */
-    @Override
-    public List<String> getExecutePhaseClientIds() {
-        assertNotReleased(METHOD_GETEXECUTEPHASECLIENTIDS);
-
-        if (_executePhaseClientIds != null) {
-            return _executePhaseClientIds;
-        }
-
-        _executePhaseClientIds = getRequestParameterList(PARTIAL_EXECUTE_PARAM_NAME, NO_PARTIAL_PHASE_CLIENT_IDS);
-
-        return _executePhaseClientIds;
-    }
-
-    /**
-     *
-     * @return a list of client ids which are fetched
-     * from the request <b>parameter</b> map.
-     * The key for the map entries is {@link javax.faces.context.FacesContext.PARTIAL_RENDER_PARAM_NAME}.
-     * The list is a comma separated list of client ids in the request map!
-     * if the value {@link javax.faces.context.FacesContext.NO_PARTIAL_PHASE_CLIENT_IDS}
-     * is set or null or empty then an empty list is returned!
-     *
-     * The client ids are the ones which have to be processed during the render phase
-     *
-     * @since 2.0
-     * @throws IllegalStateException if the current context already is released!
-     */
-    @Override
-    public List<String> getRenderPhaseClientIds() {
-        assertNotReleased(METHOD_GETRENDERPHASECLIENTIDS);
-
-        /*already processed or set from the outside*/
-        if (null != _renderPhaseClientIds) {
-            return _renderPhaseClientIds;
-        }
-
-        _renderPhaseClientIds = getRequestParameterList(PARTIAL_RENDER_PARAM_NAME, NO_PARTIAL_PHASE_CLIENT_IDS);
-
-        return _renderPhaseClientIds;
-    }
-
-    /**
-     * private helper method to split incoming
-     * request parameter lists according to the JSF2 specs
-     * the JSF2 spec usually sees empty lists as either not being
-     * set (null), or empty == "" or with an optional special value
-     * being set marking it as empty!
+     * private helper method to split incoming request parameter lists according to the JSF2 specs the JSF2 spec usually
+     * sees empty lists as either not being set (null), or empty == "" or with an optional special value being set
+     * marking it as empty!
      * 
-     * @param key the request parameter key holding the list
-     * @param emptyValue the special empty value
+     * @param key
+     *            the request parameter key holding the list
+     * @param emptyValue
+     *            the special empty value
      * @return a list of strings or an empty list if nothing was found
      */
-    private final List<String> getRequestParameterList(String key, String emptyValue) {
+    private final List<String> getRequestParameterList(String key, String emptyValue)
+    {
 
         Map paramMap = ((ServletRequest) getExternalContext().getRequest()).getParameterMap();
         String clientIds = (String) paramMap.get(key);
-        if (clientIds == null) {//no value given
+        if (clientIds == null)
+        {// no value given
             return Collections.EMPTY_LIST;
         }
         clientIds = clientIds.trim();
-        if (clientIds.equals("") || (emptyValue != null && clientIds.equals(emptyValue))) {//empty String!
+        if (clientIds.equals("") || (emptyValue != null && clientIds.equals(emptyValue)))
+        {// empty String!
             return Collections.EMPTY_LIST;
         }
 
         /**
-         * we have to process the params list
-         * we now split the params as fast as possible
+         * we have to process the params list we now split the params as fast as possible
          */
         String[] splitted = clientIds.split(RE_SPLITTER);
-        /*we have to retrim the first and last entry we could
-        have pending blanks!*/
+        /*
+         * we have to retrim the first and last entry we could have pending blanks!
+         */
         splitted[0] = splitted[0].trim();
         int trimLast = splitted.length - 1;
-        if (trimLast > 0) {//all others trimmed by the re
+        if (trimLast > 0)
+        {// all others trimmed by the re
             splitted[trimLast] = splitted[trimLast].trim();
         }
         return Arrays.asList(splitted);
     }
 
     /**
-     * @param executePhaseClientIds the list of client ids
-     * to be processed by the execute phase
-     * 
-     * @since 2.0
-     * @throws IllegalStateException if the current context already is released!
+     * has to be thrown in many of the methods if the method is called after the instance has been released!
      */
-    @Override
-    public void setExecutePhaseClientIds(List<String> executePhaseClientIds) {
-        assertNotReleased(METHOD_SETEXECUTEPHASECLIENTIDS);
-
-        _executePhaseClientIds = executePhaseClientIds;
+    private final void assertNotReleased(String string)
+    {
+        if (_released)
+        {
+            StringBuilder errorMessage = new StringBuilder(128);
+            errorMessage.append("Error in method call on javax.faces.context.FacesContext.");
+            errorMessage.append(string);
+            errorMessage.append(", the facesContext is already released!");
+            throw new IllegalStateException(errorMessage.toString());
+        }
     }
+    
+    private class PartialViewContextImpl extends PartialViewContext
+    {
 
-    /**
-     * @param the list of client ids to be processed by the render
-     * phase!
-     * @since 2.0
-     * @throws IllegalStateException if the current context already is released!
-     */
-    @Override
-    public void setRenderPhaseClientIds(List<String> renderPhaseClientIds) {
-        assertNotReleased(METHOD_SETEXECUTEPHASECLIENTIDS);
+        /**
+         * if set to false the response writing is suppressed this construct has been added to deal with subview lifecycles
+         * in the ajax cycle
+         * 
+         * @param enable
+         *            if set to true the response is routed through if set to false the response is suppressed!
+         * 
+         * @throws IllegalStateException
+         *             if the current context already is released!
+         */
+        @Override
+        public void enableResponseWriting(boolean enable)
+        {
+            assertNotReleased(METHOD_ENABLERESPONSEWRITING);
+
+            _responseWrapper.setEnabled(enable);
+        }
 
-        _renderPhaseClientIds = renderPhaseClientIds;
-    }
+        @Override
+        public Map<Object, Object> getAttributes()
+        {
+            return FacesContextImpl.this.getAttributes();
+        }
 
-    /**
-     * TODO #51 in progress
-     * is ajax request implementation
-     * according to the spec, javax.faces.partial must be present
-     * and then it will return true
-     * if none is present it will return false
-     * since we only have to check it once
-     * a lazy init cannot be done because theoretically someone
-     * can push in a request wrapper!
-     *
-     */
-    @Override
-    public boolean isAjaxRequest() {
+        /**
+         * @return the list of client ids to be processed in the execute phase null if all have to be processed The client
+         *         ids either must be set via the setter or being present by having a PARTIAL_EXECUTE_PARAM_NAME with a
+         *         value set non existent or NO_PARTIAL_PHASE_CLIENT_IDS values in the request map and a non set local list
+         *         result in an empty list as return value!
+         * 
+         * @since 2.0
+         * @throws IllegalStateException
+         *             if the current context already is released!
+         */
+        @Override
+        public List<String> getExecutePhaseClientIds()
+        {
+            assertNotReleased(METHOD_GETEXECUTEPHASECLIENTIDS);
+
+            if (_executePhaseClientIds != null)
+            {
+                return _executePhaseClientIds;
+            }
 
-        assertNotReleased(METHOD_ISAJAXREQUEST);
+            _executePhaseClientIds = getRequestParameterList(PARTIAL_EXECUTE_PARAM_NAME, NO_PARTIAL_PHASE_CLIENT_IDS);
 
-        /*
-         * A speed shortcut here is feasable
-         * but it has to be discussed we have those
-         * in several parts of the facesContext and even most of them implicetly
-         * enforced by the spec itself. Hence i set it here.
-         *
-         *
-         * The problem is that request parameter maps can be
-         * delivered by RequestWrappers hence, you cannot rely
-         * on the map being entirely immutable.
-         * But leaving it out probably is also a no option since
-         * this method probably will be called by every component
-         * renderer and a O(log(n)) lookup is not a serious performance impact
-         * but serious enough!
-         *
-         * This has to be cleared up with the spec people!
-         * This should not cause a problem under normal circumstances
-         * however!
-         */
-        if (_ajaxRequest == null) {
-            Map requestParamMap = getExternalContext().getRequestParameterMap();
-            _ajaxRequest = requestParamMap.containsKey(AJAX_REQ_KEY);
+            return _executePhaseClientIds;
         }
-        return _ajaxRequest;
-    }
 
-    /**
-     * @return is render none return true if {@link #PARTIAL_EXECUTE_PARAM_NAME} is set in the current request
-     * map!
-     * and the value is set to {@link #NO_PARTIAL_PHASE_CLIENT_IDS}. Otherwise return false!
-     */
-    @Override
-    public boolean isExecuteNone() {
-        assertNotReleased(METHOD_ISEXECUTENONE);
+        @Override
+        public ResponseWriter getPartialResponseWriter()
+        {
+            // TODO: JSF 2.0, missing impl
+            return null;
+        }
 
-        Map requestMap = getExternalContext().getRequestParameterMap();
-        String param = (String) requestMap.get(PARTIAL_EXECUTE_PARAM_NAME);
-        return NO_PARTIAL_PHASE_CLIENT_IDS.equals(param);
-    }
+        /**
+         * 
+         * @return a list of client ids which are fetched from the request <b>parameter</b> map. The key for the map entries
+         *         is {@link javax.faces.context.FacesContext.PARTIAL_RENDER_PARAM_NAME}. The list is a comma separated list
+         *         of client ids in the request map! if the value
+         *         {@link javax.faces.context.FacesContext.NO_PARTIAL_PHASE_CLIENT_IDS} is set or null or empty then an
+         *         empty list is returned!
+         * 
+         *         The client ids are the ones which have to be processed during the render phase
+         * 
+         * @since 2.0
+         * @throws IllegalStateException
+         *             if the current context already is released!
+         */
+        @Override
+        public List<String> getRenderPhaseClientIds()
+        {
+            assertNotReleased(METHOD_GETRENDERPHASECLIENTIDS);
+
+            /* already processed or set from the outside */
+            if (null != _renderPhaseClientIds)
+            {
+                return _renderPhaseClientIds;
+            }
 
-    /**
-     * @return true in case of PARTIAL_RENDER_PARAM_NAME being set and its value is
-     * NO_PARTIAL_PHASE_CLIENT_IDS. Otherwise return false
-     */
-    @Override
-    public boolean isRenderNone() {
-        assertNotReleased(METHOD_ISRENDERNONE);
+            _renderPhaseClientIds = getRequestParameterList(PARTIAL_RENDER_PARAM_NAME, NO_PARTIAL_PHASE_CLIENT_IDS);
 
-        Map requestMap = getExternalContext().getRequestParameterMap();
-        String param = (String) requestMap.get(PARTIAL_RENDER_PARAM_NAME);
-        return NO_PARTIAL_PHASE_CLIENT_IDS.equals(param);
-    }
+            return _renderPhaseClientIds;
+        }
 
-    /**
-     * @return true in case of {@link javax.faces.context.FacesContext.isAjaxRequest()} returns true,
-     *  {@link javax.faces.context.FacesContext.isRenderNone()} returns false and
-     *  {@link javax.faces.context.FacesContext.getRenderPhaseClientIds()} returns also
-     * an empty list
-     */
-    @Override
-    public boolean isRenderAll() {
-        assertNotReleased(METHOD_ISRENDERALL);
+        /**
+         * TODO #51 in progress is ajax request implementation according to the spec, javax.faces.partial must be present
+         * and then it will return true if none is present it will return false since we only have to check it once a lazy
+         * init cannot be done because theoretically someone can push in a request wrapper!
+         * 
+         */
+        @Override
+        public boolean isAjaxRequest()
+        {
+
+            assertNotReleased(METHOD_ISAJAXREQUEST);
+
+            /*
+             * A speed shortcut here is feasable but it has to be discussed we have those in several parts of the
+             * facesContext and even most of them implicetly enforced by the spec itself. Hence i set it here.
+             * 
+             * 
+             * The problem is that request parameter maps can be delivered by RequestWrappers hence, you cannot rely on the
+             * map being entirely immutable. But leaving it out probably is also a no option since this method probably will
+             * be called by every component renderer and a O(log(n)) lookup is not a serious performance impact but serious
+             * enough!
+             * 
+             * This has to be cleared up with the spec people! This should not cause a problem under normal circumstances
+             * however!
+             */
+            if (_ajaxRequest == null)
+            {
+                Map<String, String> requestParamMap = getExternalContext().getRequestParameterMap();
+                _ajaxRequest = requestParamMap.containsKey(AJAX_REQ_KEY);
+            }
+            
+            return _ajaxRequest;
+        }
+
+        /**
+         * @return is render none return true if {@link #PARTIAL_EXECUTE_PARAM_NAME} is set in the current request map! and
+         *         the value is set to {@link #NO_PARTIAL_PHASE_CLIENT_IDS}. Otherwise return false!
+         */
+        @Override
+        public boolean isExecuteNone()
+        {
+            assertNotReleased(METHOD_ISEXECUTENONE);
+
+            Map<String, String> requestMap = getExternalContext().getRequestParameterMap();
+            
+            String param = (String) requestMap.get(PARTIAL_EXECUTE_PARAM_NAME);
+            
+            return NO_PARTIAL_PHASE_CLIENT_IDS.equals(param);
+        }
+
+        /**
+         * @return true in case of PARTIAL_RENDER_PARAM_NAME being set and its value is NO_PARTIAL_PHASE_CLIENT_IDS.
+         *         Otherwise return false
+         */
+        @Override
+        public boolean isRenderNone()
+        {
+            assertNotReleased(METHOD_ISRENDERNONE);
+
+            Map<String, String> requestMap = getExternalContext().getRequestParameterMap();
+            
+            String param = (String) requestMap.get(PARTIAL_RENDER_PARAM_NAME);
+            
+            return NO_PARTIAL_PHASE_CLIENT_IDS.equals(param);
+        }
 
-        if (_renderAll != null) {
+        /**
+         * @return true in case of {@link javax.faces.context.FacesContext.isAjaxRequest()} returns true, {@link
+         *         javax.faces.context.FacesContext.isRenderNone()} returns false and {@link
+         *         javax.faces.context.FacesContext.getRenderPhaseClientIds()} returns also an empty list
+         */
+        @Override
+        public boolean isRenderAll()
+        {
+            assertNotReleased(METHOD_ISRENDERALL);
+
+            if (_renderAll != null)
+            {
+                return _renderAll;
+            }
+            // I assume doing the check once per request is correct
+            // there is no way to determine if there was an override
+            // of the renderAll according to the spec!
+            List<String> renderClientIds = getRenderPhaseClientIds();
+            
+            _renderAll = renderClientIds.isEmpty() && isAjaxRequest() && !isRenderNone();
+            
             return _renderAll;
         }
-        //I assume doing the check once per request is correct
-        //there is no way to determine if there was an override
-        //of the renderAll according to the spec!
-        List renderClientIds = getRenderPhaseClientIds();
-        _renderAll = renderClientIds.isEmpty() && isAjaxRequest() && !isRenderNone();
-        return _renderAll;
-    }
 
-    /**
-     * override for the isRenderall determination mechanism
-     * if set to true the isRenderAll() must! return
-     * true!
-     * If nothing is set the isRenderall() does a fallback into
-     * its renderall determination algorithm!
-     * 
-     * @param renderAll if set to true isRenderAll() will return
-     * true on the subsequent calls in the request!
-     */
-    @Override
-    public void setRenderAll(boolean renderAll) {
-        assertNotReleased(METHOD_SETRENDERALL);
+        @Override
+        public void release()
+        {
+            FacesContextImpl.this.release();
+        }
 
-        _renderAll = renderAll;//autoboxing does the conversation here, no need to do casting
-    }
+        /**
+         * @param executePhaseClientIds
+         *            the list of client ids to be processed by the execute phase
+         * 
+         * @since 2.0
+         * @throws IllegalStateException
+         *             if the current context already is released!
+         */
+        @Override
+        public void setExecutePhaseClientIds(List<String> executePhaseClientIds)
+        {
+            assertNotReleased(METHOD_SETEXECUTEPHASECLIENTIDS);
 
-    /**
-     * has to be thrown in many of the methods
-     * if the method is called after the instance has been released!
-     */
-    private final void assertNotReleased(String string) {
-        if (_released) {
-            StringBuilder errorMessage = new StringBuilder(128);
-            errorMessage.append("Error in method call on javax.faces.context.FacesContext.");
-            errorMessage.append(string);
-            errorMessage.append(", the facesContext is already released!");
-            throw new IllegalStateException(errorMessage.toString());
+            _executePhaseClientIds = executePhaseClientIds;
+        }
+
+        /**
+         * override for the isRenderall determination mechanism if set to true the isRenderAll() must! return true! If
+         * nothing is set the isRenderall() does a fallback into its renderall determination algorithm!
+         * 
+         * @param renderAll
+         *            if set to true isRenderAll() will return true on the subsequent calls in the request!
+         */
+        @Override
+        public void setRenderAll(boolean renderAll)
+        {
+            assertNotReleased(METHOD_SETRENDERALL);
+
+            _renderAll = renderAll;// autoboxing does the conversation here, no need to do casting
+        }
+
+        /**
+         * @param the
+         *            list of client ids to be processed by the render phase!
+         * @since 2.0
+         * @throws IllegalStateException
+         *             if the current context already is released!
+         */
+        @Override
+        public void setRenderPhaseClientIds(List<String> renderPhaseClientIds)
+        {
+            assertNotReleased(METHOD_SETEXECUTEPHASECLIENTIDS);
+
+            _renderPhaseClientIds = renderPhaseClientIds;
         }
     }
 }