You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/06/29 10:35:39 UTC

svn commit: r789260 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java

Author: fmeschbe
Date: Mon Jun 29 08:35:39 2009
New Revision: 789260

URL: http://svn.apache.org/viewvc?rev=789260&view=rev
Log:
FELIX-1043 Only have the abstract web console plugin handle the request
for GET requests. Other requests are forwarded to the plugin directly.

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java?rev=789260&r1=789259&r2=789260&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java Mon Jun 29 08:35:39 2009
@@ -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()