This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new bcf88fac6e FELIX-6623 : Use Http Whiteboard for Web Console
registration
bcf88fac6e is described below
commit bcf88fac6ef22d9722ed82e4b7968ee302fb9e47
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Wed Aug 16 10:00:33 2023 +0200
FELIX-6623 : Use Http Whiteboard for Web Console registration
---
.../webconsole/internal/core/BundlesServlet.java | 29 +++++++---------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index 80afee3d06..ea1a34ab08 100644
---
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -107,6 +107,8 @@ public class BundlesServlet extends SimpleWebConsolePlugin
implements OsgiManage
private static final String FIELD_BUNDLEFILE = "bundlefile";
+ private static final String FIELD_UPLOADID = "uploadid";
+
// set to ask for PackageAdmin.refreshPackages() after install/update
private static final String FIELD_REFRESH_PACKAGES = "refreshPackages";
@@ -364,13 +366,8 @@ public class BundlesServlet extends SimpleWebConsolePlugin
implements OsgiManage
throws ServletException, IOException {
boolean success = false;
BundleException bundleException = null;
- final String action;
- if (req.getParts().isEmpty()) {
- action = req.getParameter( "action" );
- } else {
- action = getValue(req, "action");
- }
-
+ final String action = req.getParameter( "action" );
+System.out.println("action: " + action);
if ( "refreshPackages".equals( action ) ) {
// refresh packages and give it most 15 seconds to finish
final FrameworkWiring fw =
getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class);
@@ -1478,14 +1475,6 @@ public class BundlesServlet extends
SimpleWebConsolePlugin implements OsgiManage
//---------- Bundle Installation handler (former InstallAction)
- private String getValue(final HttpServletRequest request, final String
fieldName) throws ServletException, IOException {
- final Part part = request.getPart(fieldName);
- if ( part != null ) {
- return IOUtils.toString(part.getInputStream(), "UTF-8");
- }
- return null;
- }
-
private void installBundles( final HttpServletRequest request )
throws IOException, ServletException {
final Collection<Part> bundleItems = request.getParts();
@@ -1494,17 +1483,17 @@ public class BundlesServlet extends
SimpleWebConsolePlugin implements OsgiManage
}
final long uploadId;
- final String uidVal = this.getValue(request, "uploadid");
+ final String uidVal = request.getParameter(FIELD_UPLOADID);
if ( uidVal != null ) {
uploadId = Long.valueOf(uidVal);
} else {
uploadId = -1;
}
- final String startItem = this.getValue(request, FIELD_START);
- final String startLevelItem = this.getValue(request, FIELD_STARTLEVEL);
- final String refreshPackagesItem = this.getValue(request,
FIELD_REFRESH_PACKAGES);
- final String parallelVersionItem = this.getValue(request,
FIELD_PARALLEL_VERSION);
+ final String startItem = request.getParameter(FIELD_START);
+ final String startLevelItem = request.getParameter(FIELD_STARTLEVEL);
+ final String refreshPackagesItem =
request.getParameter(FIELD_REFRESH_PACKAGES);
+ final String parallelVersionItem =
request.getParameter(FIELD_PARALLEL_VERSION);
// default values
// it exists