You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/05/02 16:04:14 UTC

svn commit: r1098579 - in /myfaces/core/branches/2.1.x: ./ implee6/ implee6/src/main/java/org/apache/myfaces/ee6/ shaded-impl/ shaded-impl/src/ shaded-impl/src/main/ shaded-impl/src/main/java/ shaded-impl/src/main/resources/

Author: lu4242
Date: Mon May  2 14:04:14 2011
New Revision: 1098579

URL: http://svn.apache.org/viewvc?rev=1098579&view=rev
Log:
MYFACES-3093 Check FacesServlet description for support servlet 3.0 spec 

Added:
    myfaces/core/branches/2.1.x/shaded-impl/   (with props)
    myfaces/core/branches/2.1.x/shaded-impl/pom.xml
    myfaces/core/branches/2.1.x/shaded-impl/src/
    myfaces/core/branches/2.1.x/shaded-impl/src/main/
    myfaces/core/branches/2.1.x/shaded-impl/src/main/java/
    myfaces/core/branches/2.1.x/shaded-impl/src/main/resources/
Modified:
    myfaces/core/branches/2.1.x/implee6/pom.xml
    myfaces/core/branches/2.1.x/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
    myfaces/core/branches/2.1.x/pom.xml

Modified: myfaces/core/branches/2.1.x/implee6/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/implee6/pom.xml?rev=1098579&r1=1098578&r2=1098579&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/implee6/pom.xml (original)
+++ myfaces/core/branches/2.1.x/implee6/pom.xml Mon May  2 14:04:14 2011
@@ -55,6 +55,13 @@
             <artifactId>myfaces-shared-impl</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-shaded-impl</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
         <!-- in this module we need Servlet 3.0 (instead of 2.5) -->
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: myfaces/core/branches/2.1.x/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java?rev=1098579&r1=1098578&r2=1098579&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java (original)
+++ myfaces/core/branches/2.1.x/implee6/src/main/java/org/apache/myfaces/ee6/MyFacesContainerInitializer.java Mon May  2 14:04:14 2011
@@ -18,7 +18,9 @@
  */
 package org.apache.myfaces.ee6;
 
+import java.net.URL;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -37,14 +39,19 @@ import javax.faces.bean.RequestScoped;
 import javax.faces.bean.SessionScoped;
 import javax.faces.bean.ViewScoped;
 import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponent;
 import javax.faces.component.behavior.FacesBehavior;
+import javax.faces.context.ExternalContext;
+import javax.faces.convert.Converter;
 import javax.faces.convert.FacesConverter;
 import javax.faces.event.ListenerFor;
 import javax.faces.event.ListenersFor;
 import javax.faces.event.NamedEvent;
 import javax.faces.render.FacesBehaviorRenderer;
 import javax.faces.render.FacesRenderer;
+import javax.faces.render.Renderer;
 import javax.faces.validator.FacesValidator;
+import javax.faces.validator.Validator;
 import javax.faces.webapp.FacesServlet;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContainerInitializer;
@@ -53,7 +60,10 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRegistration;
 import javax.servlet.annotation.HandlesTypes;
 
+import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
 import org.apache.myfaces.shared_impl.webapp.webxml.DelegatedFacesServlet;
