package net.kencochrane.raven.servlet;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

@WebListener
public class RavenServletRequestListener implements ServletRequestListener {
    private static final ThreadLocal<HttpServletRequest> THREAD_REQUEST = new ThreadLocal<HttpServletRequest>();

    public static HttpServletRequest getServletRequest() {
        return THREAD_REQUEST.get();
    }

    @Override
    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
        THREAD_REQUEST.remove();
    }

    @Override
    public void requestInitialized(ServletRequestEvent servletRequestEvent) {
        if (servletRequestEvent instanceof HttpServletRequest)
            THREAD_REQUEST.set((HttpServletRequest) servletRequestEvent.getServletRequest());
    }
}

@@ -33,16 +33,53 @@
 rvlet;%0A%0A
+import javax.servlet.ServletRequest;%0A
 import j
@@ -786,16 +786,97 @@
         
+ServletRequest servletRequest = servletRequestEvent.getServletRequest();%0A        
 if (serv
@@ -884,21 +884,16 @@
 etReques
-tEven
 t instan
@@ -987,33 +987,8 @@
 uest
-Event.getServletRequest()
 );%0A 

Fix the extraction of the HttpServletRequest