DefaultSlingServlet.spool is fragile w.r.t content-types
--------------------------------------------------------

                 Key: SLING-135
                 URL: https://issues.apache.org/jira/browse/SLING-135
             Project: Sling
          Issue Type: Bug
            Reporter: Bertrand Delacretaz
            Priority: Minor


That method currently uses this code to set the content-type when spooling 
files:

 protected void spool(URL url, SlingHttpServletResponse res) throws IOException 
{
        URLConnection conn = url.openConnection();

        // this previously used conn.getContentType(), but see SLING-112
        res.setContentType(getServletContext().getMimeType(url.getFile()));

Problem is, if microsling runs under a path that contains dots, like 

  /usling.1.2/install, 

url.getFile() returns the full path including dots, like 

  /usling.1.2/install/foo/index.html

and that failed on me when running with a somewhat exotic servlet engine, which 
probably broke the string after the first dot, didn't find a content-type and 
didn't accept getting null as a content-type.

This should be made more robust.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to