FELIX-1043 Only have the abstract web console plugin handle the request
for GET requests. Other requests are forwarded to the plugin directly.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@789260 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
index 45001a9..d7a38cf 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
@@ -24,6 +24,8 @@
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -118,6 +120,28 @@
/**
+ * Directly refer to the plugin's service method unless the request method
+ * is <code>GET</code> in which case we defer the call into the service method
+ * until the abstract web console plugin calls the
+ * {@link #renderContent(HttpServletRequest, HttpServletResponse)}
+ * method.
+ */
+ public void service( ServletRequest req, ServletResponse resp ) throws ServletException, IOException
+ {
+ if ( ( req instanceof HttpServletRequest ) && ( ( HttpServletRequest ) req ).getMethod().equals( "GET" ) )
+ {
+ // not GET request, have the plugin handle it directly
+ super.service( req, resp );
+ }
+ else
+ {
+ // handle the GET request here and call into plugin on renderContent
+ plugin.service( req, resp );
+ }
+ }
+
+
+ /**
* Destroys this servlet as well as the plugin servlet.
*/
public void destroy()