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
This commit is contained in:
parent
824a7c185b
commit
c0d2028156
9
pom.xml
9
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>common-jaxrs-client</artifactId>
|
<artifactId>common-jaxrs-client</artifactId>
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
<version>1.0.2-SNAPSHOT</version>
|
||||||
<name>gcube-jaxrs-client</name>
|
<name>gcube-jaxrs-client</name>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
@ -24,7 +24,12 @@
|
||||||
<artifactId>common-gcube-calls</artifactId>
|
<artifactId>common-gcube-calls</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>gxRest</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.glassfish.jersey.core</groupId>
|
||||||
<artifactId>jersey-client</artifactId>
|
<artifactId>jersey-client</artifactId>
|
||||||
<version>2.24.1</version>
|
<version>2.24.1</version>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import javax.ws.rs.client.ClientBuilder;
|
||||||
import javax.ws.rs.client.WebTarget;
|
import javax.ws.rs.client.WebTarget;
|
||||||
import javax.xml.ws.EndpointReference;
|
import javax.xml.ws.EndpointReference;
|
||||||
|
|
||||||
|
import org.gcube.common.gxrest.request.GXWebTargetAdapterRequest;
|
||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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{
|
try{
|
||||||
|
|
||||||
Client client = ClientBuilder.newClient()
|
Client client = ClientBuilder.newClient()
|
||||||
.property(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE)
|
.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");
|
.property(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -44,8 +45,14 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{
|
||||||
if (status!=200)
|
if (status!=200)
|
||||||
throw new Exception();*/
|
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));
|
webTarget.register(new JaxRSRequestFilter(target));
|
||||||
|
|
||||||
return webTarget;
|
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);
|
return at(new JaxRSEndpointReference(endpoint).address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.gcube.common.calls.jaxrs;
|
||||||
|
|
||||||
import javax.ws.rs.client.WebTarget;
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
|
||||||
|
import org.gcube.common.gxrest.request.GXWebTargetAdapterRequest;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ public interface TargetFactoryDSL {
|
||||||
* @param address the address
|
* @param address the address
|
||||||
* @return the stub
|
* @return the stub
|
||||||
*/
|
*/
|
||||||
WebTarget at(String address);
|
GXWebTargetAdapterRequest at(String address);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue