/*
 * Copyright 2007-2009 Sun Microsystems, Inc.
 * This source code is available under the MIT license.
 * See the file LICENSE.txt for details.
 */

package org.jruby.rack;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jruby.rack.servlet.DefaultServletDispatcher;
import org.jruby.rack.servlet.ServletDispatcher;
import org.jruby.rack.servlet.ServletRackContext;

/**
 *
 * @author nicksieger
 */
public class RackServlet extends HttpServlet {
    private ServletDispatcher dispatcher;

    /** Default ctor, used by servlet container */
    public RackServlet() {
    }

    /** dependency injection ctor, used by unit tests */
    public RackServlet(ServletDispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    @Override
    public void init(ServletConfig config) {
        this.dispatcher = new DefaultServletDispatcher(new ServletRackContext(config.getServletContext()));
    }

    @Override
    public void service(ServletRequest request, ServletResponse response)
        throws ServletException, IOException {
        dispatcher.process((HttpServletRequest) request, (HttpServletResponse) response);
    }

}

@@ -1213,16 +1213,20 @@
 service(
+Http
 ServletR
@@ -1241,16 +1241,20 @@
 equest, 
+Http
 ServletR
@@ -1345,16 +1345,194 @@
 process(
+request, response);%0A    %7D%0A%0A    @Override%0A    public void service(ServletRequest request, ServletResponse response)%0A        throws ServletException, IOException %7B%0A        service(
 (HttpSer
@@ -1592,11 +1592,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Add override for both Servlet and HttpServlet service methods (Michael Pitman)