You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "IngyHere (Commented) (JIRA)" <ji...@apache.org> on 2012/03/22 01:27:26 UTC

[jira] [Commented] (CXF-4190) directive fails with directories

    [ https://issues.apache.org/jira/browse/CXF-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235250#comment-13235250 ] 

IngyHere commented on CXF-4190:
-------------------------------

I'd be happy to have this assigned should it be judged a valid concern. I'll submit the fix. 
                
> <static-resources-list> directive fails with directories
> --------------------------------------------------------
>
>                 Key: CXF-4190
>                 URL: https://issues.apache.org/jira/browse/CXF-4190
>             Project: CXF
>          Issue Type: Bug
>          Components: Services, Transports
>    Affects Versions: 2.4, 2.5
>         Environment: CXF/Spring on Tomcat 6.x
>            Reporter: IngyHere
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The "static-resources-list" directive is provided as an alternative to serve static content through the service root and as an alternative to flying one's own DispatcherServlet. Unfortunately, it works only for files. This leads to the situation where people are going nuts trying to make workarounds when they set their base url-pattern directive to something like "/*" or they simply want to serve content directly under the service path. (See http://java-espresso.blogspot.com/2011/09/webxml-problem-and-solution-for-url.html for a comparable situation.) 
> The code at "org.apache.cxf.transport.servlet.AbstractHTTPServlet" in "serveStaticContent" provides an immediate check for content with 
> {code:title=Snippet|borderStyle=dashed}
> InputStream is = super.getServletContext().getResourceAsStream(pathInfo);
>         if (is == null) {
>             throw new ServletException("Static resource " + pathInfo + " is not available");
>         }
> {code}
> and, when this fails due a directory being passed in through the request, it's exception time. 
> An algorithm for serving static content should be implemented that assumes without an extension that the item passed in is a directory (and/or checks first for a trailing slash) and then attempts to serve up the name of the welcome file in the directory. 
> Alternately, this could all be just passed off to DefaultDispatcher to let it handle the edge cases. 
> Basically, this bug makes the "static-resources-list" directive effectively useless. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira