Lucio Lelii 3 years ago
parent
commit
eb500fa88c
  1. 2
      .classpath
  2. 6
      .settings/org.eclipse.jdt.core.prefs
  3. 2
      pom.xml
  4. 23
      src/main/java/org/gcube/common/calls/jaxrs/TargetFactory.java

2
.classpath

@ -27,7 +27,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

6
.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

2
pom.xml

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.common</groupId>
<artifactId>common-jaxrs-client</artifactId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.3-SNAPSHOT</version>
<name>gcube-jaxrs-client</name>
<parent>

23
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/");
int status = resourcetarget.request().get().getStatus();
if (status!=200)
throw new Exception();*/
//WebTarget webTarget = client.target(address).path(target.path());
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());
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);
}
}

Loading…
Cancel
Save