tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1383027 - in /tomcat/sandbox/trunk-resources/java/org/apache/catalina: Context.java WebResourceRoot.java core/StandardContext.java startup/FailedContext.java webresources/DirResourceSet.java webresources/StandardRoot.java
Date Mon, 10 Sep 2012 18:33:21 GMT
Author: markt
Date: Mon Sep 10 18:33:21 2012
New Revision: 1383027

URL: http://svn.apache.org/viewvc?rev=1383027&view=rev
Log:
Make processing /WEB-INF/classes/META-INF/resources consistent and drive by Context setting.

Modified:
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/Context.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/DirResourceSet.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/Context.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/Context.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/Context.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/Context.java Mon Sep 10 18:33:21
2012
@@ -1410,5 +1410,21 @@ public interface Context extends Contain
      * @param manager The newly associated Manager
      */
     public void setManager(Manager manager);
+
+    /**
+     * Sets the flag that indicates if /WEB-INF/classes should be treated like
+     * an exploded JAR and JAR resources made available as if they were in a
+     * JAR.
+     *
+     * @param addWebinfClassesResources The new value for the flag
+     */
+    public void setAddWebinfClassesResources(boolean addWebinfClassesResources);
+
+    /**
+     * Gets the flag that indicates if /WEB-INF/classes should be treated like
+     * an exploded JAR and JAR resources made available as if they were in a
+     * JAR.
+     */
+    public boolean getAddWebinfClassesResources();
 }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java Mon Sep 10
18:33:21 2012
@@ -215,6 +215,12 @@ public interface WebResourceRoot extends
     void createWebResourceSet(ResourceSetType type, File file,
             String webAppMount, String internalPath);
 
+    /**
+     *
+     * @return
+     */
+    boolean getAddWebinfClassesResources();
+
     void setAllowLinking(boolean allowLinking);
 
     public static enum ResourceSetType {

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java Mon
Sep 10 18:33:21 2012
@@ -861,12 +861,14 @@ public class StandardContext extends Con
     }
 
 
+    @Override
     public void setAddWebinfClassesResources(
             boolean addWebinfClassesResources) {
         this.addWebinfClassesResources = addWebinfClassesResources;
     }
 
 
+    @Override
     public boolean getAddWebinfClassesResources() {
         return addWebinfClassesResources;
     }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java Mon
Sep 10 18:33:21 2012
@@ -673,4 +673,11 @@ public class FailedContext extends Lifec
 
     @Override
     public File getCatalinaBase() { return null; }
+
+    @Override
+    public void setAddWebinfClassesResources(boolean addWebinfClassesResources) {
+        // NO-OP
+    }
+    @Override
+    public boolean getAddWebinfClassesResources() { return false; }
 }
\ No newline at end of file

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/DirResourceSet.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/DirResourceSet.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/DirResourceSet.java
(original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/DirResourceSet.java
Mon Sep 10 18:33:21 2012
@@ -45,14 +45,14 @@ public class DirResourceSet implements W
         this.base = base;
         this.webAppMount = webAppMount;
 
-        // Special case to handle Resource JARs that have been unpacked under
-        // /WEB-INF/classes
-        WebResource unpackedResourceJar =
-                getResource("/WEB-INF/classes/META-INF/resources");
-        if (unpackedResourceJar.exists()) {
-            root.createWebResourceSet(ResourceSetType.RESOURCE_JAR,
-                    ((FileResource) unpackedResourceJar).getResourceInternal() ,
-                    "", "");
+        if (root.getAddWebinfClassesResources()) {
+            WebResource unpackedResourceJar =
+                    getResource("/WEB-INF/classes/META-INF/resources");
+            if (unpackedResourceJar.exists()) {
+                root.createWebResourceSet(ResourceSetType.RESOURCE_JAR,
+                        ((FileResource) unpackedResourceJar).getResourceInternal() ,
+                        "", "");
+            }
         }
     }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java?rev=1383027&r1=1383026&r2=1383027&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
(original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
Mon Sep 10 18:33:21 2012
@@ -212,6 +212,11 @@ public class StandardRoot extends Lifecy
         return context.getName();
     }
 
+    @Override
+    public boolean getAddWebinfClassesResources() {
+        return context.getAddWebinfClassesResources();
+    }
+
     private void checkState() {
         if (!getState().isAvailable()) {
             throw new IllegalStateException(



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message