Change HTTP Requests into HTTPS Ones
[holmes/engine-management.git] / engine-d / src / main / java / org / onap / holmes / engine / resources / DmaapConfigurationService.java
index 9fa1874..548b9b2 100644 (file)
@@ -16,7 +16,6 @@
 
 package org.onap.holmes.engine.resources;
 
-import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import javax.servlet.http.HttpServletRequest;
@@ -33,7 +32,7 @@ import org.onap.holmes.common.dcae.DcaeConfigurationsCache;
 import org.onap.holmes.common.dcae.entity.SecurityInfo;
 import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
 import org.onap.holmes.dsa.dmaappolling.Subscriber;
-import org.onap.holmes.engine.dmaappolling.SubscriberAction;
+import org.onap.holmes.engine.dmaap.SubscriberAction;
 import org.onap.holmes.engine.request.DmaapConfigRequest;
 
 @Service
@@ -51,7 +50,7 @@ public class DmaapConfigurationService {
                     + " and <b>url</b>. Both fields are required.") DmaapConfigRequest config,
             @Context HttpServletRequest request){
         String url = config.getUrl();
-        if (url.startsWith("http://")) {
+        if (url.startsWith("http://") || url.startsWith("https://")) {
             Subscriber subscriber = new Subscriber();
             subscriber.setTopic(config.getName());
             subscriber.setUrl(url);
@@ -65,7 +64,7 @@ public class DmaapConfigurationService {
 
             return "{\"message\": \"Succeeded!\", \"topic\": \"" + config.getName() + "\"}";
         }
-        return "{\"message\": \"Only the HTTP protocol is supported!\"}";
+        return "{\"message\": \"Only the HTTP or HTTPS protocol is supported!\"}";
     }
 
     @DELETE
@@ -93,7 +92,7 @@ public class DmaapConfigurationService {
                 + " and <b>url</b>. Both fields are required.") DmaapConfigRequest config,
             @Context HttpServletRequest request){
         String url = config.getUrl();
-        if (url.startsWith("http://")) {
+        if (url.startsWith("http://") || url.startsWith("https://")) {
             SecurityInfo securityInfo = new SecurityInfo();
             SecurityInfo.DmaapInfo dmaapInfo = new SecurityInfo().new DmaapInfo();
             dmaapInfo.setTopicUrl(config.getUrl());
@@ -101,6 +100,6 @@ public class DmaapConfigurationService {
             DcaeConfigurationsCache.addPubSecInfo(config.getName(), securityInfo);
             return "{\"message\": \"Succeeded!\", \"topic\": \"" + config.getName() + "\"}";
         }
-        return "{\"message\": \"Only the HTTP protocol is supported!\"}";
+        return "{\"message\": \"Only the HTTP or HTTPS protocol is supported!\"}";
     }
 }