diff --git a/.classpath b/.classpath index 953de0b..ace8266 100644 --- a/.classpath +++ b/.classpath @@ -27,7 +27,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index ec4300d..714351a 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/pom.xml b/pom.xml index e2f5c75..ae86876 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.gcube.common common-jaxrs-client - 1.0.2-SNAPSHOT + 1.0.3-SNAPSHOT gcube-jaxrs-client 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 ead81d8..d969813 100644 --- a/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java +++ b/src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java @@ -29,23 +29,14 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ public GXWebTargetAdapterRequest getAsGxRest(String address) { try{ - - - /* - String resourceAddress = address.substring(0, address.indexOf("/service")); - WebTarget resourcetarget = client.target(resourceAddress).path("/resource/"); + GXWebTargetAdapterRequest webTarget = null; + if (address.startsWith("https")) { + log.info("using secure call"); + webTarget = GXWebTargetAdapterRequest.newHTTPSRequest(address).path(target.path()); + } else webTarget = GXWebTargetAdapterRequest.newRequest(address).path(target.path()); - int status = resourcetarget.request().get().getStatus(); - - if (status!=200) - throw new Exception();*/ - - //WebTarget webTarget = client.target(address).path(target.path()); - - - - GXWebTargetAdapterRequest webTarget = GXWebTargetAdapterRequest.newRequest(address).path(target.path()); + webTarget.configProperty(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED"); @@ -64,6 +55,7 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ try{ + Client client = ClientBuilder.newClient() .property(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE) .property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024*1024).property(ClientProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, -1) @@ -88,5 +80,6 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{ return at(new JaxRSEndpointReference(endpoint).address); } + }