+import org.apache.myfaces.spi.FacesConfigResourceProvider;
+import org.apache.myfaces.spi.FacesConfigResourceProviderFactory;
 
 /**
  * This class is called by any Java EE 6 complaint container at startup.
@@ -86,7 +96,11 @@ import org.apache.myfaces.shared_impl.we
         ResourceDependencies.class,
         ResourceDependency.class,
         SessionScoped.class,
-        ViewScoped.class
+        ViewScoped.class,
+        UIComponent.class,
+        Converter.class,
+        Renderer.class,
+        Validator.class
     })
 public class MyFacesContainerInitializer implements ServletContainerInitializer
 {
@@ -113,11 +127,17 @@ public class MyFacesContainerInitializer
         if (startDireclty)
         {
             // if the INITIALIZE_ALWAYS_STANDALONE param was set to true,
-            // we do not want to have the FacesServlet beeing added, we simply 
+            // we do not want to have the FacesServlet being added, we simply 
             // do no extra configuration in here.
             return;
         }
 
+        // Check for one or more of this conditions:
+        // 1. A faces-config.xml file is found in WEB-INF
+        // 2. A faces-config.xml file is found in the META-INF directory of a jar in the application's classpath.
+        // 3. A filename ending in .faces-config.xml is found in the META-INF directory of a jar in the application's classpath.
+        // 4. The javax.faces.CONFIG_FILES context param is declared in web.xml or web-fragment.xml.
+        // 5. The Set of classes passed to the onStartup() method of the ServletContainerInitializer implementation is not empty.
         if ((clazzes != null && !clazzes.isEmpty()) || isFacesConfigPresent(servletContext))
         {
             // look for the FacesServlet
@@ -192,9 +212,11 @@ public class MyFacesContainerInitializer
     {
         try
         {
+            // 1. A faces-config.xml file is found in WEB-INF
             if (servletContext.getResource(FACES_CONFIG_RESOURCE) != null)
                 return true;
 
+            // 4. The javax.faces.CONFIG_FILES context param is declared in web.xml or web-fragment.xml.
             // check for alternate faces-config files specified by javax.faces.CONFIG_FILES
             String configFilesAttrValue = servletContext.getInitParameter(FacesServlet.CONFIG_FILES_ATTR);
             if (configFilesAttrValue != null)
@@ -207,6 +229,20 @@ public class MyFacesContainerInitializer
                 }
             }
 
+            // 2. A faces-config.xml file is found in the META-INF directory of a jar in the application's classpath.
+            // 3. A filename ending in .faces-config.xml is found in the META-INF directory of a jar in the application's classpath.
+            // To do this properly it is necessary to use some SPI interfaces MyFaces already has, to deal with OSGi and other
+            // environments properly.
+            ExternalContext externalContext = new StartupServletExternalContextImpl(servletContext, true);
+            FacesConfigResourceProviderFactory factory = FacesConfigResourceProviderFactory.getFacesConfigResourceProviderFactory(externalContext);
+            FacesConfigResourceProvider provider = factory.createFacesConfigResourceProvider(externalContext);
+            Collection<URL> metaInfFacesConfigUrls =  provider.getMetaInfConfigurationResources(externalContext);
+            
+            if (metaInfFacesConfigUrls != null && !metaInfFacesConfigUrls.isEmpty())
+            {
+                return true;
+            }
+            
             return false;
         }
         catch (Exception e)

Modified: myfaces/core/branches/2.1.x/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/pom.xml?rev=1098579&r1=1098578&r2=1098579&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/pom.xml (original)
+++ myfaces/core/branches/2.1.x/pom.xml Mon May  2 14:04:14 2011
@@ -49,6 +49,7 @@
 
     <modules>
         <module>api</module>
+        <module>shaded-impl</module>
         <module>implee6</module>
         <module>impl</module>
         <module>bundle</module>

Propchange: myfaces/core/branches/2.1.x/shaded-impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon May  2 14:04:14 2011
@@ -0,0 +1,12 @@
+*.iml
+*.ipr
+*.iws
+*.jdbc
+.classpath
+.externalToolBuilders
+.project
+.settings
+derby.log
+maven-eclipse.xml
+myfacesOrchestraDB
+target

Added: myfaces/core/branches/2.1.x/shaded-impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/shaded-impl/pom.xml?rev=1098579&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/shaded-impl/pom.xml (added)
+++ myfaces/core/branches/2.1.x/shaded-impl/pom.xml Mon May  2 14:04:14 2011
@@ -0,0 +1,300 @@
+<?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">
+
+    <parent>
+        <groupId>org.apache.myfaces.core</groupId>
+        <artifactId>myfaces-core-project</artifactId>
+        <version>2.1.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    
+    <groupId>org.apache.myfaces.core</groupId>
+    <artifactId>myfaces-shaded-impl</artifactId>
+    <name>Apache MyFaces JSF-2.1 Core Shaded Impl</name>
+    <description>
+        Provides a shaded copy of impl, to allow implee6 module to use myfaces-impl SPI API and keep jdk 1.5 compatible
+    </description>
+    <url>http://myfaces.apache.org/core21/myfaces-shaded-impl</url>
+
+    <scm>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.1.x/shaded-impl</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/core/branches/2.1.x/shaded-impl</developerConnection>
+        <url>https://svn.apache.org/repos/asf/myfaces/core/branches/2.1.x/shaded-impl</url>
+    </scm>
+    
+    <build>
+        
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        
+        <plugins>
+           <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-dependency-plugin</artifactId>
+               <version>2.0</version>
+               <executions>
+                   <execution>
+                       <id>unpack-shared-impl</id>
+                       <phase>process-classes</phase>
+                       <goals>
+                           <goal>unpack</goal>
+                       </goals>
+                       <configuration>
+                           <artifactItems>
+                               <artifactItem>
+                                   <groupId>org.apache.myfaces.core</groupId>
+                                   <artifactId>myfaces-impl</artifactId>
+                                   <version>2.0.5</version>
+                                   <excludes>org/apache/myfaces/ee6/*</excludes>
+                               </artifactItem>
+                           </artifactItems>
+                           <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                       </configuration>
+                   </execution>
+                   
+                   <execution>
+                       <id>unpack-shared-impl-sources</id>
+                       <phase>process-sources</phase>
+                       <goals>
+                           <goal>unpack</goal>
+                       </goals>
+                       <configuration>
+                           <artifactItems>
+                               <artifactItem>
+                                   <groupId>org.apache.myfaces.core</groupId>
+                                   <artifactId>myfaces-impl</artifactId>
+                                   <version>2.0.5</version>
+                                   <classifier>sources</classifier>
+                                   <excludes>org/apache/myfaces/ee6/*</excludes>
+                               </artifactItem>
+                           </artifactItems>
+                           <outputDirectory>${project.build.directory}/impl_sources</outputDirectory>
+                       </configuration>
+                   </execution>
+             
+               </executions>
+           </plugin>
+           
+           <plugin>
+               <!--
+                   Add the unpacked shared sources directory as source directory into the pom datastructure,
+                   so that the -source jar includes them too; every .class file in the jar should have its
+                   source in the -source jar.
+               -->
+               <groupId>org.codehaus.mojo</groupId>
+               <artifactId>build-helper-maven-plugin</artifactId>
+               <version>1.0</version>
+               <executions>
+                   <execution>
+                       <id>add-source-shared</id>
+                       <phase>process-sources</phase>
+                       <goals>
+                           <goal>add-source</goal>
+                       </goals>
+                       <configuration>
+                           <sources>
+                               <source>${project.build.directory}/impl_sources</source>
+                           </sources>
+                       </configuration>
+                   </execution>
+               </executions>
+           </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <!-- NOTE that all versions and scopes are defined in the parent dependencyManagement section -->
+
+        <!-- myfaces-api -->
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+        </dependency>
+
+        <!-- this dependency will be packed together with the main artifact of this pom -->
+        <dependency>
+            <groupId>org.apache.myfaces.shared</groupId>
+            <artifactId>myfaces-shared-impl</artifactId>
+        </dependency>
+
+        <!-- Servlet 2.5 -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </dependency>
+
+        <!-- JSP 2.1 -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jsp_2.1_spec</artifactId>
+        </dependency>
+
+        <!-- JSTL 1.2 -->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jstl</artifactId>
+        </dependency>
+
+        <!-- el 2.2 (javax.el.*) -->
+        <!--
+            NOTE that we are also compatible with el 1.0, but we need to use el 2.2 as
+            compile-dependency, because our ValueExpression wrappers need to support getValueReference().
+        -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-el_2.2_spec</artifactId>
+        </dependency>
+
+        <!-- bean-validation 1.0 (javax.validation.*) -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-validation_1.0_spec</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+        
+        <!-- annotations 1.0 (javax.annotation.*) -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.0_spec</artifactId>
+        </dependency>
+
+        <!-- jpa 3.0 - needed in AllAnnotationLifecycleProvider -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_3.0_spec</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+
+        <!-- ejb 3.0 - needed in AllAnnotationLifecycleProvider -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.0_spec</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+
+        <!-- builder-annotations like @JSFWebConfigParam -->
+        <dependency>
+            <groupId>org.apache.myfaces.buildtools</groupId>
+            <artifactId>myfaces-builder-annotations</artifactId>
+        </dependency>
+
+        <!-- commons dependencies -->
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+       
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-digester</groupId>
+            <artifactId>commons-digester</artifactId>
+        </dependency>
+
+        <!-- tomcat 6.0.x support (LifecycleProvider) -->
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>catalina</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+
+        <!-- tomcat 7 support (LifecycleProvider) -->
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-catalina</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+
+        <!-- Google guice support (GuiceResolver) -->
+        <dependency>
+            <groupId>com.google.code.guice</groupId>
+            <artifactId>guice</artifactId>
+            <optional>true</optional> <!-- optional does not completely work in dependencyManagement (MNG-1630) -->
+        </dependency>
+        
+
+        <!-- TEST DEPENDENCIES -->
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <classifier>jdk15</classifier>
+        </dependency>
+
+        <!-- test cases of myfaces-api -->
+        <dependency>
+            <groupId>org.apache.myfaces.core</groupId>
+            <artifactId>myfaces-api</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.myfaces.test</groupId>
+            <artifactId>myfaces-test20</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cactus</groupId>
+            <artifactId>cactus</artifactId>
+        </dependency>
+
+        <!-- easymock -->
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+        </dependency>
+
+        <!-- We need a real EL implementation for test ui:param tag,
+        because myfaces-test MockExpressionFactory is not designed to
+        handle VariableMapper stuff (see IncludeParamTestCase) -->
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>el-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>jasper-el</artifactId>
+        </dependency>
+
+    </dependencies>
+
+
+</project>