myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r694494 [2/2] - in /myfaces/extensions/validator/trunk: ./ alternative/ alternative/src/ alternative/src/main/ alternative/src/main/config/ alternative/src/main/java/ alternative/src/main/java/org/ alternative/src/main/java/org/apache/ alte...
Date Thu, 11 Sep 2008 21:33:08 GMT
Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java
(original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java
Thu Sep 11 14:33:05 2008
@@ -18,16 +18,18 @@
  */
 package org.apache.myfaces.extensions.validator.core;
 
-import org.apache.myfaces.extensions.validator.core.proxy.ExtValApplicationFactory;
 import org.apache.myfaces.extensions.validator.internal.UsageEnum;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.util.ValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 import javax.faces.render.Renderer;
 import java.io.IOException;
+import java.lang.reflect.Method;
 
 /**
  * Default approach to avoid proxies for converters and the adapter fallback.
@@ -44,8 +46,7 @@
 @UsageInformation(UsageEnum.INTERNAL)
 public class ExtValRendererWrapper extends Renderer
 {
-    private static final String HIDDEN_SUBMIT_INPUT_SUFFIX = "_EXTVAL";
-
+    private static Boolean isAlternativeAvailable = null;
     private Renderer wrapped;
 
     public ExtValRendererWrapper(Renderer wrapped)
@@ -91,8 +92,10 @@
     {
         Object convertedObject = wrapped.getConvertedValue(facesContext, uiComponent, o);
 
+        checkProxyAlternative();
+
         //if the user activated the proxy mode cancel here
-        if (ExtValApplicationFactory.isActive())
+        if (Boolean.TRUE.equals(isAlternativeAvailable))
         {
             return convertedObject;
         }
@@ -101,4 +104,23 @@
 
         return convertedObject;
     }
+
+    private void checkProxyAlternative()
+    {
+        //to avoid a config parameter (but not nice)
+        if(isAlternativeAvailable == null)
+        {
+            Class extValApplicationFactoryClass = ClassUtils.tryToLoadClassForName(
+                "org.apache.myfaces.extensions.validator.core.proxy.ExtValApplicationFactory");
+
+            Method isActiveMethod = ReflectionUtils.tryToGetMethod(extValApplicationFactoryClass,
"isActive", null);
+            isAlternativeAvailable = (Boolean)ReflectionUtils
+                .tryToInvokeMethodOfClass(extValApplicationFactoryClass, isActiveMethod);
+
+            if(isAlternativeAvailable == null)
+            {
+                isAlternativeAvailable = false;
+            }
+        }
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
(original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
Thu Sep 11 14:33:05 2008
@@ -23,6 +23,19 @@
  */
 public class ClassUtils
 {
+    public static Class tryToLoadClassForName(String name)
+    {
+        try
+        {
+            return loadClassForName(name);
+        }
+        catch (ClassNotFoundException e)
+        {
+            //do nothing - it's just a try
+            return null;
+        }
+    }
+    
     public static Class loadClassForName(String name)
         throws ClassNotFoundException
     {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
(original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
Thu Sep 11 14:33:05 2008
@@ -18,20 +18,14 @@
  */
 package org.apache.myfaces.extensions.validator.util;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.extensions.validator.core.InformationProviderBean;
 import org.apache.myfaces.extensions.validator.core.ProcessedInformationEntry;
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
 
 import javax.faces.FactoryFinder;
-import javax.faces.application.Application;
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.ValueHolder;
 import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
 import javax.faces.event.PhaseListener;
 import javax.faces.lifecycle.Lifecycle;
 import javax.faces.lifecycle.LifecycleFactory;
@@ -47,8 +41,6 @@
  */
 public class ExtValUtils
 {
-    private static final Log LOGGER = LogFactory.getLog(ExtValUtils.class);
-
     //TODO test
     public static void createValueBindingConvertedValueMapping(
         UIComponent uiComponent, Object convertedObject)
@@ -204,289 +196,4 @@
             .put(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY,
                 new HashMap<String, ProcessedInformationEntry>());
     }
-
-    /*
-     * workaround: mapping clientId -> proxy -> after restore view: find component
+ set converter of the mapping
-     * TODO: find a better solution - multi-window-mode
-     */
-    public static final String PROXY_MAPPING_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY
-        + ":proxyMapping";
-
-    public static Map<String, Object> getOrInitProxyMapping()
-    {
-        FacesContext facesContext = FacesContext.getCurrentInstance();
-        //session scope is just the worst case - cleanup after restore view
-        Map sessionMap = facesContext.getExternalContext().getSessionMap();
-
-        String viewId = facesContext.getViewRoot().getViewId();
-
-        if (!sessionMap.containsKey(PROXY_MAPPING_KEY)
-            || !((Map) sessionMap.get(PROXY_MAPPING_KEY))
-            .containsKey(viewId))
-        {
-            resetProxyMapping(viewId);
-        }
-
-        return (Map<String, Object>) ((Map) sessionMap.get(PROXY_MAPPING_KEY))
-            .get(viewId);
-    }
-
-    public static void resetProxyMapping(String viewId)
-    {
-        Map sessionMap = FacesContext.getCurrentInstance().getExternalContext()
-            .getSessionMap();
-
-        Map<String, Map<String, Object>> storage;
-
-        if (sessionMap.containsKey(PROXY_MAPPING_KEY))
-        {
-            storage = (Map) sessionMap.get(PROXY_MAPPING_KEY);
-        }
-        else
-        {
-            storage = new HashMap<String, Map<String, Object>>();
-        }
-
-        Map<String, Object> map;
-        if (!storage.containsKey(viewId))
-        {
-            map = new HashMap<String, Object>();
-            storage.put(viewId, map);
-        }
-
-        sessionMap.put(PROXY_MAPPING_KEY, storage);
-    }
-
-    public static final String PROCESSED_CONVERTER_COUNT_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY
-        + ":processedConverterCount";
-
-    public static Integer getProcessedConverterCount()
-    {
-        Map requestMap = FacesContext.getCurrentInstance().getExternalContext()
-            .getRequestMap();
-
-        if (!requestMap.containsKey(PROCESSED_CONVERTER_COUNT_KEY))
-        {
-            resetProcessedConverterMapping();
-        }
-
-        return (Integer) requestMap.get(PROCESSED_CONVERTER_COUNT_KEY);
-    }
-
-    public static void setProcessedConverterCount(Integer count)
-    {
-        Map requestMap = FacesContext.getCurrentInstance().getExternalContext()
-            .getRequestMap();
-
-        if (!requestMap.containsKey(PROCESSED_CONVERTER_COUNT_KEY))
-        {
-            resetProcessedConverterMapping();
-        }
-
-        requestMap.put(PROCESSED_CONVERTER_COUNT_KEY, count);
-    }
-
-    public static void resetProcessedConverterMapping()
-    {
-        FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
-            .put(PROCESSED_CONVERTER_COUNT_KEY, 0);
-    }
-
-    public static void increaseProcessedConverterCount()
-    {
-        setProcessedConverterCount(getProcessedConverterCount() + 1);
-    }
-
-    public static void decreaseProcessedConverterCount()
-    {
-        setProcessedConverterCount(getProcessedConverterCount() - 1);
-    }
-
-    public static boolean useProxyMapping()
-    {
-
-        String initParam = WebXmlParameter.DEACTIVATE_PROXY_MAPPING;
-        boolean disableProxyMapping = (initParam != null && initParam.trim()
-            .equalsIgnoreCase("true"));
-
-        return !(useFallbackAdapters() || disableProxyMapping);
-    }
-
-    @Deprecated
-    public static boolean useFallbackAdapters()
-    {
-        String initParam = WebXmlParameter.USE_ADAPTERS;
-        return (initParam != null && initParam.trim().equalsIgnoreCase("true"));
-    }
-
-    public static void restoreProxies()
-    {
-        UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
-
-        if (viewRoot != null && ExtValUtils.useProxyMapping())
-        {
-            Map componentConverterMapping = ExtValUtils.getOrInitProxyMapping();
-
-            Iterator current = componentConverterMapping.keySet().iterator();
-            String key;
-            Converter converter;
-            Converter converterOfComponent;
-            UIComponent component = null;
-            while (current.hasNext())
-            {
-                key = (String) current.next();
-                converter = (Converter) componentConverterMapping.get(key);
-
-                try
-                {
-                    component = viewRoot.findComponent(key);
-                }
-                catch (IllegalArgumentException e)
-                {
-                    //do nothing - it's just a ri bug with complex components - 
-                    //resolveComponentInComplexComponent will return the correct component
-                }
-
-                if (component == null)
-                {
-                    component = resolveComponentInComplexComponent(viewRoot,
-                        component, key);
-
-                    if (component == null)
-                    {
-                        continue;
-                    }
-                }
-
-                if (!(component instanceof ValueHolder))
-                {
-                    continue;
-                }
-
-                converterOfComponent = ((ValueHolder) component).getConverter();
-
-                //converterOfComponent lost callback during state-saving -> set converter
of same type
-                if (converterOfComponent != null
-                    && converterOfComponent.getClass().getSuperclass()
-                    .equals(converter.getClass().getSuperclass()))
-                {
-                    ((ValueHolder) component).setConverter(converter);
-                }
-            }
-        }
-
-        if (ExtValUtils.useProxyMapping())
-        {
-            ExtValUtils.resetProxyMapping(FacesContext.getCurrentInstance()
-                .getViewRoot().getViewId());
-        }
-    }
-
-    //TODO
-    private static UIComponent resolveComponentInComplexComponent(
-        UIComponent viewRoot, UIComponent component, String key)
-    {
-        int index = key.lastIndexOf(":");
-
-        if (index == -1)
-        {
-            return null;
-        }
-
-        String newKey = key.substring(0, index);
-        if (viewRoot.findComponent(newKey) == null)
-        {
-            int newIndex = newKey.lastIndexOf(":");
-            if (newIndex < 1)
-            {
-                return null;
-            }
-            newKey = newKey.substring(0, newIndex);
-
-            component = viewRoot.findComponent(newKey);
-
-            if (component == null)
-            {
-                return null;
-            }
-            else
-            {
-                return tryToResolveChildComponent(component, key.substring(key
-                    .lastIndexOf(":")));
-            }
-        }
-        return null;
-    }
-
-    //TODO
-    private static UIComponent tryToResolveChildComponent(
-        UIComponent component, String endOfKey)
-    {
-        FacesContext facesContext = FacesContext.getCurrentInstance();
-        String clientId = component.getClientId(facesContext);
-
-        if (clientId.contains(":") && clientId.substring(clientId.lastIndexOf(":")).endsWith(endOfKey))
-        {
-            return component;
-        }
-
-        UIComponent foundComponent;
-        for (UIComponent child : (List<UIComponent>) component.getChildren())
-        {
-            foundComponent = tryToResolveChildComponent(child, endOfKey);
-
-            if (foundComponent != null)
-            {
-                return foundComponent;
-            }
-        }
-
-        return null;
-    }
-
-    public static final String ORIGINAL_APPLICATION_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY
-        + ":wrapped_application";
-
-    //in order to access the wrapped application and support other Application wrappers
-    public static void setOriginalApplication(Application application)
-    {
-        FacesContext facesContext = FacesContext.getCurrentInstance();
-        Map applicationMap = facesContext.getExternalContext()
-            .getApplicationMap();
-
-        if (!applicationMap.containsKey(ORIGINAL_APPLICATION_KEY))
-        {
-            synchronized (ExtValUtils.class)
-            {
-                applicationMap.put(ORIGINAL_APPLICATION_KEY, application);
-
-                if (LOGGER.isTraceEnabled())
-                {
-                    LOGGER.trace("the original application is " + application.getClass().getName());
-                }
-            }
-        }
-    }
-
-    public static Application getOriginalApplication()
-    {
-        return (Application) FacesContext.getCurrentInstance()
-            .getExternalContext().getApplicationMap().get(
-            ORIGINAL_APPLICATION_KEY);
-    }
-
-    public static Converter tryToCreateOriginalConverter(
-        FacesContext facesContext, UIComponent uiComponent)
-    {
-        //for backward compatibility: cross-validation workaround with hidden field and static
value
-        Class valueBindingType = ELUtils.getTypeOfValueBindingForComponent(
-            facesContext, uiComponent);
-
-        if (valueBindingType == null)
-        {
-            return null;
-        }
-
-        return getOriginalApplication().createConverter(valueBindingType);
-    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
(original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
Thu Sep 11 14:33:05 2008
@@ -20,7 +20,6 @@
 
 import org.apache.myfaces.extensions.validator.core.ClassMappingFactory;
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
-import org.apache.myfaces.extensions.validator.core.adapter.DefaultConverterAdapterFactory;
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.DefaultAnnotationExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultMessageResolverFactory;
@@ -28,7 +27,6 @@
 import org.apache.myfaces.extensions.validator.core.validation.strategy.DefaultValidationStrategyFactory;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
 
-import javax.faces.convert.Converter;
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.List;
@@ -134,36 +132,4 @@
 
         return messageResolverFactory;
     }
-
-    private static ClassMappingFactory<Converter, Converter> converterAdapterFactory;
-
-    @Deprecated
-    public static ClassMappingFactory<Converter, Converter> getConverterAdapterFactory()
-    {
-        if (converterAdapterFactory == null)
-        {
-            List<String> converterAdapterFactoryClassNames = new ArrayList<String>();
-
-            converterAdapterFactoryClassNames
-                .add(WebXmlParameter.CUSTOM_CONVERTER_ADAPTER_FACTORY);
-            converterAdapterFactoryClassNames.add(ExtValUtils
-                .getInformationProviderBean()
-                .getCustomConverterAdapterFactory());
-            converterAdapterFactoryClassNames
-                .add(DefaultConverterAdapterFactory.class.getName());
-
-            for (String className : converterAdapterFactoryClassNames)
-            {
-                converterAdapterFactory = (ClassMappingFactory<Converter, Converter>)
ClassUtils
-                    .tryToInstantiateClassForName(className);
-
-                if (converterAdapterFactory != null)
-                {
-                    //TODO logging
-                    break;
-                }
-            }
-        }
-        return converterAdapterFactory;
-    }
 }
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
(added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
Thu Sep 11 14:33:05 2008
@@ -0,0 +1,118 @@
+/*
+ * 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.validator.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ReflectionUtils
+{
+    public static Method tryToGetMethod(Class targetClass, String targetMethodName)
+    {
+        return tryToGetMethod(targetClass, targetMethodName, null);
+    }
+
+    public static Method tryToGetMethod(Class targetClass, String targetMethodName, Class[]
parameterTypes)
+    {
+        try
+        {
+            return getMethod(targetClass, targetMethodName, parameterTypes);
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it's just a try
+            return null;
+        }
+    }
+
+    public static Method getMethod(Class targetClass, String targetMethodName)
+        throws NoSuchMethodException
+    {
+        return getMethod(targetClass, targetMethodName, null);
+    }
+
+    public static Method getMethod(Class targetClass, String targetMethodName, Class[] parameterTypes)
+        throws NoSuchMethodException
+    {
+        return targetClass.getMethod(targetMethodName, parameterTypes);
+    }
+
+    public static Object tryToInvokeMethod(Object target, Method method)
+    {
+        return tryToInvokeMethod(target, method, null);
+    }
+
+    public static Object tryToInvokeMethodOfClass(Class target, Method method)
+    {
+        return tryToInvokeMethodOfClass(target, method, null);
+    }
+
+    public static Object tryToInvokeMethodOfClass(Class target, Method method, Object[] args)
+    {
+        try
+        {
+            return invokeMethodOfClass(target, method, args);
+        }
+        catch (Throwable e)
+        {
+            //do nothing - it's just a try
+            return null;
+        }
+    }
+
+    public static Object invokeMethodOfClass(Class target, Method method)
+        throws IllegalAccessException, InstantiationException, InvocationTargetException
+    {
+        return invokeMethod(target.newInstance(), method, null);
+    }
+
+    public static Object invokeMethodOfClass(Class target, Method method, Object[] args)
+        throws IllegalAccessException, InstantiationException, InvocationTargetException
+    {
+        return invokeMethod(target.newInstance(), method, args);
+    }
+
+    public static Object tryToInvokeMethod(Object target, Method method, Object[] args)
+    {
+        try
+        {
+            return method.invoke(target, args);
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it's just a try
+            return null;
+        }
+    }
+
+    public static Object invokeMethod(Object target, Method method)
+        throws InvocationTargetException, IllegalAccessException
+    {
+        return invokeMethod(target, method, null);
+    }
+
+    public static Object invokeMethod(Object target, Method method, Object[] args)
+        throws InvocationTargetException, IllegalAccessException
+    {
+        return method.invoke(target, args);
+    }
+}

Modified: myfaces/extensions/validator/trunk/examples/adapter_demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/adapter_demo/pom.xml?rev=694494&r1=693976&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/examples/adapter_demo/pom.xml (original)
+++ myfaces/extensions/validator/trunk/examples/adapter_demo/pom.xml Thu Sep 11 14:33:05 2008
@@ -44,6 +44,13 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.myfaces.extensions.validator</groupId>
+            <artifactId>myfaces-extval-alternative</artifactId>
+            <version>${build.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
             <artifactId>myfaces-extval-property-validation</artifactId>
             <version>${build.version}</version>

Modified: myfaces/extensions/validator/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/pom.xml?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/examples/pom.xml (original)
+++ myfaces/extensions/validator/trunk/examples/pom.xml Thu Sep 11 14:33:05 2008
@@ -40,7 +40,8 @@
         <module>hello_world</module>
         <module>hello_jpa</module>
         <module>feature-set_01</module>
-        <module>fallback_demo</module>
+        <module>adapter_demo</module>
+        <module>proxy_demo</module>
     </modules>
 
     <properties>

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/pom.xml?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/pom.xml (added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/pom.xml Thu Sep 11 14:33:05 2008
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>war</packaging>
+
+    <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+    <artifactId>examples-proxy_demo</artifactId>
+
+    <name>MyFaces Extensions-Validator examples hello world</name>
+    <version>${build.version}</version>
+
+    <parent>
+        <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+        <artifactId>examples-project</artifactId>
+        <version>${build.version}</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator</groupId>
+            <artifactId>myfaces-extval-core</artifactId>
+            <version>${build.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator</groupId>
+            <artifactId>myfaces-extval-alternative</artifactId>
+            <version>${build.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+            <artifactId>myfaces-extval-property-validation</artifactId>
+            <version>${build.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <version>${jsf.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-impl</artifactId>
+            <version>${jsf.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>jstl</groupId>
+            <artifactId>jstl</artifactId>
+            <version>1.2</version>
+            <scope>runtime</scope>
+        </dependency>        
+
+    </dependencies>
+
+</project>

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/java/org/apache/myfaces/blank/HelloWorldController.java?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
(added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
Thu Sep 11 14:33:05 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.blank;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+/**
+ * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
+ * 
+ */
+public class HelloWorldController
+{
+
+    //properties
+    @Required
+    private String name;
+
+    /**
+     * default empty constructor
+     */
+    public HelloWorldController()
+    {
+    }
+
+    //-------------------getter & setter
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Method that is backed to a submit button of a form.
+     */
+    public String send()
+    {
+        //do real logic, return a string which will be used for the navigation system of
JSF
+        return "success";
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/faces-config.xml?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/faces-config.xml
(added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/faces-config.xml
Thu Sep 11 14:33:05 2008
@@ -0,0 +1,57 @@
+<!--
+ * 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.
+-->
+
+<faces-config version="1.2" 
+    xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+    <factory>
+        <application-factory>org.apache.myfaces.extensions.validator.core.proxy.ExtValApplicationFactory</application-factory>
+    </factory>
+    <lifecycle>
+        <phase-listener>org.apache.myfaces.extensions.validator.core.proxy.ProxyMappingPhaseListener</phase-listener>
+    </lifecycle>
+    
+    <!-- managed beans of the simple hello world app -->
+	<managed-bean>
+		<managed-bean-name>helloWorld</managed-bean-name>
+		<managed-bean-class>org.apache.myfaces.blank.HelloWorldController</managed-bean-class>
+		<managed-bean-scope>request</managed-bean-scope>
+	</managed-bean>
+	
+	<!-- navigation rules for helloWorld.jsp -->
+	<navigation-rule>
+		<from-view-id>/helloWorld.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>success</from-outcome>
+			<to-view-id>/page2.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+	
+	<!-- navigation rules for page2.jsp -->
+	<navigation-rule>
+		<from-view-id>/page2.jsp</from-view-id>
+		<navigation-case>
+			<from-outcome>back</from-outcome>
+			<to-view-id>/helloWorld.jsp</to-view-id>
+		</navigation-case>
+	</navigation-rule>
+</faces-config>
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/web.xml?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/web.xml
(added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/WEB-INF/web.xml
Thu Sep 11 14:33:05 2008
@@ -0,0 +1,182 @@
+<?xml version="1.0"?>
+
+<!--
+ * 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+         version="2.4">
+
+    <description>MyProject web.xml</description>
+
+    <!--optional: context-param>
+        <description>Comma separated list of URIs of (additional) faces config files.
+            (e.g. /WEB-INF/my-config.xml)
+            See JSF 1.0 PRD2, 10.3.2
+            Attention: You do not need to put /WEB-INF/faces-config.xml in here.
+        </description>
+        <param-name>javax.faces.CONFIG_FILES</param-name>
+        <param-value>/WEB-INF/examples-config.xml</param-value>
+    </context-param-->
+    <context-param>
+        <description>State saving method: "client" or "server" (= default)
+            See JSF Specification 2.5.3</description>
+        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+        <param-value>client</param-value>
+    </context-param>
+    <context-param>
+        <description>Only applicable if state saving method is "server" (= default).
+            Defines the amount (default = 20) of the latest views are stored in session.</description>
+        <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
+        <param-value>20</param-value>
+    </context-param>
+    <context-param>
+        <description>Only applicable if state saving method is "server" (= default).
+            If true (default) the state will be serialized to a byte stream before it
+            is written to the session.
+            If false the state will not be serialized to a byte stream.</description>
+        <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
+        <param-value>true</param-value>
+    </context-param>
+    <context-param>
+        <description>Only applicable if state saving method is "server" (= default)
and if
+            org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
+            If true (default) the serialized state will be compressed before it
+            is written to the session. If false the state will not be compressed.</description>
+        <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
+        <param-value>true</param-value>
+    </context-param>
+    <context-param>
+        <description>This parameter tells MyFaces if javascript code should be allowed
in the
+            rendered HTML output.
+            If javascript is allowed, command_link anchors will have javascript code
+            that submits the corresponding form.
+            If javascript is not allowed, the state saving info and nested parameters
+            will be added as url parameters.
+            Default: "true"</description>
+        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+        <param-value>true</param-value>
+    </context-param>
+    <context-param>
+        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+        <param-value>false</param-value>
+    </context-param>
+    <context-param>
+        <description>If true, rendered HTML code will be formatted, so that it is "human
readable".
+            i.e. additional line separators and whitespace will be written, that do not
+            influence the HTML code.
+            Default: "true"</description>
+        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+        <param-value>true</param-value>
+    </context-param>
+    <context-param>
+        <description>If true, a javascript function will be rendered that is able to
restore the
+            former vertical scroll on every request. Convenient feature if you have pages
+            with long lists and you do not want the browser page to always jump to the top
+            if you trigger a link or button action that stays on the same page.
+            Default: "false"</description>
+        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+        <param-value>true</param-value>
+    </context-param>
+
+    <context-param>
+        <description>Used for encrypting view state. Only relevant for client side
+            state saving. See MyFaces wiki/web site documentation for instructions
+            on how to configure an application for diffenent encryption strengths.
+        </description>
+        <param-name>org.apache.myfaces.SECRET</param-name>
+        <param-value>NzY1NDMyMTA=</param-value>
+    </context-param>
+
+    <context-param>
+        <description>
+            Validate managed beans, navigation rules and ensure that forms are not nested.
+        </description>
+        <param-name>org.apache.myfaces.VALIDATE</param-name>
+        <param-value>true</param-value>
+    </context-param>
+    
+    <context-param>
+        <description>
+            Treat readonly same as if disabled attribute was set for select elements.
+        </description>
+        <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
+        <param-value>true</param-value>
+    </context-param>    
+    
+    <context-param>
+        <description>
+            Use the defined class as the class which will be called when a resource is added
to the
+            ExtensionFilter handling. Using StreamingAddResource here helps with performance.
If you want to add
+            custom components and want to use the ExtensionFilter, you need to provide your
custom implementation here.
+        </description>
+        <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
+        <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
+    </context-param>        
+
+    <context-param>
+        <description>
+            Virtual path in the URL which triggers loading of resources for the MyFaces extended
components
+            in the ExtensionFilter.
+        </description>
+        <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
+        <param-value>/faces/myFacesExtensionResource</param-value>
+    </context-param>
+    
+    <context-param>
+        <description>
+            Check if the extensions-filter has been properly configured.
+        </description>
+        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
+        <param-value>true</param-value>
+    </context-param>    
+
+    <context-param>
+        <description>
+            Define partial state saving as true/false.
+        </description>
+        <param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
+        <param-value>false</param-value>
+    </context-param>    
+
+    <!-- Listener, to allow Jetty serving MyFaces apps -->
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+
+    <!-- Faces Servlet -->
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <!-- Faces Servlet Mapping -->
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.jsf</url-pattern>
+    </servlet-mapping>
+
+    <!-- Welcome files -->
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+</web-app>

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/helloWorld.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/helloWorld.jsp?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/helloWorld.jsp
(added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/helloWorld.jsp
Thu Sep 11 14:33:05 2008
@@ -0,0 +1,22 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+    <head>
+        <title>Hello World</title>
+    </head>
+    <body>
+        <f:view>
+            <h:form id="mainForm">
+              <h:panelGrid columns="3">
+                <h:outputLabel for="name" value="Please enter your name" />
+                <h:inputText id="name" value="#{helloWorld.name}"/>
+                <h:message for="name" showSummary="true" showDetail="false"/>
+
+                <h:commandButton value="Press me" action="#{helloWorld.send}"/>
+                <h:panelGroup/>
+                <h:panelGroup/>
+              </h:panelGrid>
+            </h:form>
+        </f:view>
+    </body>
+</html>

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/index.jsp?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/index.jsp (added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/index.jsp Thu Sep
11 14:33:05 2008
@@ -0,0 +1,4 @@
+<%@ page session="false"%>
+<%
+response.sendRedirect("helloWorld.jsf");
+%>
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/page2.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/page2.jsp?rev=694494&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/page2.jsp (added)
+++ myfaces/extensions/validator/trunk/examples/proxy_demo/src/main/webapp/page2.jsp Thu Sep
11 14:33:05 2008
@@ -0,0 +1,17 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+    <head>
+        <title>Hello World</title>
+    </head>
+    <body>
+        <f:view>
+            <h:form id="mainForm">
+                <h2><h:outputText value="Hello #{helloWorld.name}. We hope you enjoy
Apache MyFaces"/></h2>
+                <h:commandLink action="back">
+                    <h:outputText value="Home"/>
+                </h:commandLink>
+            </h:form>
+        </f:view>
+    </body>
+</html>
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/pom.xml?rev=694494&r1=694493&r2=694494&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/pom.xml (original)
+++ myfaces/extensions/validator/trunk/pom.xml Thu Sep 11 14:33:05 2008
@@ -34,6 +34,7 @@
         <module>core</module>
         <module>validation-modules</module>
         <module>examples</module>
+        <module>alternative</module>
     </modules>
 
     <properties>



Mime
View raw message