Lucio Lelii 6 years ago
parent c0d2028156
commit 9681f66694

@ -26,14 +26,10 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{
}
public GXWebTargetAdapterRequest at(String address) {
public GXWebTargetAdapterRequest getAsGxRest(String address) {
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)
.property(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED");
/*
String resourceAddress = address.substring(0, address.indexOf("/service"));
@ -64,8 +60,31 @@ public class TargetFactory implements TargetFactoryDSL.AtClause{
}
public WebTarget at(String address) {
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)
.property(ClientProperties.REQUEST_ENTITY_PROCESSING, "CHUNKED");
WebTarget webTarget = client.target(address).path(target.path());
webTarget.register(new JaxRSRequestFilter(target));
return webTarget;
}catch (Exception e) {
log.error("error building service",e);
throw new RuntimeException("error building service",e);
}
}
public GXWebTargetAdapterRequest at(EndpointReference endpoint){
public WebTarget at(EndpointReference endpoint){
return at(new JaxRSEndpointReference(endpoint).address);
}

@ -29,8 +29,14 @@ public interface TargetFactoryDSL {
* @param address the address
* @return the stub
*/
GXWebTargetAdapterRequest at(String address);
GXWebTargetAdapterRequest getAsGxRest(String address);
/**
* Returns a stub for a service endpoint at a given address.
* @param address the address
* @return the stub
*/
WebTarget at(String address);
}
}

Loading…
Cancel
Save