/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
package org.apache.felix.webconsole.internal;


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.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.felix.webconsole.AbstractWebConsolePlugin;


/**
 * The <code>WebConsolePluginAdapter</code> is an adapter to the
 * {@link AbstractWebConsolePlugin} for regular servlets registered with the
 * {@link org.apache.felix.webconsole.WebConsoleConstants#PLUGIN_TITLE}
 * service attribute.
 */
public class WebConsolePluginAdapter extends AbstractWebConsolePlugin
{

    /** serial UID */
    private static final long serialVersionUID = 1L;

    // the plugin label (aka address)
    private final String label;

    // the plugin title rendered in the top bar
    private final String title;

    // the actual plugin to forward rendering requests to
    private final Servlet plugin;


    public WebConsolePluginAdapter( String label, String title, Servlet plugin )
    {
        this.label = label;
        this.title = title;
        this.plugin = plugin;
    }


    //---------- AbstractWebConsolePlugin API

    /**
     * Returns the label of this plugin page as defined in the constructor.
     */
    public String getLabel()
    {
        return label;
    }


    /**
     * Returns the title of this plugin page as defined in the constructor.
     */
    public String getTitle()
    {
        return title;
    }


    /**
     * Call the plugin servlet's service method to render the content of this
     * page.
     */
    protected void renderContent( HttpServletRequest req, HttpServletResponse res ) throws ServletException,
        IOException
    {
        plugin.service( req, res );
    }


    /**
     * Returns the registered plugin class to be able to call the
     * <code>getResource()</code> method on that object for this plugin to
     * provide additional resources.
     */
    protected Object getResourceProvider()
    {
        return plugin;
    }


    //---------- Servlet API overwrite

    /**
     * Initializes this servlet as well as the plugin servlet.
     */
    public void init( ServletConfig config ) throws ServletException
    {
        // base classe initialization
        super.init( config );

        // plugin initialization
        plugin.init( config );
    }


    /**
     * 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()
    {
        plugin.destroy();
        super.destroy();
    }
}

@@ -3861,19 +3861,26 @@
      // 
-not
+handle the
  GET req
@@ -3887,44 +3887,51 @@
 uest
-,
  h
-ave the plugin handle it directly
+ere and call into plugin on renderContent
 %0A   
@@ -4011,34 +4011,29 @@
          // 
-handle the
+not a
  GET request
@@ -4036,51 +4036,44 @@
 uest
+,
  h
-ere and call into plugin on renderContent
+ave the plugin handle it directly
 %0A   

Fix wrong comments