[ https://issues.apache.org/jira/browse/CXF-4190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13235487#comment-13235487 ]
Sergey Beryozkin commented on CXF-4190: --------------------------------------- Hi, this sounds reasonable. I'd propose to keep the original check and then proceed to checking if it is a directory within the if (is == null) branch, as I guess some non-directory might have no extensions too. Please attach a patch, thanks > <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