aboutsummaryrefslogtreecommitdiffstats
path: root/utils/webseal-simulator/src/main
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2018-10-17 10:15:45 +0300
committerMichael Lando <michael.lando@intl.att.com>2018-10-17 14:13:42 +0000
commit00bbbaad6b09889414a353692aefab737a526953 (patch)
treee8ed2ea2ebeefb5c8291c16483e315fe63c86c51 /utils/webseal-simulator/src/main
parentc18b0607bec3c42980b4937030bae7e0088fc277 (diff)
fix headers in put rqst of WSsimulator
Change-Id: I70365b9b4a798688b7b4fed6d6d21dd81ae1de97 Issue-ID: SDC-1844 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'utils/webseal-simulator/src/main')
-rw-r--r--utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java
index 329b7ffbaa..91e7c555f1 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/SdcProxy.java
@@ -52,7 +52,7 @@ public class SdcProxy extends HttpServlet {
private final String STYLES = "/styles";
private final String LANGUAGES = "/languages";
private final String CONFIGURATIONS = "/configurations";
- private static final Set<String> RESERVED_HEADERS = Arrays.stream(ReservedHeaders.values()).map(h -> h.name()).collect(Collectors.toSet());
+ private static final Set<String> RESERVED_HEADERS = Arrays.stream(ReservedHeaders.values()).map(h -> h.getValue()).collect(Collectors.toSet());
private final static Logger logger = Logger.getLogger(SdcProxy.class);
@@ -206,7 +206,11 @@ public class SdcProxy extends HttpServlet {
}
private ContentType getContentType(HttpServletRequest request) {
- ContentType contentType = ContentType.parse(request.getContentType());
+ String contentTypeStr = request.getContentType();
+ if (contentTypeStr == null ){
+ contentTypeStr = request.getHeader("contentType");
+ }
+ ContentType contentType = ContentType.parse(contentTypeStr);
return ContentType.create(contentType.getMimeType());
}
@@ -250,7 +254,7 @@ public class SdcProxy extends HttpServlet {
Enumeration<String> headers = request.getHeaders(headerName);
while (headers.hasMoreElements()) {
String headerValue = headers.nextElement();
-// proxyMethod.setHeader(headerName, headerValue);
+ proxyMethod.setHeader(headerName, headerValue);
}
}
}
@@ -306,10 +310,21 @@ public class SdcProxy extends HttpServlet {
return "Http Proxy Servlet";
}
- private enum ReservedHeaders {
- HTTP_IV_USER, USER_ID, HTTP_CSP_FIRSTNAME, HTTP_CSP_EMAIL, HTTP_CSP_LASTNAME, HTTP_IV_REMOTE_ADDRESS, HTTP_CSP_WSTYPE
+ enum ReservedHeaders {
+ HTTP_IV_USER("HTTP_IV_USER"), USER_ID("USER_ID"), HTTP_CSP_FIRSTNAME("HTTP_CSP_FIRSTNAME"), HTTP_CSP_EMAIL("HTTP_CSP_EMAIL"), HTTP_CSP_LASTNAME("HTTP_CSP_LASTNAME"), HTTP_IV_REMOTE_ADDRESS("HTTP_IV_REMOTE_ADDRESS"), HTTP_CSP_WSTYPE("HTTP_CSP_WSTYPE"), HOST("Host"), CONTENTLENGTH("Content-Length");
+
+ private String value;
+
+ ReservedHeaders(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
}
+
private static CloseableHttpClient buildRestClient() throws NoSuchAlgorithmException, KeyStoreException {
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());