myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r813775 - in /myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations: ApplicationProxy.java RenderkitProxy.java
Date Fri, 11 Sep 2009 10:56:10 GMT
Author: werpu
Date: Fri Sep 11 10:56:09 2009
New Revision: 813775

URL: http://svn.apache.org/viewvc?rev=813775&view=rev
Log:
http://issues.apache.org/jira/browse/EXTSCRIPT-1

portlet enabling code thanks to the jsf2 indirection


Modified:
    myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
    myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java

Modified: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=813775&r1=813774&r2=813775&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
(original)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
Fri Sep 11 10:56:09 2009
@@ -491,6 +491,10 @@
         weaveDelegate();
         ResourceHandler retVal = _delegate.getResourceHandler();
         if (ProxyUtils.isDynamic(retVal.getClass())) {
+            //we use a proxy here to limit the reloads to some central
+            //points which have a lower calling frequency which is high enough
+            //to get it reloaded upon every request, but which should not drag
+            //down the entire system speedwise
             retVal = (ResourceHandler) new ResourceHandlerProxy(retVal);
             setResourceHandler(retVal);
         }

Modified: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java?rev=813775&r1=813774&r2=813775&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
(original)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/RenderkitProxy.java
Fri Sep 11 10:56:09 2009
@@ -32,6 +32,7 @@
 import java.io.Writer;
 import java.io.OutputStream;
 import java.util.Iterator;
+import java.util.Map;
 import javax.servlet.ServletRequest;
 
 /**
@@ -44,16 +45,15 @@
 public class RenderkitProxy extends RenderKit implements Decorated {
 
 
-
     private void weaveDelegate() {
         _delegate = (RenderKit) ProxyUtils.getWeaver().reloadScriptingInstance(_delegate);
     }
 
     private boolean alreadyWovenInRequest(String clazz) {
-        //todo also enable portlets here
-       ServletRequest req = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
-        if(req.getAttribute(ScriptingConst.SCRIPTING_REQUSINGLETON+clazz) == null) {
-            req.setAttribute(ScriptingConst.SCRIPTING_REQUSINGLETON+clazz,"");
+        //portlets now can be enabled thanks to the jsf2 indirections regarding the external
context
+        Map<String, Object> req = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+        if (req.get(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz) == null) {
+            req.put(ScriptingConst.SCRIPTING_REQUSINGLETON + clazz, "");
             return false;
         }
         return true;
@@ -68,7 +68,7 @@
 
     public void addRenderer(String s, String s1, Renderer renderer) {
         weaveDelegate();
-        if(ProxyUtils.isDynamic(renderer.getClass()) && !alreadyWovenInRequest(renderer.toString()))
{
+        if (ProxyUtils.isDynamic(renderer.getClass()) && !alreadyWovenInRequest(renderer.toString()))
{
             renderer = (Renderer) ProxyUtils.getWeaver().reloadScriptingInstance(renderer);
             alreadyWovenInRequest(renderer.toString());
         }
@@ -80,10 +80,10 @@
         weaveDelegate();
         Renderer retVal = _delegate.getRenderer(s, s1);
 
-        if (retVal != null && ProxyUtils.isDynamic(retVal.getClass())&& !alreadyWovenInRequest(retVal.toString()))
{
+        if (retVal != null && ProxyUtils.isDynamic(retVal.getClass()) &&
!alreadyWovenInRequest(retVal.toString())) {
             retVal = (Renderer) ProxyUtils.getWeaver().reloadScriptingInstance(retVal);
             alreadyWovenInRequest(retVal.toString());
-            _delegate.addRenderer(s,s1,retVal);
+            _delegate.addRenderer(s, s1, retVal);
         }
         return retVal;
     }



Mime
View raw message