From c0d2028156ec51837af94cec885cbabcbdda0d3e Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Thu, 25 Oct 2018 14:56:42 +0000 Subject: [PATCH] merge for release 4.13 git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-jaxrs-client/1.0@173830 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 9 +++++++-- .../gcube/common/calls/jaxrs/TargetFactory.java | 17 ++++++++++++----- .../common/calls/jaxrs/TargetFactoryDSL.java | 4 +++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index ce8127b..e2f5c75 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.gcube.common common-jaxrs-client - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT gcube-jaxrs-client @@ -24,7 +24,12 @@ common-gcube-calls [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) - + + org.gcube.common + gxRest + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + org.glassfish.jersey.core jersey-client 2.24.1 diff --git a/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java b/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java index 953657b..4c99c44 100644 --- a/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java +++ b/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java @@ -5,6 +5,7 @@ import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.xml.ws.EndpointReference; +import org.gcube.common.gxrest.request.GXWebTargetAdapterRequest; import org.glassfish.jersey.client.ClientProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,13 +26,13 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ } - public WebTarget at(String address) { + public GXWebTargetAdapterRequest at(String address) { try{ Client client = ClientBuilder.newClient() .property(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE) - .property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024).property(ClientProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, -1) + .property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024*1024).property(ClientProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, -1) .property(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED"); /* @@ -44,8 +45,14 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ if (status!=200) throw new Exception();*/ - WebTarget webTarget = client.target(address).path(target.path()); - + //WebTarget webTarget = client.target(address).path(target.path()); + + + + GXWebTargetAdapterRequest webTarget = GXWebTargetAdapterRequest.newRequest(address).path(target.path()); + + webTarget.configProperty(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED"); + webTarget.register(new JaxRSRequestFilter(target)); return webTarget; @@ -58,7 +65,7 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ } - public WebTarget at(EndpointReference endpoint){ + public GXWebTargetAdapterRequest at(EndpointReference endpoint){ return at(new JaxRSEndpointReference(endpoint).address); } diff --git a/src/main/java/org/gcube/common/calls/jaxrs/TargetFactoryDSL.java b/src/main/java/org/gcube/common/calls/jaxrs/TargetFactoryDSL.java index 03dc594..f64cfd0 100644 --- a/src/main/java/org/gcube/common/calls/jaxrs/TargetFactoryDSL.java +++ b/src/main/java/org/gcube/common/calls/jaxrs/TargetFactoryDSL.java @@ -2,6 +2,8 @@ package org.gcube.common.calls.jaxrs; import javax.ws.rs.client.WebTarget; +import org.gcube.common.gxrest.request.GXWebTargetAdapterRequest; + @@ -27,7 +29,7 @@ public interface TargetFactoryDSL { * @param address the address * @return the stub */ - WebTarget at(String address); + GXWebTargetAdapterRequest at(String address); }