use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project motan by weibocom.
the class AbstractEndpointFactory method createClient.
@Override
public ResteasyWebTarget createClient(URL url) {
String ipPort = url.getServerPortStr();
String protocolKey = MotanFrameworkUtil.getProtocolKey(url);
LoggerUtil.info(this.getClass().getSimpleName() + " create share_channel client: url={}", url);
synchronized (ipPort2ClientShareChannel) {
ResteasyWebTarget client = ipPort2ClientShareChannel.get(ipPort);
if (client != null) {
saveEndpoint2Urls(client2UrlsShareChannel, client, protocolKey);
return client;
}
client = innerCreateClient(url);
ipPort2ClientShareChannel.put(ipPort, client);
saveEndpoint2Urls(client2UrlsShareChannel, client, protocolKey);
return client;
}
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class Utils method post.
public static String post(String endpoint, String payload) throws HttpException {
String data = null;
try {
ResteasyWebTarget target = rsClient.target(endpoint);
logger.info("Sending payload to {}", endpoint);
logger.debug("{}", payload);
Response response = target.request().post(Entity.json(payload));
response.bufferEntity();
int status = response.getStatus();
data = response.readEntity(String.class);
logger.debug("Response code was {} and body:\n{}", status, data);
if (status == 200) {
return data;
} else {
throw new HttpException(status, "Unsuccessful response obtained", data);
}
} catch (Exception e) {
throw new HttpException(e.getMessage(), e.getCause(), data);
}
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class FidoU2fClientFactory method createMetaDataConfigurationService.
public U2fConfigurationService createMetaDataConfigurationService(String u2fMetaDataUri) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(u2fMetaDataUri));
U2fConfigurationService proxy = target.proxy(U2fConfigurationService.class);
return proxy;
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class UmaClientFactory method createRptStatusService.
public UmaRptIntrospectionService createRptStatusService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(metadata.getIntrospectionEndpoint()));
UmaRptIntrospectionService proxy = target.proxy(UmaRptIntrospectionService.class);
return proxy;
}
use of org.jboss.resteasy.client.jaxrs.ResteasyWebTarget in project oxAuth by GluuFederation.
the class UmaClientFactory method createResourceService.
public UmaResourceService createResourceService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyClient client = ((ResteasyClientBuilder) ResteasyClientBuilder.newBuilder()).httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(metadata.getResourceRegistrationEndpoint()));
UmaResourceService proxy = target.proxy(UmaResourceService.class);
return proxy;
}
Aggregations