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 2012/09/11 22:28:09 UTC

[Bug 53854] New: DefaultServlet directory listings for aliased directories do not seem to work

https://issues.apache.org/bugzilla/show_bug.cgi?id=53854

          Priority: P2
            Bug ID: 53854
          Assignee: dev@tomcat.apache.org
           Summary: DefaultServlet directory listings for aliased
                    directories do not seem to work
          Severity: minor
    Classification: Unclassified
                OS: All
          Reporter: dmikusa@vmware.com
          Hardware: All
            Status: NEW
           Version: 7.0.30
         Component: Catalina
           Product: Tomcat 7

The following situation does not seem to work.

1.) In a Context, add an alias to a directory.
2.) Enable directory listings on the DefaultServlet.
3.) Try to view the directory listing of the alias directory.

Example:

conf/context.xml:

  <Context aliases="/files=/my/downloads">
  ...
  </Context>

conf/web.xml:

    ...
    <servlet>
        <servlet-name>default</servlet-name>
       
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    ...

contents of the directory "/my/downloads":

  -rw-r--r--@ 1 daniel  staff  8156824 Sep 10 09:15 apache-tomcat-7.0.30.zip

URL works:

http://localhost:8080/files/apache-tomcat-7.0.30.zip

URL does not work:

http://localhost:8080/files/

The URL that does not work fails with the error:

SEVERE: Servlet.service() for servlet [default] in context with path [/] threw
exception [Error accessing resource] with root cause
javax.naming.NameNotFoundException: Resource /files/ not found
    at org.apache.naming.resources.FileDirContext.list(FileDirContext.java:303)
    at
org.apache.naming.resources.ProxyDirContext.list(ProxyDirContext.java:512)
    at
org.apache.catalina.servlets.DefaultServlet.renderHtml(DefaultServlet.java:1458)
    at
org.apache.catalina.servlets.DefaultServlet.render(DefaultServlet.java:1254)
    at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:951)
    at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:412)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

-- 
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 53854] DefaultServlet directory listings for aliased directories do not seem to work

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
This has been fixed in trunk and 7.0.x and will be included in 7.0.31 onwards.

-- 
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 53854] DefaultServlet directory listings for aliased directories do not seem to work

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

--- Comment #1 from Daniel Mikusa <dm...@vmware.com> ---
Created attachment 29357
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29357&action=edit
Patch to DefaultServlet to workaround the error.

I was able to work around this error with a slight modification to the
DefaultServlet code.  Not sure if this is the best solution, but it seems to
work without breaking anything so I'm attaching it here.

-- 
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 53854] DefaultServlet directory listings for aliased directories do not seem to work

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

Daniel Mikusa <dm...@vmware.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29357|0                           |1
        is obsolete|                            |

--- Comment #3 from Daniel Mikusa <dm...@vmware.com> ---
Created attachment 29384
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29384&action=edit
Updated patch, works with BaseDirContext and FileDirContext

-- 
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 53854] DefaultServlet directory listings for aliased directories do not seem to work

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

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
The proposed patch fixes the symptom rather than the cause. The fix needs to be
in BaseDirContext and other classes in the same package.

-- 
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 53854] DefaultServlet directory listings for aliased directories do not seem to work

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

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
The patch is not functionally correct for FileDirContext and still does not
address the root cause.

Issue include:
- ignores WARDirContext
- ignores 3rd party sub-classes
- does not use correct priority for aliases

-- 
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