FELIX-1759: upgrade karaf to latest web console

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@825482 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/pom.xml b/karaf/pom.xml
index 07f6757..ec74eed 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -80,7 +80,7 @@
         <felix.osgi.version>1.4.0</felix.osgi.version>
         <felix.plugin.version>2.0.0</felix.plugin.version>
         <felix.prefs.version>1.0.2</felix.prefs.version>
-        <felix.webconsole.version>1.2.10</felix.webconsole.version>
+        <felix.webconsole.version>2.0.0</felix.webconsole.version>
         <felix.metatype.version>1.0.2</felix.metatype.version>
         <geronimo.blueprint.version>1.0.0</geronimo.blueprint.version>
         <geronimo.servlet.version>1.1.2</geronimo.servlet.version>
diff --git a/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AbstractResourceAwareWebConsolePlugin.java b/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AbstractResourceAwareWebConsolePlugin.java
deleted file mode 100644
index 4d741ef..0000000
--- a/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AbstractResourceAwareWebConsolePlugin.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *  Copyright 2009 Marcin.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *  under the License.
- */
-package org.apache.felix.karaf.webconsole.admin;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.OutputStream;
-import java.io.InputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-
-/**
- * TODO: remove this class when upgrading to webconsole 1.2.12
- */
-public abstract class AbstractResourceAwareWebConsolePlugin extends AbstractWebConsolePlugin {
-
-    public static final String GET_RESOURCE_METHOD_NAME = "getResource";
-
-    private final Method getResourceMethod;
-
-    {
-        getResourceMethod = getGetResourceMethod();
-    }
-
-    /**
-     * Renders the web console page for the request. This consist of the following
-     * five parts called in order:
-     * <ol>
-     * <li>Send back a requested resource
-     * <li>{@link #startResponse(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #renderTopNavigation(HttpServletRequest, PrintWriter)}</li>
-     * <li>{@link #renderContent(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #endResponse(PrintWriter)}</li>
-     * </ol>
-     * <p>
-     * <b>Note</b>: If a resource is sent back for the request only the first
-     * step is executed. Otherwise the first step is a null-operation actually
-     * and the latter four steps are executed in order.
-     */
-    protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
-            IOException
-    {
-        if ( !spoolResource( request, response ) )
-        {
-            PrintWriter pw = startResponse( request, response );
-            renderTopNavigation( request, pw );
-            renderContent( request, response );
-            endResponse( pw );
-        }
-    }
-
-    protected Object getResourceProvider() {
-        return this;
-    }
-
-    /**
-     * Returns a method which is called on the
-     * {@link #getResourceProvider() resource provder} class to return an URL
-     * to a resource which may be spooled when requested. The method has the
-     * following signature:
-     * <pre>
-     * [modifier] URL getResource(String path);
-     * </pre>
-     * Where the <i>[modifier]</i> may be <code>public</code>, <code>protected</code>
-     * or <code>private</code> (if the method is declared in the class of the
-     * resource provider). It is suggested to use the <code>private</code>
-     * modifier if the method is declared in the resource provider class or
-     * the <code>protected</code> modifier if the method is declared in a
-     * base class of the resource provider.
-     *
-     * @return The <code>getResource(String)</code> method or <code>null</code>
-     *      if the {@link #getResourceProvider() resource provider} is
-     *      <code>null</code> or does not provide such a method.
-     */
-    private Method getGetResourceMethod()
-    {
-        Method tmpGetResourceMethod = null;
-
-        Object resourceProvider = getResourceProvider();
-        if ( resourceProvider != null )
-        {
-            try
-            {
-                Class cl = resourceProvider.getClass();
-                while ( tmpGetResourceMethod == null && cl != Object.class )
-                {
-                    Method[] methods = cl.getDeclaredMethods();
-                    for ( int i = 0; i < methods.length; i++ )
-                    {
-                        Method m = methods[i];
-                        if ( GET_RESOURCE_METHOD_NAME.equals( m.getName() ) && m.getParameterTypes().length == 1
-                            && m.getParameterTypes()[0] == String.class && m.getReturnType() == URL.class )
-                        {
-                            // ensure modifier is protected or public or the private
-                            // method is defined in the plugin class itself
-                            int mod = m.getModifiers();
-                            if ( Modifier.isProtected( mod ) || Modifier.isPublic( mod )
-                                || ( Modifier.isPrivate( mod ) && cl == resourceProvider.getClass() ) )
-                            {
-                                m.setAccessible( true );
-                                tmpGetResourceMethod = m;
-                                break;
-                            }
-                        }
-                    }
-                    cl = cl.getSuperclass();
-                }
-            }
-            catch ( Throwable t )
-            {
-                tmpGetResourceMethod = null;
-            }
-        }
-
-        return tmpGetResourceMethod;
-    }
-
-    /**
-     * If the request addresses a resource which may be served by the
-     * <code>getResource</code> method of the
-     * {@link #getResourceProvider() resource provider}, this method serves it
-     * and returns <code>true</code>. Otherwise <code>false</code> is returned.
-     * <code>false</code> is also returned if the resource provider has no
-     * <code>getResource</code> method.
-     * <p>
-     * If <code>true</code> is returned, the request is considered complete and
-     * request processing terminates. Otherwise request processing continues
-     * with normal plugin rendering.
-     *
-     * @param request The request object
-     * @param response The response object
-     * @return <code>true</code> if the request causes a resource to be sent back.
-     *
-     * @throws IOException If an error occurrs accessing or spooling the resource.
-     */
-    private boolean spoolResource( HttpServletRequest request, HttpServletResponse response ) throws IOException
-    {
-        // no resource if no resource accessor
-        if ( getResourceMethod == null )
-        {
-            return false;
-        }
-
-        String pi = request.getPathInfo();
-        InputStream ins = null;
-        try
-        {
-
-            // check for a resource, fail if none
-            URL url = ( URL ) getResourceMethod.invoke( getResourceProvider(), new Object[]
-                { pi } );
-            if ( url == null )
-            {
-                return false;
-            }
-
-            // open the connection and the stream (we use the stream to be able
-            // to at least hint to close the connection because there is no
-            // method to explicitly close the conneciton, unfortunately)
-            URLConnection connection = url.openConnection();
-            ins = connection.getInputStream();
-
-            // check whether we may return 304/UNMODIFIED
-            long lastModified = connection.getLastModified();
-            if ( lastModified > 0 )
-            {
-                long ifModifiedSince = request.getDateHeader( "If-Modified-Since" );
-                if ( ifModifiedSince >= ( lastModified / 1000 * 1000 ) )
-                {
-                    // Round down to the nearest second for a proper compare
-                    // A ifModifiedSince of -1 will always be less
-                    response.setStatus( HttpServletResponse.SC_NOT_MODIFIED );
-
-                    return true;
-                }
-
-                // have to send, so set the last modified header now
-                response.setDateHeader( "Last-Modified", lastModified );
-            }
-
-            // describe the contents
-            response.setContentType( getServletContext().getMimeType( pi ) );
-            response.setIntHeader( "Content-Length", connection.getContentLength() );
-
-            // spool the actual contents
-            OutputStream out = response.getOutputStream();
-            byte[] buf = new byte[2048];
-            int rd;
-            while ( ( rd = ins.read( buf ) ) >= 0 )
-            {
-                out.write( buf, 0, rd );
-            }
-
-            // over and out ...
-            return true;
-        }
-        catch ( IllegalAccessException iae )
-        {
-            // log or throw ???
-        }
-        catch ( InvocationTargetException ite )
-        {
-            // log or throw ???
-            // Throwable cause = ite.getTargetException();
-        }
-      finally
-        {
-            if ( ins != null )
-            {
-                try
-                {
-                    ins.close();
-                }
-                catch ( IOException ignore )
-                {
-                }
-            }
-        }
-
-        return false;
-    }
-
-
-}
diff --git a/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AdminPlugin.java b/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AdminPlugin.java
index 93154ca..44fdef1 100644
--- a/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AdminPlugin.java
+++ b/karaf/webconsole/admin/src/main/java/org/apache/felix/karaf/webconsole/admin/AdminPlugin.java
@@ -37,7 +37,7 @@
 /**
  * Felix Web Console plugin for interacting with the {@link AdminService}
  */
