rsanchez
2014-12-17 06f5e0b58dd77a11519f5f3d8e3b9ffe99b3b291
src/main/java/net/curisit/securis/ConnectionManager.java
....@@ -8,6 +8,7 @@
88 import java.security.NoSuchAlgorithmException;
99 import java.security.cert.CertificateException;
1010 import java.security.cert.X509Certificate;
11
+import java.util.Map;
1112
1213 import net.curisit.securis.beans.RequestBean;
1314 import net.curisit.securis.utils.JsonUtils;
....@@ -79,10 +80,21 @@
7980 }
8081
8182 public <T> T executePost(String command, Class<T> returnType, RequestBean req) throws SeCurisException {
83
+ return executePost(command, returnType, req, null);
84
+ }
85
+
86
+ public <T> T executePost(String command, Class<T> returnType, RequestBean req, Map<String, String> headers) throws SeCurisException {
8287 HttpPost postRequest = new HttpPost(String.format("%s/%s", serverUrl, command));
8388 postRequest.addHeader("accept", JSON_MEDIA_TYPE);
84
-
8589 postRequest.addHeader("content-type", JSON_MEDIA_TYPE);
90
+
91
+ if (headers != null) {
92
+ for (String header : headers.keySet()) {
93
+ String headerValue = headers.get(header);
94
+ postRequest.addHeader(header, headerValue);
95
+ }
96
+ }
97
+
8698 try {
8799 postRequest.setEntity(new StringEntity(JsonUtils.toJSON(req)));
88100 } catch (UnsupportedEncodingException | SeCurisException e1) {