This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 3aed856 SLING-9679 - Add the executable name in the servlet
properties for the BundledScriptServlet
3aed856 is described below
commit 3aed8563911160585faf48bede6bb7912f1504a5
Author: Radu Cotescu <[email protected]>
AuthorDate: Fri Aug 21 12:04:52 2020 +0200
SLING-9679 - Add the executable name in the servlet properties for the
BundledScriptServlet
* added the executable name in the sling.core.servletName registration
property
* improved debugging for proxy objects
---
.../resolver/bundle/tracker/internal/BundledScriptTracker.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
index ba94cf2..a37cece 100644
---
a/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
+++
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
@@ -138,7 +138,6 @@ public class BundledScriptTracker implements
BundleTrackerCustomizer<List<Servic
List<ServiceRegistration<Servlet>> serviceRegistrations =
capabilities.stream().flatMap(cap ->
{
Hashtable<String, Object> properties = new Hashtable<>();
-
properties.put(ServletResolverConstants.SLING_SERVLET_NAME,
BundledScriptServlet.class.getName());
properties.put(Constants.SERVICE_DESCRIPTION,
BundledScriptServlet.class.getName() + cap.getAttributes());
BundledRenderUnitCapability bundledRenderUnitCapability =
BundledRenderUnitCapabilityImpl.fromBundleCapability(cap);
BundledRenderUnit executable = null;
@@ -240,6 +239,8 @@ public class BundledScriptTracker implements
BundleTrackerCustomizer<List<Servic
});
}
}
+
properties.put(ServletResolverConstants.SLING_SERVLET_NAME,
+ String.format("%s (%s)",
BundledScriptServlet.class.getSimpleName(), executable.getPath()));
regs.add(
register(bundle.getBundleContext(), new
BundledScriptServlet(inheritanceChain, executable),properties)
);
@@ -295,6 +296,8 @@ public class BundledScriptTracker implements
BundleTrackerCustomizer<List<Servic
}
else if (method.getName().equals("hashCode") &&
method.getParameterCount() == 0) {
return id.intValue();
+ } else if (method.getName().equals("toString")) {
+ return "Internal reference: " + id.toString();
}
else {
throw new
UnsupportedOperationException(method.toGenericString());
@@ -363,6 +366,8 @@ public class BundledScriptTracker implements
BundleTrackerCustomizer<List<Servic
}
else if (method.getName().equals("hashCode") &&
method.getParameterCount() == 0) {
return id.intValue();
+ } else if (method.getName().equals("toString")) {
+ return "Internal registration: " + id;
}
else {
throw new
UnsupportedOperationException(method.toGenericString());
@@ -379,7 +384,8 @@ public class BundledScriptTracker implements
BundleTrackerCustomizer<List<Servic
.map(this::toProperties)
.collect(Collectors.groupingBy(BundledScriptTracker::getResourceTypes)).forEach((rt,
propList) -> {
Hashtable<String, Object> properties = new Hashtable<>();
- properties.put(ServletResolverConstants.SLING_SERVLET_NAME,
DispatcherServlet.class.getName());
+ properties.put(ServletResolverConstants.SLING_SERVLET_NAME,
String.format("%s (%s)", DispatcherServlet.class.getSimpleName(),
+ rt));
properties.put(ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES,
rt.toArray());
Set<String> methods = propList.stream()
.map(props ->
props.getOrDefault(ServletResolverConstants.SLING_SERVLET_METHODS, new
String[]{"GET", "HEAD"}))