You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/09/10 19:04:44 UTC
svn commit: r813515 - in
/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations:
ApplicationProxy.java ResourceHandlerProxy.java
Author: werpu
Date: Thu Sep 10 17:04:44 2009
New Revision: 813515
URL: http://svn.apache.org/viewvc?rev=813515&view=rev
Log:
http://issues.apache.org/jira/browse/EXTSCRIPT-1
adding artefact for the resource handler
Added:
myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java
Modified:
myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.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=813515&r1=813514&r2=813515&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 Thu Sep 10 17:04:44 2009
@@ -420,7 +420,14 @@
@Override
public Behavior createBehavior(String s) throws FacesException {
weaveDelegate();
- return _delegate.createBehavior(s);
+ Behavior retVal = _delegate.createBehavior(s);
+ //TODO check if this does not break our ClientSideBehavior
+ //instances, otherwise we have to do a bypass for f:ajax or do it
+ //directly via the weaver instead of using the automated proxy
+ if (ProxyUtils.isDynamic(retVal.getClass())) {
+ retVal = (Behavior) ProxyUtils.createMethodReloadingProxyFromObject(retVal, Behavior.class);
+ }
+ return retVal;
}
@Override
@@ -472,7 +479,12 @@
@Override
public ResourceHandler getResourceHandler() {
weaveDelegate();
- return _delegate.getResourceHandler();
+ ResourceHandler retVal = _delegate.getResourceHandler();
+ if (ProxyUtils.isDynamic(retVal.getClass())) {
+ retVal = (ResourceHandler) new ResourceHandlerProxy(retVal);
+ setResourceHandler(retVal);
+ }
+ return retVal;
}
@Override
Added: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java?rev=813515&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java (added)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ResourceHandlerProxy.java Thu Sep 10 17:04:44 2009
@@ -0,0 +1,79 @@
+/*
+ * 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 org.apache.myfaces.scripting.jsf.dynamicdecorators.implemetations;
+
+import org.apache.myfaces.scripting.core.util.ProxyUtils;
+
+import javax.faces.application.ResourceHandler;
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ResourceHandlerProxy extends ResourceHandler {
+
+ ResourceHandler _delegate = null;
+
+ public ResourceHandlerProxy() {
+ super();
+ }
+
+ public ResourceHandlerProxy(ResourceHandler delegate) {
+ super();
+ this._delegate = delegate;
+ }
+
+ public Resource createResource(String s) {
+ return _delegate.createResource(s);
+ }
+
+ public Resource createResource(String s, String s1) {
+ return _delegate.createResource(s, s1);
+ }
+
+ public Resource createResource(String s, String s1, String s2) {
+ return _delegate.createResource(s, s1, s2);
+ }
+
+ public String getRendererTypeForResourceName(String s) {
+ return _delegate.getRendererTypeForResourceName(s);
+ }
+
+ public void handleResourceRequest(FacesContext facesContext) {
+ weaveDelegate();
+ _delegate.handleResourceRequest(facesContext);
+ }
+
+ public boolean isResourceRequest(FacesContext facesContext) {
+ return _delegate.isResourceRequest(facesContext);
+ }
+
+ public boolean libraryExists(String s) {
+ return _delegate.libraryExists(s);
+ }
+
+ private void weaveDelegate() {
+ if (_delegate != null)
+ _delegate = (ResourceHandler) ProxyUtils.getWeaver().reloadScriptingInstance(_delegate);
+ }
+
+}