FELIX-1636 - Only perform the html check in the adapter.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@818499 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
index cc356f4..cf190de 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
@@ -32,6 +32,7 @@
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.servlet.ServletRequestContext;
+import org.apache.felix.webconsole.internal.WebConsolePluginAdapter;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -128,19 +129,13 @@
/**
* Detects whether this request is intended to have the headers and
- * footers of this plugin be rendered or not. The decision is taken based
- * on whether and what extension the request URI has: If the request URI
- * has no extension or the the extension is <code>.html</code>, the request
- * is assumed to be rendered with header and footer. Otherwise the
- * headers and footers are omitted and the
- * {@link #renderContent(HttpServletRequest, HttpServletResponse)}
- * method is called without any decorations and without setting any
- * response headers.
+ * footers of this plugin be rendered or not. This method always returns
+ * <code>true</true> but has been overwritten in the
+ * {@link WebConsolePluginAdapter} for the plugins.
*/
protected boolean isHtmlRequest( final HttpServletRequest request )
{
- final String requestUri = request.getRequestURI();
- return requestUri.endsWith( ".html" ) || requestUri.lastIndexOf( '.' ) < 0;
+ return true;
}
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 cc7b462..94d517d 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
@@ -21,11 +21,7 @@
import java.io.IOException;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
+import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -118,6 +114,22 @@
plugin.init( config );
}
+ /**
+ * Detects whether this request is intended to have the headers and
+ * footers of this plugin be rendered or not. The decision is taken based
+ * on whether and what extension the request URI has: If the request URI
+ * has no extension or the the extension is <code>.html</code>, the request
+ * is assumed to be rendered with header and footer. Otherwise the
+ * headers and footers are omitted and the
+ * {@link #renderContent(HttpServletRequest, HttpServletResponse)}
+ * method is called without any decorations and without setting any
+ * response headers.
+ */
+ protected boolean isHtmlRequest( final HttpServletRequest request )
+ {
+ final String requestUri = request.getRequestURI();
+ return requestUri.endsWith( ".html" ) || requestUri.lastIndexOf( '.' ) < 0;
+ }
/**
* Directly refer to the plugin's service method unless the request method