update httpClient version 67/70167/2
authorYuli Shlosberg <ys9693@att.com>
Wed, 10 Oct 2018 14:01:01 +0000 (17:01 +0300)
committerMichael Lando <michael.lando@intl.att.com>
Wed, 10 Oct 2018 14:57:41 +0000 (14:57 +0000)
Change-Id: Ib7562e44b8ccaad396ab2e9a607ea29527f2239d
Issue-ID: SDC-1725
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
utils/webseal-simulator/pom.xml
utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java

index c55044c..0a33631 100644 (file)
@@ -45,7 +45,7 @@
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
-                       <version>4.5.2</version>
+                       <version>4.5.3</version>
                </dependency>
 
 
index 7fbc8ac..329b7ff 100644 (file)
@@ -182,8 +182,6 @@ public class SdcProxy extends HttpServlet {
         ServletInputStream inputStream = null;
         InputStreamEntity entity = null;
 
-        String contentType = request.getContentType();
-        ContentType myContent = ContentType.create(contentType);
         switch (methodEnum) {
             case GET:
                 proxyMethod = new HttpGet(uri);
@@ -191,13 +189,13 @@ public class SdcProxy extends HttpServlet {
             case POST:
                 proxyMethod = new HttpPost(uri);
                 inputStream = request.getInputStream();
-                entity = new InputStreamEntity(inputStream, myContent);
+                entity = new InputStreamEntity(inputStream, getContentType(request));
                 ((HttpPost) proxyMethod).setEntity(entity);
                 break;
             case PUT:
                 proxyMethod = new HttpPut(uri);
                 inputStream = request.getInputStream();
-                entity = new InputStreamEntity(inputStream, myContent);
+                entity = new InputStreamEntity(inputStream, getContentType(request));
                 ((HttpPut) proxyMethod).setEntity(entity);
                 break;
             case DELETE:
@@ -207,6 +205,11 @@ public class SdcProxy extends HttpServlet {
         return proxyMethod;
     }
 
+    private ContentType getContentType(HttpServletRequest request) {
+        ContentType contentType = ContentType.parse(request.getContentType());
+        return ContentType.create(contentType.getMimeType());
+    }
+
     private String getUseridFromRequest(HttpServletRequest request) {
 
         String userIdHeader = request.getHeader("USER_ID");