package com.altamiracorp.miniweb;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;

public class StaticFileHandler implements Handler {
    private final RequestDispatcher handler;

    public StaticFileHandler(ServletConfig config) {
        handler = config.getServletContext().getNamedDispatcher("default");
    }

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, HandlerChain chain) throws Exception {
        HttpServletRequest wrapped = new HttpServletRequestWrapper(request) {
            public String getServletPath() { return ""; }
        };
        handler.forward(wrapped, response);
    }
}

@@ -347,16 +347,51 @@
 handler;
+%0A    private final String pathInfo;
 %0A%0A    pu
@@ -441,24 +441,134 @@
 ) %7B%0A        
+this(config, null);%0A    %7D%0A%0A    public StaticFileHandler(ServletConfig config, String pathInfo) %7B%0A        this.
 handler = co
@@ -623,16 +623,50 @@
 ault%22);%0A
+        this.pathInfo = pathInfo;%0A
     %7D%0A%0A 
@@ -872,24 +872,46 @@
 (request) %7B%0A
+            @Override%0A
             
@@ -946,19 +946,294 @@
 () %7B
- return %22%22;
+%0A                return %22%22;%0A            %7D%0A%0A            @Override%0A            public String getPathInfo() %7B%0A                if (pathInfo == null) %7B%0A                    return super.getPathInfo();%0A                %7D else %7B%0A                    return pathInfo;%0A                %7D%0A           
  %7D%0A 

support optional pathInfo for StaticFileHandler