This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch http-4.x
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/http-4.x by this push:
     new 5ff627677c FELIX-6646 : Plugin registered using AbstractServlet 
renders a blank page.
5ff627677c is described below

commit 5ff627677c0f9074a852713d788ff969f7c2d36e
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Sep 1 09:49:00 2023 +0200

    FELIX-6646 : Plugin registered using AbstractServlet renders a blank page.
---
 .../internal/servlet/JakartaServletAdapter.java           |  3 ++-
 .../apache/felix/webconsole/servlet/AbstractServlet.java  | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/JakartaServletAdapter.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/JakartaServletAdapter.java
index e5b14f297f..c25883f0de 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/JakartaServletAdapter.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/JakartaServletAdapter.java
@@ -43,6 +43,7 @@ import org.osgi.framework.ServiceReference;
  * {@link org.apache.felix.webconsole.WebConsoleConstants#PLUGIN_TITLE}
  * service attribute using jakarta.servlet.Servlet
  */
+@SuppressWarnings("deprecation")
 public class JakartaServletAdapter extends AbstractWebConsolePlugin {
 
     /** serial UID */
@@ -220,7 +221,7 @@ public class JakartaServletAdapter extends 
AbstractWebConsolePlugin {
         } catch (final jakarta.servlet.ServletException s) {
             throw ServletExceptionUtil.getServletException(s);
         }
-        // if a GET request and plugin did not create a response yet, call 
super to get full HTML response
+        // if a plugin did not create a response yet, call doGet to get a 
response
         if ( !checkResponse.isDone()) {
             this.doGet( req, resp );
         }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/AbstractServlet.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/AbstractServlet.java
index 429a66bc6d..71a848f359 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/AbstractServlet.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/AbstractServlet.java
@@ -44,11 +44,24 @@ import jakarta.servlet.http.HttpServletResponse;
  * requests to resources with a path of "LABEL/res/*" are automatically
  * handled.
  * <p>
- * For html (content) requests, the web console automatically draws the header,
+ * For html (content) requests, the web console automatically renders the 
header,
  * footer and navigation.
  * <p>
  * Support for Jakarta servlets requires that the Jakarta Servlet API and the
  * Apache Felix Http Wrappers are available in the runtime.
+ * <p>
+ * If you are upgrading from {@link 
org.apache.felix.webconsole.AbstractWebConsolePlugin}
+ * there are some changes to be aware of:
+ * <ul>
+ * <li>Resources are detected via the {@link #getResource(String)} method.</li>
+ * <li>Regardless of the http method, if the corresponding doXXX method does 
not create
+ *    a response, the {@link #renderContent(HttpServletRequest, 
HttpServletResponse)}
+ *    method is invoked.</li>
+ * <li>If a doXXX method other than doGet wants to create a response, it must 
not call
+ *    doGet or renderContent directly. It rather just does not create any 
response and
+ *    returns. In this case the web console will invoke the renderContent 
method
+ *    afterwards.</li>
+ * </ul>
  *
  * @see ServletConstants#PLUGIN_LABEL
  * @see ServletConstants#PLUGIN_TITLE

Reply via email to