Adjust to changes to RuntimeDTO
diff --git a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF
index 3fe1f47..7f83f86 100644
--- a/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.http.servlet/META-INF/MANIFEST.MF
@@ -15,6 +15,7 @@
javax.servlet.http;version="[2.3.0,4.0.0)",
org.osgi.dto;version="[1.0.0,2.0)",
org.osgi.framework;version="[1.3.0,2.0)",
+ org.osgi.framework.dto; version="[1.8.0,2.0)",
org.osgi.framework.wiring;version="[1.1.0,2.0)",
org.osgi.service.http;version="[1.2,1.3)",
org.osgi.service.http.context;version="[1.0,1.1)",
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java
index d37bb35..65f6008 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java
@@ -26,6 +26,7 @@
import org.eclipse.equinox.http.servlet.internal.servlet.*;
import org.eclipse.equinox.http.servlet.internal.util.*;
import org.osgi.framework.*;
+import org.osgi.framework.dto.ServiceReferenceDTO;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.NamespaceException;
import org.osgi.service.http.context.ServletContextHelper;
@@ -217,7 +218,7 @@
public RuntimeDTO getRuntimeDTO() {
RuntimeDTO runtimeDTO = new RuntimeDTO();
- runtimeDTO.attributes = serializeAttributes();
+ runtimeDTO.serviceDTO = getServiceDTO();
// TODO FailedErrorDTOs
@@ -232,6 +233,19 @@
return runtimeDTO;
}
+ private ServiceReferenceDTO getServiceDTO() {
+ ServiceReferenceDTO[] services = consumingContext.getBundle().adapt(ServiceReferenceDTO[].class);
+ for (ServiceReferenceDTO serviceDTO : services) {
+ String[] serviceTypes = (String[]) serviceDTO.properties.get(Constants.OBJECTCLASS);
+ for (String type : serviceTypes) {
+ if (HttpServiceRuntime.class.getName().equals(type)) {
+ return serviceDTO;
+ }
+ }
+ }
+ return null;
+ }
+
public void log(String message, Throwable t) {
parentServletContext.log(message, t);
}
@@ -539,17 +553,6 @@
new ServletContextDTO[servletContextDTOs.size()]);
}
- private Map<String, String> serializeAttributes() {
- Map<String, String> temp = new HashMap<String, String>();
-
- for (Map.Entry<String, Object> entry : attributes.entrySet()) {
- temp.put(entry.getKey(), String.valueOf(entry.getValue()));
- }
-
- return temp;
- }
-
-
public void registerHttpServiceFilter(
Bundle bundle, String alias, Filter filter, Dictionary<String, String> initparams, HttpContext httpContext) throws ServletException {