-public class AdminPlugin extends AbstractResourceAwareWebConsolePlugin {
+public class AdminPlugin extends AbstractWebConsolePlugin {
 
     public static final String NAME = "admin";
     public static final String LABEL = "Admin";
diff --git a/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/AbstractResourceAwareWebConsolePlugin.java b/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/AbstractResourceAwareWebConsolePlugin.java
deleted file mode 100644
index c6efdc4..0000000
--- a/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/AbstractResourceAwareWebConsolePlugin.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *  Copyright 2009 Marcin.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *  under the License.
- */
-package org.apache.felix.karaf.webconsole.features;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.OutputStream;
-import java.io.InputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-
-/**
- * TODO: remove this class when upgrading to webconsole 1.2.12
- */
-public abstract class AbstractResourceAwareWebConsolePlugin extends AbstractWebConsolePlugin {
-
-    public static final String GET_RESOURCE_METHOD_NAME = "getResource";
-
-    private final Method getResourceMethod;
-
-    {
-        getResourceMethod = getGetResourceMethod();
-    }
-
-    /**
-     * Renders the web console page for the request. This consist of the following
-     * five parts called in order:
-     * <ol>
-     * <li>Send back a requested resource
-     * <li>{@link #startResponse(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #renderTopNavigation(HttpServletRequest, PrintWriter)}</li>
-     * <li>{@link #renderContent(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #endResponse(PrintWriter)}</li>
-     * </ol>
-     * <p>
-     * <b>Note</b>: If a resource is sent back for the request only the first
-     * step is executed. Otherwise the first step is a null-operation actually
-     * and the latter four steps are executed in order.
-     */
-    protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
-            IOException
-    {
-        if ( !spoolResource( request, response ) )
-        {
-            PrintWriter pw = startResponse( request, response );
-            renderTopNavigation( request, pw );
-            renderContent( request, response );
-            endResponse( pw );
-        }
-    }
-
-    protected Object getResourceProvider() {
-        return this;
-    }
-
-    /**
-     * Returns a method which is called on the
-     * {@link #getResourceProvider() resource provder} class to return an URL
-     * to a resource which may be spooled when requested. The method has the
-     * following signature:
-     * <pre>
-     * [modifier] URL getResource(String path);
-     * </pre>
-     * Where the <i>[modifier]</i> may be <code>public</code>, <code>protected</code>
-     * or <code>private</code> (if the method is declared in the class of the
-     * resource provider). It is suggested to use the <code>private</code>
-     * modifier if the method is declared in the resource provider class or
-     * the <code>protected</code> modifier if the method is declared in a
-     * base class of the resource provider.
-     *
-     * @return The <code>getResource(String)</code> method or <code>null</code>
-     *      if the {@link #getResourceProvider() resource provider} is
-     *      <code>null</code> or does not provide such a method.
-     */
-    private Method getGetResourceMethod()
-    {
-        Method tmpGetResourceMethod = null;
-
-        Object resourceProvider = getResourceProvider();
-        if ( resourceProvider != null )
-        {
-            try
-            {
-                Class cl = resourceProvider.getClass();
-                while ( tmpGetResourceMethod == null && cl != Object.class )
-                {
-                    Method[] methods = cl.getDeclaredMethods();
-                    for ( int i = 0; i < methods.length; i++ )
-                    {
-                        Method m = methods[i];
-                        if ( GET_RESOURCE_METHOD_NAME.equals( m.getName() ) && m.getParameterTypes().length == 1
-                            && m.getParameterTypes()[0] == String.class && m.getReturnType() == URL.class )
-                        {
-                            // ensure modifier is protected or public or the private
-                            // method is defined in the plugin class itself
-                            int mod = m.getModifiers();
-                            if ( Modifier.isProtected( mod ) || Modifier.isPublic( mod )
-                                || ( Modifier.isPrivate( mod ) && cl == resourceProvider.getClass() ) )
-                            {
-                                m.setAccessible( true );
-                                tmpGetResourceMethod = m;
-                                break;
-                            }
-                        }
-                    }
-                    cl = cl.getSuperclass();
-                }
-            }
-            catch ( Throwable t )
-            {
-                tmpGetResourceMethod = null;
-            }
-        }
-
-        return tmpGetResourceMethod;
-    }
-
-    /**
-     * If the request addresses a resource which may be served by the
-     * <code>getResource</code> method of the
-     * {@link #getResourceProvider() resource provider}, this method serves it
-     * and returns <code>true</code>. Otherwise <code>false</code> is returned.
-     * <code>false</code> is also returned if the resource provider has no
-     * <code>getResource</code> method.
-     * <p>
-     * If <code>true</code> is returned, the request is considered complete and
-     * request processing terminates. Otherwise request processing continues
-     * with normal plugin rendering.
-     *
-     * @param request The request object
-     * @param response The response object
-     * @return <code>true</code> if the request causes a resource to be sent back.
-     *
-     * @throws IOException If an error occurrs accessing or spooling the resource.
-     */
-    private boolean spoolResource( HttpServletRequest request, HttpServletResponse response ) throws IOException
-    {
-        // no resource if no resource accessor
-        if ( getResourceMethod == null )
-        {
-            return false;
-        }
-
-        String pi = request.getPathInfo();
-        InputStream ins = null;
-        try
-        {
-
-            // check for a resource, fail if none
-            URL url = ( URL ) getResourceMethod.invoke( getResourceProvider(), new Object[]
-                { pi } );
-            if ( url == null )
-            {
-                return false;
-            }
-
-            // open the connection and the stream (we use the stream to be able
-            // to at least hint to close the connection because there is no
-            // method to explicitly close the conneciton, unfortunately)
-            URLConnection connection = url.openConnection();
-            ins = connection.getInputStream();
-
-            // check whether we may return 304/UNMODIFIED
-            long lastModified = connection.getLastModified();
-            if ( lastModified > 0 )
-            {
-                long ifModifiedSince = request.getDateHeader( "If-Modified-Since" );
-                if ( ifModifiedSince >= ( lastModified / 1000 * 1000 ) )
-                {
-                    // Round down to the nearest second for a proper compare
-                    // A ifModifiedSince of -1 will always be less
-                    response.setStatus( HttpServletResponse.SC_NOT_MODIFIED );
-
-                    return true;
-                }
-
-                // have to send, so set the last modified header now
-                response.setDateHeader( "Last-Modified", lastModified );
-            }
-
-            // describe the contents
-            response.setContentType( getServletContext().getMimeType( pi ) );
-            response.setIntHeader( "Content-Length", connection.getContentLength() );
-
-            // spool the actual contents
-            OutputStream out = response.getOutputStream();
-            byte[] buf = new byte[2048];
-            int rd;
-            while ( ( rd = ins.read( buf ) ) >= 0 )
-            {
-                out.write( buf, 0, rd );
-            }
-
-            // over and out ...
-            return true;
-        }
-        catch ( IllegalAccessException iae )
-        {
-            // log or throw ???
-        }
-        catch ( InvocationTargetException ite )
-        {
-            // log or throw ???
-            // Throwable cause = ite.getTargetException();
-        }
-      finally
-        {
-            if ( ins != null )
-            {
-                try
-                {
-                    ins.close();
-                }
-                catch ( IOException ignore )
-                {
-                }
-            }
-        }
-
-        return false;
-    }
-
-
-}
diff --git a/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/FeaturesPlugin.java b/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/FeaturesPlugin.java
index 821aedf..ea2c087 100644
--- a/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/FeaturesPlugin.java
+++ b/karaf/webconsole/features/src/main/java/org/apache/felix/karaf/webconsole/features/FeaturesPlugin.java
@@ -25,10 +25,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Properties;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -40,17 +37,15 @@
 import org.apache.felix.karaf.features.FeaturesService;
 import org.apache.felix.karaf.features.Repository;
 import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-
 import org.json.JSONException;
 import org.json.JSONWriter;
-
 import org.osgi.framework.BundleContext;
 
 
 /**
  * The <code>FeaturesPlugin</code>
  */
-public class FeaturesPlugin extends AbstractResourceAwareWebConsolePlugin
+public class FeaturesPlugin extends AbstractWebConsolePlugin
 {
 
     /** Pseudo class version ID to keep the IDE quite. */
diff --git a/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/AbstractResourceAwareWebConsolePlugin.java b/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/AbstractResourceAwareWebConsolePlugin.java
deleted file mode 100644
index 736c766..0000000
--- a/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/AbstractResourceAwareWebConsolePlugin.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *  Copyright 2009 Marcin.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *  under the License.
- */
-package org.apache.felix.karaf.webconsole.gogo;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.OutputStream;
-import java.io.InputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-
-/**
- * TODO: remove this class when upgrading to webconsole 1.2.12
- */
-public abstract class AbstractResourceAwareWebConsolePlugin extends AbstractWebConsolePlugin {
-
-    public static final String GET_RESOURCE_METHOD_NAME = "getResource";
-
-    private final Method getResourceMethod;
-
-    {
-        getResourceMethod = getGetResourceMethod();
-    }
-
-    /**
-     * Renders the web console page for the request. This consist of the following
-     * five parts called in order:
-     * <ol>
-     * <li>Send back a requested resource
-     * <li>{@link #startResponse(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #renderTopNavigation(HttpServletRequest, PrintWriter)}</li>
-     * <li>{@link #renderContent(HttpServletRequest, HttpServletResponse)}</li>
-     * <li>{@link #endResponse(PrintWriter)}</li>
-     * </ol>
-     * <p>
-     * <b>Note</b>: If a resource is sent back for the request only the first
-     * step is executed. Otherwise the first step is a null-operation actually
-     * and the latter four steps are executed in order.
-     */
-    protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
-            IOException
-    {
-        if ( !spoolResource( request, response ) )
-        {
-            PrintWriter pw = startResponse( request, response );
-            renderTopNavigation( request, pw );
-            renderContent( request, response );
-            endResponse( pw );
-        }
-    }
-
-    protected Object getResourceProvider() {
-        return this;
-    }
-
-    /**
-     * Returns a method which is called on the
-     * {@link #getResourceProvider() resource provder} class to return an URL
-     * to a resource which may be spooled when requested. The method has the
-     * following signature:
-     * <pre>
-     * [modifier] URL getResource(String path);
-     * </pre>
-     * Where the <i>[modifier]</i> may be <code>public</code>, <code>protected</code>
-     * or <code>private</code> (if the method is declared in the class of the
-     * resource provider). It is suggested to use the <code>private</code>
-     * modifier if the method is declared in the resource provider class or
-     * the <code>protected</code> modifier if the method is declared in a
-     * base class of the resource provider.
-     *
-     * @return The <code>getResource(String)</code> method or <code>null</code>
-     *      if the {@link #getResourceProvider() resource provider} is
-     *      <code>null</code> or does not provide such a method.
-     */
-    private Method getGetResourceMethod()
-    {
-        Method tmpGetResourceMethod = null;
-
-        Object resourceProvider = getResourceProvider();
-        if ( resourceProvider != null )
-        {
-            try
-            {
-                Class cl = resourceProvider.getClass();
-                while ( tmpGetResourceMethod == null && cl != Object.class )
-                {
-                    Method[] methods = cl.getDeclaredMethods();
-                    for ( int i = 0; i < methods.length; i++ )
-                    {
-                        Method m = methods[i];
-                        if ( GET_RESOURCE_METHOD_NAME.equals( m.getName() ) && m.getParameterTypes().length == 1
-                            && m.getParameterTypes()[0] == String.class && m.getReturnType() == URL.class )
-                        {
-                            // ensure modifier is protected or public or the private
-                            // method is defined in the plugin class itself
-                            int mod = m.getModifiers();
-                            if ( Modifier.isProtected( mod ) || Modifier.isPublic( mod )
-                                || ( Modifier.isPrivate( mod ) && cl == resourceProvider.getClass() ) )
-                            {
-                                m.setAccessible( true );
-                                tmpGetResourceMethod = m;
-                                break;
-                            }
-                        }
-                    }
-                    cl = cl.getSuperclass();
-                }
-            }
-            catch ( Throwable t )
-            {
-                tmpGetResourceMethod = null;
-            }
-        }
-
-        return tmpGetResourceMethod;
-    }
-
-    /**
-     * If the request addresses a resource which may be served by the
-     * <code>getResource</code> method of the
-     * {@link #getResourceProvider() resource provider}, this method serves it
-     * and returns <code>true</code>. Otherwise <code>false</code> is returned.
-     * <code>false</code> is also returned if the resource provider has no
-     * <code>getResource</code> method.
-     * <p>
-     * If <code>true</code> is returned, the request is considered complete and
-     * request processing terminates. Otherwise request processing continues
-     * with normal plugin rendering.
-     *
-     * @param request The request object
-     * @param response The response object
-     * @return <code>true</code> if the request causes a resource to be sent back.
-     *
-     * @throws IOException If an error occurrs accessing or spooling the resource.
-     */
-    private boolean spoolResource( HttpServletRequest request, HttpServletResponse response ) throws IOException
-    {
-        // no resource if no resource accessor
-        if ( getResourceMethod == null )
-        {
-            return false;
-        }
-
-        String pi = request.getPathInfo();
-        InputStream ins = null;
-        try
-        {
-
-            // check for a resource, fail if none
-            URL url = ( URL ) getResourceMethod.invoke( getResourceProvider(), new Object[]
-                { pi } );
-            if ( url == null )
-            {
-                return false;
-            }
-
-            // open the connection and the stream (we use the stream to be able
-            // to at least hint to close the connection because there is no
-            // method to explicitly close the conneciton, unfortunately)
-            URLConnection connection = url.openConnection();
-            ins = connection.getInputStream();
-
-            // check whether we may return 304/UNMODIFIED
-            long lastModified = connection.getLastModified();
-            if ( lastModified > 0 )
-            {
-                long ifModifiedSince = request.getDateHeader( "If-Modified-Since" );
-                if ( ifModifiedSince >= ( lastModified / 1000 * 1000 ) )
-                {
-                    // Round down to the nearest second for a proper compare
-                    // A ifModifiedSince of -1 will always be less
-                    response.setStatus( HttpServletResponse.SC_NOT_MODIFIED );
-
-                    return true;
-                }
-
-                // have to send, so set the last modified header now
-                response.setDateHeader( "Last-Modified", lastModified );
-            }
-
-            // describe the contents
-            response.setContentType( getServletContext().getMimeType( pi ) );
-            response.setIntHeader( "Content-Length", connection.getContentLength() );
-
-            // spool the actual contents
-            OutputStream out = response.getOutputStream();
-            byte[] buf = new byte[2048];
-            int rd;
-            while ( ( rd = ins.read( buf ) ) >= 0 )
-            {
-                out.write( buf, 0, rd );
-            }
-
-            // over and out ...
-            return true;
-        }
-        catch ( IllegalAccessException iae )
-        {
-            // log or throw ???
-        }
-        catch ( InvocationTargetException ite )
-        {
-            // log or throw ???
-            // Throwable cause = ite.getTargetException();
-        }
-      finally
-        {
-            if ( ins != null )
-            {
-                try
-                {
-                    ins.close();
-                }
-                catch ( IOException ignore )
-                {
-                }
-            }
-        }
-
-        return false;
-    }
-
-
-}
diff --git a/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/GogoPlugin.java b/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/GogoPlugin.java
index 20ffa9f..ed61eac 100644
--- a/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/GogoPlugin.java
+++ b/karaf/webconsole/gogo/src/main/java/org/apache/felix/karaf/webconsole/gogo/GogoPlugin.java
@@ -22,30 +22,30 @@
 
 package org.apache.felix.karaf.webconsole.gogo;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.PipedOutputStream;
-import java.io.PipedInputStream;
-import java.io.InterruptedIOException;
-import java.io.InputStreamReader;
 import java.io.ByteArrayInputStream;
-import java.io.PrintStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.zip.GZIPOutputStream;
-import java.util.List;
-import java.net.URL;
 
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
 
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-import org.apache.felix.karaf.shell.console.jline.Console;
-import org.apache.felix.karaf.shell.console.Completer;
-import org.apache.felix.karaf.shell.console.completer.AggregateCompleter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.felix.karaf.shell.console.Completer;
+import org.apache.felix.karaf.shell.console.completer.AggregateCompleter;
+import org.apache.felix.karaf.shell.console.jline.Console;
+import org.apache.felix.webconsole.AbstractWebConsolePlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
@@ -53,7 +53,7 @@
 /**
  * The <code>GogoPlugin</code>
  */
-public class GogoPlugin extends AbstractResourceAwareWebConsolePlugin {
+public class GogoPlugin extends AbstractWebConsolePlugin {
 
     /** Pseudo class version ID to keep the IDE quite. */
     private static final long serialVersionUID = 1L;