Merge branch 'master' into dev
Signed-off-by: Francois Aissaoui <aissaoui@laas.fr>
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/Constants.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/Constants.java
index 183c960..ec12efd 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/Constants.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/Constants.java
@@ -93,5 +93,8 @@
public static final String ABSOLUTE_URI_SEPARATOR = "_";
public static final Integer MAX_THREAD_POOL_SIZE = Integer.valueOf(System.getProperty("org.eclipse.om2m.maxThreadPoolSize", "50"));
+
+ // The MimeMediaType to use to serialize a notification
+ public static final String NOTIFICATION_MMT = System.getProperty("org.eclipse.om2m.notification.mmt", MimeMediaType.XML);
}
\ No newline at end of file
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
index 191f26c..debdf7b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
@@ -110,13 +110,14 @@
notification.setVerificationRequest(true);
notification.setSubscriptionReference(subscriptionEntity.getHierarchicalURI());
notification.setSubscriptionDeletion(false);
- RequestPrimitive notifRequest = new RequestPrimitive();
- notifRequest.setContent(DataMapperSelector.getDataMapperList().get(MimeMediaType.XML).objToString(notification));
+ RequestPrimitive notifRequest = new RequestPrimitive();
+ notifRequest.setContent(DataMapperSelector.getDataMapperList().get(Constants.NOTIFICATION_MMT).objToString(notification));
notifRequest.setFrom("/" + Constants.CSE_ID);
notifRequest.setTo(uri);
notifRequest.setOperation(Operation.NOTIFY);
- notifRequest.setRequestContentType(MimeMediaType.XML);
- notifRequest.setReturnContentType(MimeMediaType.XML);
+ notifRequest.setRequestContentType(Constants.NOTIFICATION_MMT);
+ notifRequest.setReturnContentType(Constants.NOTIFICATION_MMT);
+
ResponsePrimitive resp = notify(notifRequest, uri);
if(resp.getResponseStatusCode().equals(ResponseStatusCode.TARGET_NOT_REACHABLE)){
throw new Om2mException("Error during the verification request",
@@ -274,16 +275,16 @@
}
if(sub.getNotificationContentType().equals(NotificationContentType.MODIFIED_ATTRIBUTES)){
serializableResource = (Resource)mapper.mapEntityToResource(resource, ResultContent.ATTRIBUTES);
- notification.getNotificationEvent().setRepresentation(serializableResource);
- request.setRequestContentType(MimeMediaType.XML);
+ notification.getNotificationEvent().setRepresentation(serializableResource);
+ request.setRequestContentType(Constants.NOTIFICATION_MMT);
} else if(sub.getNotificationContentType().equals(NotificationContentType.WHOLE_RESOURCE)){
serializableResource = (Resource) mapper.mapEntityToResource(resource, ResultContent.ATTRIBUTES);
notification.getNotificationEvent().setRepresentation(serializableResource);
- request.setRequestContentType(MimeMediaType.XML);
+ request.setRequestContentType(Constants.NOTIFICATION_MMT);
}
}
// Set the content
- request.setContent(DataMapperSelector.getDataMapperList().get(MimeMediaType.XML).objToString(notification));
+ request.setContent(DataMapperSelector.getDataMapperList().get(Constants.NOTIFICATION_MMT).objToString(notification));
// For each notification URI: send the notify request
for(final String uri : sub.getNotificationURI()){
CoreExecutor.postThread(new Runnable(){