Skip to content

Commit

Permalink
AEM as a Cloud Service: components and services request in dev.tools …
Browse files Browse the repository at this point in the history
…are not working (#4)

- instead of bundle reference, bundle ID is passed.
- constant naming and value correspondent adjustment
---------
Co-authored-by: Ivan Akulenka <ivan_akulenka@epam.com>
Co-authored-by: Stefan Seifert <stefanseifert@users.noreply.github.com>
  • Loading branch information
Promathia authored Mar 18, 2024
1 parent aacb46c commit dc4987c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions publisher/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.2.2" date="not released">
<action type="fix" dev="iakulenka" issue="4">
Fix issue with AEMaaCS: Use bundle ID instead of bundle instance to pass over bundle reference to ServletContainerBridge.
</action>
</release>

<release version="1.2.0" date="2019-06-03">
<action type="add" dev="ssauder">
Add new interface "JaxRsClassesProvider" to allow to register additional resources, providers and features that are not OSGi components.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public ComponentInstance addingBundle(Bundle bundle, BundleEvent event) {
// register JAX-RS application as servlet on HTTP whiteboard
Dictionary<String, Object> serviceConfig = new Hashtable<>();
serviceConfig.put("alias", applicationPath);
serviceConfig.put(ServletContainerBridge.PROPERTY_BUNDLE, bundle);
serviceConfig.put(ServletContainerBridge.PROPERTY_BUNDLE_ID, bundle.getBundleId());
return servletContainerBridgeFactory.newInstance(serviceConfig);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ServletContainerBridge extends HttpServlet {
private static final long serialVersionUID = 1L;

static final String SERVLETCONTAINER_BRIDGE_FACTORY = "caravan.jaxrs.servletcontainer.bridge.factory";
static final String PROPERTY_BUNDLE = "caravan.jaxrs.relatedBundle";
static final String PROPERTY_BUNDLE_ID = "caravan.jaxrs.relatedBundleId";

private BundleContext bundleContext;
private Bundle bundle;
Expand All @@ -79,7 +79,8 @@ public class ServletContainerBridge extends HttpServlet {
@Activate
void activate(ComponentContext componentContext) {
// bundle which contains the JAX-RS services
bundle = (Bundle)componentContext.getProperties().get(PROPERTY_BUNDLE);
bundle = componentContext.getBundleContext().getBundle(
(Long)componentContext.getProperties().get(PROPERTY_BUNDLE_ID));
bundleContext = bundle.getBundleContext();

// initialize component tracker to detect local and global JAX-RS components for current bundle
Expand Down

0 comments on commit dc4987c

Please sign in to comment.