Store servlet in servlet request, too.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Apr 2012 14:41:59 +0000 (16:41 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Apr 2012 14:41:59 +0000 (16:41 +0200)
src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java
src/main/java/net/pterodactylus/demoscenemusic/page/ServletRequest.java

index 098cfba..9b09108 100644 (file)
@@ -157,7 +157,7 @@ public class TemplateServlet extends HttpServlet {
                if (page != null) {
                        ServletRequest servletRequest;
                        try {
-                               servletRequest = new ServletRequest(request);
+                               servletRequest = new ServletRequest(request, this);
                        } catch (URISyntaxException use1) {
                                throw new IOException("Could not create URI from " + request.getRequestURI(), use1);
                        }
index 64e66c1..74d0450 100644 (file)
@@ -20,6 +20,7 @@ package net.pterodactylus.demoscenemusic.page;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 
 import net.pterodactylus.util.web.Method;
@@ -33,15 +34,17 @@ import net.pterodactylus.util.web.Request;
 public class ServletRequest extends Request {
 
        private final HttpServletRequest servletRequest;
+       private final HttpServlet servlet;
 
        /**
         * @param uri
         * @param method
         * @throws URISyntaxException
         */
-       public ServletRequest(javax.servlet.http.HttpServletRequest servletRequest) throws URISyntaxException {
+       public ServletRequest(javax.servlet.http.HttpServletRequest servletRequest, HttpServlet servlet) throws URISyntaxException {
                super(new URI(servletRequest.getRequestURI()), Method.valueOf(servletRequest.getMethod().toUpperCase()));
                this.servletRequest = servletRequest;
+               this.servlet = servlet;
        }
 
        /**
@@ -51,4 +54,11 @@ public class ServletRequest extends Request {
                return servletRequest;
        }
 
+       /**
+        * @return the servlet
+        */
+       public HttpServlet getServlet() {
+               return servlet;
+       }
+
 }