You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/04/03 18:43:47 UTC

[Bug 57791] New: Tomcat 8 Resources doesn't work with Servlet 3.0 META-INF/resources

https://bz.apache.org/bugzilla/show_bug.cgi?id=57791

            Bug ID: 57791
           Summary: Tomcat 8 Resources doesn't work with Servlet 3.0
                    META-INF/resources
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: iluvtr@gmail.com

Created attachment 32630
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32630&action=edit
Sample projects demonstrating the bug

In Tomcat 8 the Resources framework intented for loading JSP, static resources
and JAR, doesn't work with resources located in META-INF/resources as specified
by Servlet 3.0 specification.  In Tomcat 7 with the old VirtualWebLoader this
feature worked pretty well.

For example you have a JAR with this content

/META-INF/resources/admin/test.jsp
/META-INF/resources/admin/test.js
/META-INF/resources/tags/test.tag
/META-INF/tlds/javapp.tld 

Normally with Servlet 3.0 feature you can access this files for example:

http://localhost:8080/webapp/admin/test.jsp Doesn't work, 404 for you

Tag libraries declared in JARs including those linking to Tag files doesn't
work too
For example this Tag Library located at /META-INF/tlds/javapp.tld doesn't work

<taglib>
  <tlib-version>1.0</tlib-version>
  <short-name>javaapp</short-name>
  <uri>/javaapp</uri>
  <tag-file>
    <name>test</name>
    <path>/META-INF/tags/test.tag</path>
  </tag-file>
</taglib>


I tried with the following configurations in context.xml

This
<?xml version="1.0" encoding="UTF-8"?>
<Context  path="/webapp"  >   

    <Resources>

        <PostResources
className="org.apache.catalina.webresources.DirResourceSet"
                       base="D:/PROYECTOS/modules/javaapp/target/classes"
                       internalPath="/"
                       webAppMount="/WEB-INF/classes" />

    </Resources>

</Context>


And this

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/webapp"  >   

    <Resources>


  <JarResources className="org.apache.catalina.webresources.JarResourceSet"
                      
base="D:/PROYECTOS/modules/javaapp/target/javaapp-1.0-SNAPSHOT.jar"
                       internalPath="/"
                       webAppMount="/WEB-INF/lib" />

    </Resources>

</Context>


I'm attaching the projects, all you have to do is change the base attribute of
the Resources

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 57791] Tomcat 8 Resources doesn't work with Servlet 3.0 META-INF/resources

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57791

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
The provided test case fails because it is using the wrong configuration to map
the external JAR into the web application. Even though the file is a JAR, it
needs to be mapped as a file, not as a JAR. Mapping as a JAR exposes the
contents of the JAR to the web application which is not what is required. A
working configuration is:

<PreResources className="org.apache.catalina.webresources.FileResourceSet"
             
base="D:/PROYECTOS/modules/javaapp/target/javaapp-1.0-SNAPSHOT.jar"
              internalPath="/"
              webAppMount="/WEB-INF/lib/javaapp-1.0-SNAPSHOT.jar" />

This tells Tomcat to treat this external file as it it was located within the
web application.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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