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:
Lucio Lelii 2018-10-25 14:56:42 +00:00
parent 824a7c185b
commit c0d2028156
3 changed files with 22 additions and 8 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.common</groupId>
<artifactId>common-jaxrs-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
<name>gcube-jaxrs-client</name>
<parent>
@ -24,7 +24,12 @@
<artifactId>common-gcube-calls</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</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>
<artifactId>jersey-client</artifactId>
<version>2.24.1</version>

View File

@ -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);
}

View File

@ -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);
}