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 2012/03/14 16:46:07 UTC

svn commit: r1300598 [8/10] - in /myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src: main/java/org/apache/myfaces/extensions/scripting/core/api/ main/java/org/apache/myfaces/extensions/scripting/core/common/ main/java/org/apache...

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/VariableResolverProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/VariableResolverProxy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/VariableResolverProxy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/VariableResolverProxy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.extensions.scripting.jsf.dynamicdecorators.implementations;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.VariableResolver;
+
+/**
+ * objects loaded must
+ * be checked if a reloading is needed
+ *
+ * @author Werner Punz
+ */
+@SuppressWarnings("deprecation") //we must suppress it here
+public class VariableResolverProxy extends VariableResolver implements Decorated
+{
+    VariableResolver _delegate;
+
+    public VariableResolverProxy(VariableResolver delegate) {
+        _delegate = delegate;
+    }
+
+    public Object resolveVariable(FacesContext facesContext, String s) throws EvaluationException {
+        Object variable = _delegate.resolveVariable(facesContext, s);
+        if (variable != null && WeavingContext.getInstance().isDynamic(variable.getClass()))
+            variable = WeavingContext.getInstance().reload(variable, ScriptingConst.ARTIFACT_TYPE_MANAGEDBEAN);
+        return variable;
+    }
+
+    public Object getDelegate() {
+        return _delegate;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/ViewHandlerProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/ViewHandlerProxy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/ViewHandlerProxy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/dynamicDecorators/implementations/ViewHandlerProxy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,134 @@
+/*
+ * 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.extensions.scripting.jsf.dynamicdecorators.implementations;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.Decorated;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+import java.io.IOException;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Scripting enabled View Handler
+ *
+ * @author Werner Punz
+ */
+public class ViewHandlerProxy extends ViewHandler implements Decorated
+{
+
+    ViewHandler _delegate = null;
+
+    private void weaveDelegate() {
+        if (_delegate != null) {
+            _delegate = (ViewHandler) WeavingContext.getInstance().reload(_delegate,
+                    ScriptingConst.ARTIFACT_TYPE_VIEWHANDLER);
+        }
+    }
+
+    public ViewHandlerProxy(ViewHandler delegate) {
+        _delegate = delegate;
+    }
+
+    public String calculateCharacterEncoding(FacesContext facesContext) {
+        weaveDelegate();
+        return _delegate.calculateCharacterEncoding(facesContext);
+    }
+
+    public Locale calculateLocale(FacesContext facesContext) {
+        weaveDelegate();
+        return _delegate.calculateLocale(facesContext);
+    }
+
+    public String calculateRenderKitId(FacesContext facesContext) {
+        weaveDelegate();
+        return _delegate.calculateRenderKitId(facesContext);
+    }
+
+    public UIViewRoot createView(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.createView(facesContext, s);
+    }
+
+    public String getActionURL(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.getActionURL(facesContext, s);
+    }
+
+    public String getResourceURL(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.getResourceURL(facesContext, s);
+    }
+
+    public void initView(FacesContext facesContext) throws FacesException {
+        weaveDelegate();
+        _delegate.initView(facesContext);
+    }
+
+    public void renderView(FacesContext facesContext, UIViewRoot uiViewRoot) throws IOException, FacesException {
+        weaveDelegate();
+        _delegate.renderView(facesContext, uiViewRoot);
+    }
+
+    public UIViewRoot restoreView(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.restoreView(facesContext, s);
+    }
+
+    public void writeState(FacesContext facesContext) throws IOException {
+        weaveDelegate();
+        _delegate.writeState(facesContext);
+    }
+
+
+    @Override
+    public String deriveViewId(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.deriveViewId(facesContext, s);
+    }
+
+    @Override
+    public String getBookmarkableURL(FacesContext facesContext, String s, Map<String, List<String>> stringListMap, boolean b) {
+        return super.getBookmarkableURL(facesContext, s, stringListMap, b);
+    }
+
+    @Override
+    public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext facesContext, String s) {
+        weaveDelegate();
+        return _delegate.getViewDeclarationLanguage(facesContext, s);
+    }
+
+    @Override
+    public String getRedirectURL(FacesContext facesContext, String s, Map<String, List<String>> stringListMap, boolean b) {
+        weaveDelegate();
+        return _delegate.getRedirectURL(facesContext, s, stringListMap, b);
+    }
+
+    public Object getDelegate() {
+        return _delegate;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/MyFacesReroutingResourceResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/MyFacesReroutingResourceResolver.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/MyFacesReroutingResourceResolver.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/MyFacesReroutingResourceResolver.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,66 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+
+import org.apache.myfaces.view.facelets.impl.DefaultResourceResolver;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * decorated Facelet resource resolver to reroute
+ * the resource requests to our source path if possible
+ */
+public class MyFacesReroutingResourceResolver extends DefaultResourceResolver
+{
+
+    DefaultResourceResolver _delegate = new DefaultResourceResolver();
+    volatile boolean _initiated = false;
+    List<String> _resourceDirs = null;
+
+    Logger log = Logger.getLogger(this.getClass().getName());
+
+    @Override
+    public URL resolveUrl(String path) {
+
+        if (!_initiated) {
+            _resourceDirs = WeavingContext.getInstance().getConfiguration().getResourceDirs();
+            _initiated = true;
+        }
+
+        if (_resourceDirs != null && !_resourceDirs.isEmpty()) {
+            for (String resourceDir : _resourceDirs) {
+                File resource = new File(resourceDir + path);
+                if (resource.exists()) try {
+                    return resource.toURI().toURL();
+                } catch (MalformedURLException e) {
+                    log.log(Level.SEVERE, "",e);
+                }
+            }
+        }
+
+        return _delegate.resolveUrl(path);
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingBehaviorTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingBehaviorTagHandlerDelegate.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingBehaviorTagHandlerDelegate.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingBehaviorTagHandlerDelegate.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,72 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+
+import org.apache.myfaces.view.facelets.tag.jsf.BehaviorTagHandlerDelegate;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.BehaviorHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.TagHandlerDelegate;
+import java.io.IOException;
+
+/**
+ * Behavior Tag Handler which introduces reloading behavior
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ReloadingBehaviorTagHandlerDelegate extends TagHandlerDelegate {
+
+    BehaviorHandler _owner;
+    TagHandlerDelegate _delegate;
+
+    public ReloadingBehaviorTagHandlerDelegate(BehaviorHandler owner) {
+        applyOwner(owner);
+    }
+
+    private void applyOwner(BehaviorHandler owner) {
+        _owner = owner;
+        _delegate = new BehaviorTagHandlerDelegate(_owner);
+    }
+
+    @Override
+    public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
+        if (WeavingContext.getInstance().isDynamic(_owner.getClass())) {
+            BehaviorHandler newOwner = (BehaviorHandler) WeavingContext.getInstance().reload(_owner,
+                    ScriptingConst.ARTIFACT_TYPE_BEHAVIOR_HANDLER);
+            if (!newOwner.getClass().equals(_owner.getClass())) {
+                applyOwner(newOwner);
+            }
+        }
+        _owner.apply(ctx, comp);
+    }
+
+    @Override
+    public MetaRuleset createMetaRuleset(Class type) {
+        return _delegate.createMetaRuleset(type);
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingComponentTagHandlerDelegate.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingComponentTagHandlerDelegate.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingComponentTagHandlerDelegate.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,110 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+import org.apache.myfaces.view.facelets.tag.jsf.ActionSourceRule;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate;
+import org.apache.myfaces.view.facelets.tag.jsf.EditableValueHolderRule;
+import org.apache.myfaces.view.facelets.tag.jsf.ValueHolderRule;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.jsf.facelet.support.ComponentRule;
+import org.apache.myfaces.extensions.scripting.jsf.facelet.support.SwitchingMetarulesetImpl;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.TagHandlerDelegate;
+import java.io.IOException;
+
+/**
+ * we provide our own component tag handler factory impl
+ * so that we can deal with refreshing of components
+ * on Facelets level without running into
+ * nasty type exceptions
+ */
+public class ReloadingComponentTagHandlerDelegate extends TagHandlerDelegate {
+
+    ComponentHandler _owner;
+    TagHandlerDelegate _delegate;
+
+    public ReloadingComponentTagHandlerDelegate(ComponentHandler owner) {
+        applyOwner(owner);
+    }
+
+    private void applyOwner(ComponentHandler owner) {
+        _owner = owner;
+        _delegate = new ComponentTagHandlerDelegate(_owner);
+    }
+
+    @Override
+    public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
+        if (WeavingContext.getInstance().isDynamic(_owner.getClass())) {
+            ComponentHandler newOwner = (ComponentHandler) WeavingContext.getInstance().reload(_owner,
+                    ScriptingConst.ARTIFACT_TYPE_COMPONENT_HANDLER);
+            if (!newOwner.getClass().equals(_owner.getClass())) {
+                applyOwner(newOwner);
+            }
+        }
+        _delegate.apply(ctx, comp);
+    }
+
+    public MetaRuleset createMetaRuleset(Class type) {
+        //We have to create a different meta rule set for dynamic classes
+        //which have weaver instantiation criteria, the original meta rule set
+        //first applies the attributes and then calls BeanPropertyTagRule
+        //that one however caches the current method and does not take into consideration
+        //that classes can be changed on the fly
+
+        // if (WeavingContext.isDynamic(type)) {
+        MetaRuleset m = new SwitchingMetarulesetImpl(_owner.getTag(), type);
+        // ignore standard component attributes
+        m.ignore("binding").ignore("id");
+
+        // add auto wiring for attributes
+        m.addRule(ComponentRule.Instance);
+
+        // if it's an ActionSource
+        if (ActionSource.class.isAssignableFrom(type)) {
+            m.addRule(ActionSourceRule.INSTANCE);
+        }
+
+        // if it's a ValueHolder
+        if (ValueHolder.class.isAssignableFrom(type)) {
+            m.addRule(ValueHolderRule.INSTANCE);
+
+            // if it's an EditableValueHolder
+            if (EditableValueHolder.class.isAssignableFrom(type)) {
+                m.ignore("submittedValue");
+                m.ignore("valid");
+                m.addRule(EditableValueHolderRule.INSTANCE);
+            }
+        }
+
+        return m;
+        //}
+
+        //return _delegate.createMetaRuleset(type);
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingConverterTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingConverterTagHandlerDelegate.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingConverterTagHandlerDelegate.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingConverterTagHandlerDelegate.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+
+import org.apache.myfaces.view.facelets.tag.jsf.ConverterTagHandlerDelegate;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.ConverterHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.TagHandlerDelegate;
+import java.io.IOException;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ReloadingConverterTagHandlerDelegate extends TagHandlerDelegate {
+
+        ConverterHandler _owner;
+        TagHandlerDelegate _delegate;
+
+        public ReloadingConverterTagHandlerDelegate(ConverterHandler owner) {
+            applyOwner(owner);
+        }
+
+    private void applyOwner(ConverterHandler owner) {
+        _owner = owner;
+        _delegate = new ConverterTagHandlerDelegate(_owner);
+    }
+
+    @Override
+        public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
+            if (WeavingContext.getInstance().isDynamic(_owner.getClass())) {
+                ConverterHandler newOwner = (ConverterHandler) WeavingContext.getInstance().reload(_owner,
+                        ScriptingConst.ARTIFACT_TYPE_CONVERTER_HANDLER);
+                if(!newOwner.getClass().equals(_owner.getClass())) {
+                    applyOwner(newOwner);
+                }
+            }
+            _delegate.apply(ctx, comp);
+        }
+
+        @Override
+        public MetaRuleset createMetaRuleset(Class type) {
+            return _delegate.createMetaRuleset(type);
+        }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingValidatorTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingValidatorTagHandlerDelegate.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingValidatorTagHandlerDelegate.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/ReloadingValidatorTagHandlerDelegate.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,69 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+
+import org.apache.myfaces.view.facelets.tag.jsf.ValidatorTagHandlerDelegate;
+import org.apache.myfaces.extensions.scripting.core.api.ScriptingConst;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.TagHandlerDelegate;
+import javax.faces.view.facelets.ValidatorHandler;
+import java.io.IOException;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ReloadingValidatorTagHandlerDelegate extends TagHandlerDelegate {
+
+    ValidatorHandler _owner;
+    TagHandlerDelegate _delegate;
+
+    public ReloadingValidatorTagHandlerDelegate(ValidatorHandler owner) {
+        applyOwner(owner);
+    }
+
+    private void applyOwner(ValidatorHandler owner) {
+        _owner = owner;
+        _delegate = new ValidatorTagHandlerDelegate(_owner);
+    }
+
+    @Override
+    public void apply(FaceletContext ctx, UIComponent comp) throws IOException {
+        if (WeavingContext.getInstance().isDynamic(_owner.getClass())) {
+            ValidatorHandler newOwner = (ValidatorHandler) WeavingContext.getInstance().reload(_owner,
+                    ScriptingConst.ARTIFACT_TYPE_VALIDATOR_HANDLER);
+            if (!newOwner.getClass().equals(_owner.getClass())) {
+                applyOwner(newOwner);
+            }
+        }
+        _owner.apply(ctx, comp);
+    }
+
+    @Override
+    public MetaRuleset createMetaRuleset(Class type) {
+        return _delegate.createMetaRuleset(type);
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/TagHandlerDelegateFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/TagHandlerDelegateFactoryImpl.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/TagHandlerDelegateFactoryImpl.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/TagHandlerDelegateFactoryImpl.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,72 @@
+/*
+ * 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.extensions.scripting.jsf.facelet;
+
+
+import org.apache.myfaces.view.facelets.tag.jsf.BehaviorTagHandlerDelegate;
+import org.apache.myfaces.view.facelets.tag.jsf.ConverterTagHandlerDelegate;
+import org.apache.myfaces.view.facelets.tag.jsf.ValidatorTagHandlerDelegate;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.view.facelets.*;
+
+/**
+ * Tag handler delegate factory which injects reloading
+ * proxies for our facelet artifacts
+ */
+public class TagHandlerDelegateFactoryImpl extends TagHandlerDelegateFactory {
+
+    @Override
+    public TagHandlerDelegate createBehaviorHandlerDelegate(
+            BehaviorHandler owner) {
+        if (WeavingContext.getInstance().isDynamic(owner.getClass())) {
+            return new ReloadingBehaviorTagHandlerDelegate(owner);
+        } else {
+            return new BehaviorTagHandlerDelegate(owner);
+        }
+    }
+
+    @Override
+    public TagHandlerDelegate createComponentHandlerDelegate(
+            ComponentHandler owner) {
+        return new ReloadingComponentTagHandlerDelegate(owner);
+    }
+
+    @Override
+    public TagHandlerDelegate createConverterHandlerDelegate(
+            ConverterHandler owner) {
+        if (WeavingContext.getInstance().isDynamic(owner.getClass())) {
+            return new ReloadingConverterTagHandlerDelegate(owner);
+        } else {
+            return new ConverterTagHandlerDelegate(owner);
+        }
+    }
+
+    @Override
+    public TagHandlerDelegate createValidatorHandlerDelegate(
+            ValidatorHandler owner) {
+        if (WeavingContext.getInstance().isDynamic(owner.getClass())) {
+            return new ReloadingValidatorTagHandlerDelegate(owner);
+        } else {
+            return new ValidatorTagHandlerDelegate(owner);
+        }
+    }
+}
+

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/ComponentRule.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/ComponentRule.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/ComponentRule.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/ComponentRule.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,102 @@
+/*
+ * 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.extensions.scripting.jsf.facelet.support;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * we have to re implement the component rule class here
+ * because it is declared private in the original
+ * implementation
+ */
+public final class ComponentRule extends MetaRule {
+
+    final class LiteralAttributeMetadata extends Metadata {
+        private final String _name;
+        private final String _value;
+
+        public LiteralAttributeMetadata(String name, String value) {
+            _name = name;
+            _value = value;
+        }
+
+        public void applyMetadata(FaceletContext ctx, Object instance) {
+            ((UIComponent) instance).getAttributes().put(_name, _value);
+        }
+    }
+
+    final static class ValueExpressionMetadata extends Metadata {
+        private final String _name;
+
+        private final TagAttribute _attr;
+
+        private final Class<?> _type;
+
+        public ValueExpressionMetadata(String name, Class<?> type, TagAttribute attr) {
+            _name = name;
+            _attr = attr;
+            _type = type;
+        }
+
+        public void applyMetadata(FaceletContext ctx, Object instance) {
+            ((UIComponent) instance).setValueExpression(_name, _attr.getValueExpression(ctx, _type));
+        }
+    }
+
+    //private final static Logger log = Logger.getLogger("facelets.tag.component");
+    private final static Logger log = Logger.getLogger(ComponentRule.class.getName());
+
+    public final static ComponentRule Instance = new ComponentRule();
+
+    public ComponentRule() {
+        super();
+    }
+
+    public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+        if (meta.isTargetInstanceOf(UIComponent.class)) {
+            // if component and dynamic, then must set expression
+            if (!attribute.isLiteral()) {
+                Class<?> type = meta.getPropertyType(name);
+                if (type == null) {
+                    type = Object.class;
+                }
+
+                return new ValueExpressionMetadata(name, type, attribute);
+            } else if (meta.getWriteMethod(name) == null) {
+
+                // this was an attribute literal, but not property
+                warnAttr(attribute, meta.getTargetClass(), name);
+
+                return new LiteralAttributeMetadata(name, attribute.getValue());
+            }
+        }
+        return null;
+    }
+
+    private static void warnAttr(TagAttribute attr, Class<?> type, String n) {
+        if (log.isLoggable(Level.FINER)) {
+            log.finer(attr + " Property '" + n + "' is not on type: " + type.getName());
+        }
+    }
+
+}
+

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/InvokeDynamicBeanPropertyTagRule.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/InvokeDynamicBeanPropertyTagRule.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/InvokeDynamicBeanPropertyTagRule.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/InvokeDynamicBeanPropertyTagRule.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,107 @@
+/*
+ * 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.extensions.scripting.jsf.facelet.support;
+
+
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+import java.lang.reflect.Method;
+
+/**
+ * We have to introduce a BeanPropertyTagRule
+ * which calls the setter of a given component
+ * on a weaker base than the original facelets component
+ * property tag rule does.
+ * By not enforcing a strict per object/class policy on calling
+ * the setter we are able to reload the classes on the fly
+ * <p/>
+ * the original approach was to cache the classes, and then
+ * call the invoke method on the existing class
+ * if we now exchange the classes we have a problem...
+ * By making the invocation of the method independend from the underlying
+ * class (sort of calling an invokedynamic) we can bypass this problem
+ * on facelets level.
+ */
+public class InvokeDynamicBeanPropertyTagRule {
+    public final static InvokeDynamicBeanPropertyTagRule Instance = new InvokeDynamicBeanPropertyTagRule();
+
+    public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+        Method m = meta.getWriteMethod(name);
+
+        // if the property is writable
+        if (m != null) {
+            if (attribute.isLiteral()) {
+                return new LiteralPropertyMetadata(m, attribute);
+            } else {
+                return new DynamicPropertyMetadata(m, attribute);
+            }
+        }
+
+        return null;
+    }
+
+    final static class LiteralPropertyMetadata extends Metadata {
+
+        private final Method method;
+
+        private final TagAttribute attribute;
+
+        private Object[] value;
+
+        public LiteralPropertyMetadata(Method method, TagAttribute attribute) {
+            this.method = method;
+            this.attribute = attribute;
+        }
+
+        public void applyMetadata(FaceletContext ctx, Object instance) {
+            if (value == null) {
+                String str = this.attribute.getValue();
+                value = new Object[]{ctx.getExpressionFactory().coerceToType(str, method.getParameterTypes()[0])};
+            }
+            //What we do here is simply to call an invoke dynamic on the method with the same name
+            //but on the new instance of, that way we can bypass class problems
+            //because the method reference has stored the old class in our case
+            ReflectUtil.executeMethod(instance, method.getName(), this.value);
+        }
+
+    }
+
+    final static class DynamicPropertyMetadata extends Metadata {
+
+        private final Method method;
+
+        private final TagAttribute attribute;
+
+        private final Class<?> type;
+
+        public DynamicPropertyMetadata(Method method, TagAttribute attribute) {
+            this.method = method;
+            this.type = method.getParameterTypes()[0];
+            this.attribute = attribute;
+        }
+
+        public void applyMetadata(FaceletContext ctx, Object instance) {
+            ReflectUtil.executeMethod(instance, method.getName(), new Object[]{attribute.getObject(ctx, type)});
+        }
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingBeanPropertyTagRule.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingBeanPropertyTagRule.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingBeanPropertyTagRule.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingBeanPropertyTagRule.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,51 @@
+/*
+ * 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.extensions.scripting.jsf.facelet.support;
+
+import org.apache.myfaces.view.facelets.tag.BeanPropertyTagRule;
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+/**
+ * Bean property tag rule
+ * which switches between the fast static
+ * version and the slower invoke dynamic
+ * version depending on the class type of
+ * the incoming instance
+ */
+public class SwitchingBeanPropertyTagRule extends MetaRule {
+
+    InvokeDynamicBeanPropertyTagRule _invokeDynamic = InvokeDynamicBeanPropertyTagRule.Instance;
+    BeanPropertyTagRule _invokeStatic = BeanPropertyTagRule.INSTANCE;
+
+    public static volatile SwitchingBeanPropertyTagRule Instance = new SwitchingBeanPropertyTagRule();
+
+    @Override
+    public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+        if (WeavingContext.getInstance().isDynamic(meta.getTargetClass())) {
+            return _invokeDynamic.applyRule(name, attribute, meta);
+        } else {
+            return _invokeStatic.applyRule(name, attribute, meta);
+        }
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingMetarulesetImpl.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingMetarulesetImpl.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingMetarulesetImpl.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/facelet/support/SwitchingMetarulesetImpl.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,179 @@
+/*
+ * 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.extensions.scripting.jsf.facelet.support;
+
+import org.apache.myfaces.view.facelets.tag.MetaRulesetImpl;
+import org.apache.myfaces.view.facelets.tag.MetadataImpl;
+import org.apache.myfaces.view.facelets.tag.MetadataTargetImpl;
+import org.apache.myfaces.view.facelets.util.ParameterCheck;
+
+import javax.faces.view.facelets.*;
+import java.beans.IntrospectionException;
+import java.util.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * we have to to do a full reimplementation of the rule set
+ * because otherwise we could not plant the switching bean reloading
+ * rule due to private props in the original code
+ */
+public class SwitchingMetarulesetImpl extends MetaRuleset {
+    private final static Metadata NONE = new NullMetadata();
+
+    //private final static Logger log = Logger.getLogger("facelets.tag.meta");
+    private final static Logger log = Logger.getLogger(MetaRulesetImpl.class.getName());
+
+    private final static WeakHashMap<String, MetadataTarget> _metadata = new WeakHashMap<String, MetadataTarget>();
+
+    private final Map<String, TagAttribute> _attributes;
+
+    private final List<Metadata> _mappers;
+
+    private final List<MetaRule> _rules;
+
+    private final Tag _tag;
+
+    private final Class<?> _type;
+
+    public SwitchingMetarulesetImpl(Tag tag, Class<?> type) {
+        _tag = tag;
+        _type = type;
+        _attributes = new HashMap<String, TagAttribute>();
+        _mappers = new ArrayList<Metadata>();
+        _rules = new ArrayList<MetaRule>();
+
+        // setup attributes
+        for (TagAttribute attribute : _tag.getAttributes().getAll()) {
+            _attributes.put(attribute.getLocalName(), attribute);
+        }
+
+        // add default rules
+        _rules.add(SwitchingBeanPropertyTagRule.Instance);
+    }
+
+    public MetaRuleset add(Metadata mapper) {
+        ParameterCheck.notNull("mapper", mapper);
+
+        if (!_mappers.contains(mapper)) {
+            _mappers.add(mapper);
+        }
+
+        return this;
+    }
+
+    public MetaRuleset addRule(MetaRule rule) {
+        ParameterCheck.notNull("rule", rule);
+
+        _rules.add(rule);
+
+        return this;
+    }
+
+    public MetaRuleset alias(String attribute, String property) {
+        ParameterCheck.notNull("attribute", attribute);
+        ParameterCheck.notNull("property", property);
+
+        TagAttribute attr = (TagAttribute) _attributes.remove(attribute);
+        if (attr != null) {
+            _attributes.put(property, attr);
+        }
+
+        return this;
+    }
+
+    public Metadata finish() {
+        assert !_rules.isEmpty();
+
+        if (!_attributes.isEmpty()) {
+            MetadataTarget target = this._getMetadataTarget();
+            int ruleEnd = _rules.size() - 1;
+
+            // now iterate over attributes
+            for (Map.Entry<String, TagAttribute> entry : _attributes.entrySet()) {
+                Metadata data = null;
+
+                int i = ruleEnd;
+
+                // First loop is always safe
+                do {
+                    MetaRule rule = _rules.get(i);
+                    data = rule.applyRule(entry.getKey(), entry.getValue(), target);
+                    i--;
+                } while (data == null && i >= 0);
+
+                if (data == null) {
+                    if (log.isLoggable(Level.SEVERE)) {
+                        log.severe(entry.getValue() + " Unhandled by MetaTagHandler for type " + _type.getName());
+                    }
+                } else {
+                    _mappers.add(data);
+                }
+            }
+        }
+
+        if (_mappers.isEmpty()) {
+            return NONE;
+        } else {
+            return new MetadataImpl(_mappers.toArray(new Metadata[_mappers.size()]));
+        }
+    }
+
+    public MetaRuleset ignore(String attribute) {
+        ParameterCheck.notNull("attribute", attribute);
+
+        _attributes.remove(attribute);
+
+        return this;
+    }
+
+    public MetaRuleset ignoreAll() {
+        _attributes.clear();
+
+        return this;
+    }
+
+    private final MetadataTarget _getMetadataTarget() {
+        String key = _type.getName();
+
+        MetadataTarget meta = _metadata.get(key);
+        if (meta == null) {
+            try {
+                meta = new MetadataTargetImpl(_type);
+            }
+            catch (IntrospectionException e) {
+                throw new TagException(_tag, "Error Creating TargetMetadata", e);
+            }
+
+            _metadata.put(key, meta);
+        }
+
+        return meta;
+    }
+
+    private static class NullMetadata extends Metadata {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void applyMetadata(FaceletContext ctx, Object instance) {
+            // do nothing
+        }
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/BehaviorHandlerReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/BehaviorHandlerReloadingStrategy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/BehaviorHandlerReloadingStrategy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/BehaviorHandlerReloadingStrategy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.extensions.scripting.jsf.reloading;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.common.util.Cast;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
+
+import javax.faces.view.facelets.BehaviorConfig;
+import javax.faces.view.facelets.BehaviorHandler;
+import javax.faces.view.facelets.ComponentHandler;
+
+/**
+ * The reloading strategy for our behavior tag handlers
+ * note since we do not have an official api we must
+ * enforce a getConverterConfig() method to allow
+ * the reloading of converter tag handlers
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class BehaviorHandlerReloadingStrategy extends SimpleReloadingStrategy
+{
+    public BehaviorHandlerReloadingStrategy() {
+        super();
+    }
+
+    @Override
+    public Object reload(Object scriptingInstance, int artifactType) {
+        if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
+        Class aclass = WeavingContext.getInstance().reload(scriptingInstance.getClass());
+        if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
+            //class of this object has not changed although
+            // reload is enabled we can skip the rest now
+            return scriptingInstance;
+        }
+        BehaviorHandler oldHandler = (BehaviorHandler) scriptingInstance;
+        /**
+         *
+         */
+        BehaviorConfig config = (BehaviorConfig) ReflectUtil.executeMethod(oldHandler, "getBehaviorConfig");
+        BehaviorHandler newHandler = (BehaviorHandler) ReflectUtil.instantiate(aclass, new Cast(BehaviorConfig.class, config));
+
+        //save all pending non config related properties wherever possible
+        super.mapProperties(newHandler, oldHandler);
+
+        return newHandler;
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ComponentHandlerReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ComponentHandlerReloadingStrategy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ComponentHandlerReloadingStrategy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ComponentHandlerReloadingStrategy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,63 @@
+/*
+ * 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.extensions.scripting.jsf.reloading;
+
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.common.util.Cast;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ComponentHandlerReloadingStrategy extends SimpleReloadingStrategy
+{
+
+    public ComponentHandlerReloadingStrategy() {
+        super();
+    }
+
+    @Override
+    public Object reload(Object scriptingInstance, int artifactType) {
+        if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
+        Class aclass = WeavingContext.getInstance().reload(scriptingInstance.getClass());
+        if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
+            //class of this object has not changed although
+            // reload is enabled we can skip the rest now
+            return scriptingInstance;
+        }
+        ComponentHandler oldHandler = (ComponentHandler) scriptingInstance;
+        ComponentConfig config = oldHandler.getComponentConfig();
+        ComponentHandler newHandler = (ComponentHandler) ReflectUtil.instantiate(aclass, new Cast(ComponentConfig.class, config));
+
+        //save all pending non config related properties wherever possible
+
+
+        super.mapProperties(newHandler, oldHandler);
+
+        return newHandler;
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ConverterHandlerReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ConverterHandlerReloadingStrategy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ConverterHandlerReloadingStrategy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ConverterHandlerReloadingStrategy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.extensions.scripting.jsf.reloading;
+
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.common.util.Cast;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
+
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.ConverterConfig;
+import javax.faces.view.facelets.ConverterHandler;
+
+/**
+ * The reloading strategy for our converter tag handlers
+ * note since we do not have an official api we must
+ * enforce a getConverterConfig() method to allow
+ * the reloading of converter tag handlers
+ *
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+@SuppressWarnings("unused")//used dynamically
+public class ConverterHandlerReloadingStrategy extends SimpleReloadingStrategy
+{
+
+    public ConverterHandlerReloadingStrategy() {
+        super();
+    }
+
+    @Override
+    public Object reload(Object scriptingInstance, int artifactType) {
+        if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
+        Class aclass = WeavingContext.getInstance().reload(scriptingInstance.getClass());
+        if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
+            //class of this object has not changed although
+            // reload is enabled we can skip the rest now
+            return scriptingInstance;
+        }
+        ConverterHandler oldHandler = (ConverterHandler) scriptingInstance;
+        /**
+         *
+         */
+        ConverterConfig config = (ConverterConfig) ReflectUtil.executeMethod(oldHandler, "getConverterConfig");
+        ConverterHandler newHandler = (ConverterHandler) ReflectUtil.instantiate(aclass, new Cast(ConverterConfig.class, config));
+
+        //save all pending non config related properties wherever possible
+        super.mapProperties(newHandler, oldHandler);
+
+        return newHandler;
+    }
+
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ValidatorHandlerReloadingStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ValidatorHandlerReloadingStrategy.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ValidatorHandlerReloadingStrategy.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/reloading/ValidatorHandlerReloadingStrategy.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,64 @@
+/*
+ * 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.extensions.scripting.jsf.reloading;
+
+
+import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
+import org.apache.myfaces.extensions.scripting.core.common.util.Cast;
+import org.apache.myfaces.extensions.scripting.core.common.util.ReflectUtil;
+import org.apache.myfaces.extensions.scripting.core.reloading.SimpleReloadingStrategy;
+
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.ValidatorConfig;
+import javax.faces.view.facelets.ValidatorHandler;
+
+/**
+ * @author Werner Punz (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+
+public class ValidatorHandlerReloadingStrategy extends SimpleReloadingStrategy
+{
+
+    public ValidatorHandlerReloadingStrategy() {
+        super();
+    }
+
+    @Override
+    public Object reload(Object scriptingInstance, int artifactType) {
+        if (!(scriptingInstance instanceof ComponentHandler)) return scriptingInstance;
+        Class aclass = WeavingContext.getInstance().reload(scriptingInstance.getClass());
+        if (aclass.hashCode() == scriptingInstance.getClass().hashCode()) {
+            //class of this object has not changed although
+            // reload is enabled we can skip the rest now
+            return scriptingInstance;
+        }
+        ValidatorHandler oldHandler = (ValidatorHandler) scriptingInstance;
+        ValidatorConfig config = oldHandler.getValidatorConfig();
+        ValidatorHandler newHandler = (ValidatorHandler) ReflectUtil.instantiate(aclass, new Cast(ValidatorConfig.class, config));
+
+        //save all pending non config related properties wherever possible
+        super.mapProperties(newHandler, oldHandler);
+
+        return newHandler;
+    }
+
+}
+

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/AliasResourceMetaImpl.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/AliasResourceMetaImpl.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/AliasResourceMetaImpl.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/AliasResourceMetaImpl.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,96 @@
+/*
+ * 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.extensions.scripting.jsf.resources;
+
+/**
+ * Contains the metadata information to reference a resource 
+ * 
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 700544 $ $Date: 2008-09-30 13:44:02 -0500 (Mar, 30 Sep 2008) $
+ */
+public class AliasResourceMetaImpl extends ResourceMetaImpl
+{
+    private String _realResourceName;
+    
+    private boolean _couldContainValueExpressions;
+
+    public AliasResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
+            String resourceName, String resourceVersion, String realResourceName, boolean couldContainValueExpressions)
+    {
+        super(prefix, libraryName, libraryVersion,
+            resourceName, resourceVersion);
+        _realResourceName = realResourceName;
+        _couldContainValueExpressions = couldContainValueExpressions;
+    }
+    
+    public String getRealResourceName()
+    {
+        return _realResourceName;
+    }
+
+    public void setRealResourceName(String realResourceName)
+    {
+        _realResourceName = realResourceName;
+    }
+    
+    @Override
+    public String getResourceIdentifier()
+    {
+        StringBuilder builder = new StringBuilder();
+        boolean firstSlashAdded = false;
+        if (getLocalePrefix() != null && getLocalePrefix().length() > 0)
+        {
+            builder.append(getLocalePrefix());
+            firstSlashAdded = true;
+        }
+        if (getLibraryName() != null)
+        {
+            if (firstSlashAdded) builder.append('/');
+            builder.append(getLibraryName());
+            firstSlashAdded = true;
+        }
+        if (getLibraryVersion() != null)
+        {
+            if (firstSlashAdded) builder.append('/');
+            builder.append(getLibraryVersion());
+            firstSlashAdded = true;
+        }
+        if (getRealResourceName() != null)
+        {
+            if (firstSlashAdded) builder.append('/');
+            builder.append(getRealResourceName());
+            firstSlashAdded = true;
+        }
+        if (getResourceVersion() != null)
+        {
+            if (firstSlashAdded) builder.append('/');
+            builder.append(getResourceVersion());
+            builder.append(
+                    getRealResourceName().substring(getRealResourceName().lastIndexOf('.')));
+            firstSlashAdded = true;
+        }
+        return builder.toString();
+    }
+
+    @Override
+    public boolean couldResourceContainValueExpressions()
+    {
+        return _couldContainValueExpressions;
+    }
+}

Added: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/BaseResourceHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/BaseResourceHandlerSupport.java?rev=1300598&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/BaseResourceHandlerSupport.java (added)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/BaseResourceHandlerSupport.java Wed Mar 14 15:46:00 2012
@@ -0,0 +1,236 @@
+/*
+ * 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.extensions.scripting.jsf.resources;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * A ResourceHandlerSupport implementation for use with standard Java Servlet engines,
+ * ie an engine that supports javax.servlet, and uses a standard web.xml file.
+ * 
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 946779 $ $Date: 2010-05-20 15:31:42 -0500 (Jue, 20 May 2010) $
+ */
+public class BaseResourceHandlerSupport extends ResourceHandlerSupport
+{
+
+    /**
+     * Set the max time in miliseconds set on the "Expires" header for a resource.
+     * (default to one week in miliseconds or 604800000) 
+     */
+    public static final String RESOURCE_MAX_TIME_EXPIRES = "org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES";
+
+    /**
+     * Identifies the FacesServlet mapping in the current request map.
+     */
+    private static final String CACHED_SERVLET_MAPPING =
+        BaseResourceHandlerSupport.class.getName() + ".CACHED_SERVLET_MAPPING";
+    
+    private Long _startupTime;
+    
+    private Long _maxTimeExpires;
+        
+    public BaseResourceHandlerSupport()
+    {
+        _startupTime = System.currentTimeMillis();
+    }
+    
+    public ResourceLoader[] getResourceLoaders()
+    {
+        return null;
+    }
+
+    public String calculateResourceBasePath(FacesContext facesContext)
+    {        
+        FacesServletMapping mapping = getFacesServletMapping(facesContext);
+        ExternalContext externalContext = facesContext.getExternalContext();      
+        
+        if (mapping != null)
+        {
+            String resourceBasePath = null;
+            if (mapping.isExtensionMapping())
+            {
+                // Mapping using a suffix. In this case we have to strip 
+                // the suffix. If we have a url like:
+                // http://localhost:8080/testjsf20/javax.faces.resource/imagen.jpg.jsf?ln=dojo
+                // 
+                // The servlet path is /javax.faces.resource/imagen.jpg.jsf
+                //
+                // For obtain the resource name we have to remove the .jsf suffix and 
+                // the prefix ResourceHandler.RESOURCE_IDENTIFIER
+                resourceBasePath = externalContext.getRequestServletPath();
+                int stripPoint = resourceBasePath.lastIndexOf('.');
+                if (stripPoint > 0)
+                {
+                    resourceBasePath = resourceBasePath.substring(0, stripPoint);
+                }
+            }
+            else
+            {
+                // Mapping using prefix. In this case we have to strip 
+                // the prefix used for mapping. If we have a url like:
+                // http://localhost:8080/testjsf20/faces/javax.faces.resource/imagen.jpg?ln=dojo
+                //
+                // The servlet path is /faces
+                // and the path info is /javax.faces.resource/imagen.jpg
+                //
+                // For obtain the resource name we have to remove the /faces prefix and 
+                // then the prefix ResourceHandler.RESOURCE_IDENTIFIER
+                resourceBasePath = externalContext.getRequestPathInfo();
+            }
+            return resourceBasePath;            
+        }
+        else
+        {
+            //If no mapping is detected, just return the
+            //information follows the servlet path but before
+            //the query string
+            return externalContext.getRequestPathInfo();
+        }
+    }
+
+    public boolean isExtensionMapping()
+    {
+        FacesServletMapping mapping = getFacesServletMapping(
+                FacesContext.getCurrentInstance());
+        if (mapping != null)
+        {
+            if (mapping.isExtensionMapping())
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public String getMapping()
+    {
+        FacesServletMapping mapping = getFacesServletMapping(
+                FacesContext.getCurrentInstance());
+        if (mapping != null)
+        {
+            if (mapping.isExtensionMapping())
+            {
+                return mapping.getExtension();
+            }
+            else
+            {
+                return mapping.getPrefix();
+            }
+        }
+        return "";
+    }
+
+    /**
+     * Read the web.xml file that is in the classpath and parse its internals to
+     * figure out how the FacesServlet is mapped for the current webapp.
+     */
+    protected FacesServletMapping getFacesServletMapping(FacesContext context)
+    {
+        Map<Object, Object> attributes = context.getAttributes();
+
+        // Has the mapping already been determined during this request?
+        FacesServletMapping mapping = (FacesServletMapping) attributes.get(CACHED_SERVLET_MAPPING);
+        if (mapping == null)
+        {
+            ExternalContext externalContext = context.getExternalContext();
+            mapping = calculateFacesServletMapping(externalContext.getRequestServletPath(),
+                    externalContext.getRequestPathInfo());
+
+            attributes.put(CACHED_SERVLET_MAPPING, mapping);
+        }
+        return mapping;
+    }
+
+    /**
+     * Determines the mapping of the FacesServlet in the web.xml configuration
+     * file. However, there is no need to actually parse this configuration file
+     * as runtime information is sufficient.
+     *
+     * @param servletPath The servletPath of the current request
+     * @param pathInfo    The pathInfo of the current request
+     * @return the mapping of the FacesServlet in the web.xml configuration file
+     */
+    protected static FacesServletMapping calculateFacesServletMapping(
+        String servletPath, String pathInfo)
+    {
+        if (pathInfo != null)
+        {
+            // If there is a "extra path", it's definitely no extension mapping.
+            // Now we just have to determine the path which has been specified
+            // in the url-pattern, but that's easy as it's the same as the
+            // current servletPath. It doesn't even matter if "/*" has been used
+            // as in this case the servletPath is just an empty string according
+            // to the Servlet Specification (SRV 4.4).
+            return FacesServletMapping.createPrefixMapping(servletPath);
+        }
+        else
+        {
+            // In the case of extension mapping, no "extra path" is available.
+            // Still it's possible that prefix-based mapping has been used.
+            // Actually, if there was an exact match no "extra path"
+            // is available (e.g. if the url-pattern is "/faces/*"
+            // and the request-uri is "/context/faces").
+            int slashPos = servletPath.lastIndexOf('/');
+            int extensionPos = servletPath.lastIndexOf('.');
+            if (extensionPos > -1 && extensionPos > slashPos)
+            {
+                String extension = servletPath.substring(extensionPos);
+                return FacesServletMapping.createExtensionMapping(extension);
+            }
+            else
+            {
+                // There is no extension in the given servletPath and therefore
+                // we assume that it's an exact match using prefix-based mapping.
+                return FacesServletMapping.createPrefixMapping(servletPath);
+            }
+        }
+    }
+
+    public long getStartupTime()
+    {
+        return _startupTime;
+    }
+    
+    public long getMaxTimeExpires()
+    {
+        if (_maxTimeExpires == null)
+        {
+            String time = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(RESOURCE_MAX_TIME_EXPIRES);
+            if (time != null && time.length() > 0)
+            {
+                try
+                {
+                    _maxTimeExpires = Long.parseLong(time);
+                }
+                catch (NumberFormatException e)
+                {
+                    _maxTimeExpires = 604800000L;
+                }
+            }
+            else
+            {
+                _maxTimeExpires = 604800000L;
+            }
+        }
+        return _maxTimeExpires;
+    }
+}