diff options
author | mmis <michael.morris@ericsson.com> | 2018-08-30 13:34:55 +0100 |
---|---|---|
committer | mmis <michael.morris@ericsson.com> | 2018-08-30 13:39:26 +0100 |
commit | ef849e64bc904f729bace1fb2c43f8cf34de3dd5 (patch) | |
tree | 8879ae092ef1af626bce444fc486fa3076596a99 /policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java | |
parent | 5443573fe9f8a183f968aa63d08dc3543e73c305 (diff) |
Add support for http PUT
Added support for http PUT for use by the policy forwarder in
policy/distribution
Issue-ID: POLICY-926
Change-Id: Ifa5c2e8be0582797936b95b772ad236f35c10f24
Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java')
-rw-r--r-- | policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java index c227071c..0be81099 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java @@ -28,12 +28,16 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import java.util.Map; +import java.util.Map.Entry; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; import javax.ws.rs.core.Response; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; @@ -66,14 +70,9 @@ public class JerseyClient implements HttpClient { /** * Constructor. * - * name the name - * https is it https or not - * selfSignedCerts are there self signed certs - * hostname the hostname - * port port being used - * basePath base context - * userName user - * password password + * name the name https is it https or not selfSignedCerts are there self signed certs hostname + * the hostname port port being used basePath base context userName user password password + * * @param busTopicParams Input parameters object * @throws KeyManagementException key exception * @throws NoSuchAlgorithmException no algorithm exception @@ -163,6 +162,14 @@ public class JerseyClient implements HttpClient { return this.client.target(this.baseUrl).request().get(); } + @Override + public Response put(String path, Entity<?> entity, Map<String, Object> headers) { + Builder builder = this.client.target(this.baseUrl).path(path).request(); + for (Entry<String, Object> header : headers.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + return builder.put(entity); + } @Override public boolean start() { |