Java源码示例:org.jboss.resteasy.client.jaxrs.ClientHttpEngine
示例1
@Override
public Client create(final RestClientConfiguration configuration) {
checkNotNull(configuration);
try (TcclBlock tccl = TcclBlock.begin(ResteasyClientBuilder.class)) {
HttpContext httpContext = new BasicHttpContext();
if (configuration.getUseTrustStore()) {
httpContext.setAttribute(SSLContextSelector.USE_TRUST_STORE, true);
}
HttpClient client;
if (configuration.getHttpClient() != null) {
client = checkNotNull(configuration.getHttpClient().get());
}
else {
client = httpClient.get();
}
ClientHttpEngine httpEngine = new ApacheHttpClient4Engine(client, httpContext);
ResteasyClientBuilder builder = new ResteasyClientBuilder().httpEngine(httpEngine);
if (configuration.getCustomizer() != null) {
configuration.getCustomizer().apply(builder);
}
return builder.build();
}
}
示例2
private static SchedulerRestInterface createRestProxy(ResteasyProviderFactory provider, String restEndpointURL,
ClientHttpEngine httpEngine) {
ResteasyClient client = buildResteasyClient(provider);
ResteasyWebTarget target = client.target(restEndpointURL);
SchedulerRestInterface schedulerRestClient = target.proxy(SchedulerRestInterface.class);
return createExceptionProxy(schedulerRestClient);
}
示例3
private static RMRestInterface createRestProxy(ResteasyProviderFactory provider, String restEndpointURL,
ClientHttpEngine httpEngine) {
ResteasyClient client = buildResteasyClient(provider);
ResteasyWebTarget target = client.target(restEndpointURL);
RMRestInterface rmRestInterface = target.proxy(RMRestInterface.class);
return createExceptionProxy(rmRestInterface);
}
示例4
@SuppressWarnings("deprecation")
@Override
protected ClientHttpEngine initDefaultEngine() {
ApacheHttpClient4Engine httpEngine = (ApacheHttpClient4Engine) super.initDefaultEngine();
if (proxyCredentials != null) {
((DefaultHttpClient) httpEngine.getHttpClient()).setCredentialsProvider(proxyCredentials);
}
return httpEngine;
}
示例5
public IntrospectionService createIntrospectionService(String p_url, ClientHttpEngine engine) {
ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
ResteasyWebTarget target = client.target(UriBuilder.fromPath(p_url));
IntrospectionService proxy = target.proxy(IntrospectionService.class);
return proxy;
}
示例6
@Override
protected ClientHttpEngine createEngine(final HttpClientConnectionManager cm, final RequestConfig.Builder rcBuilder,
final HttpHost defaultProxy, final int responseBufferSize, final HostnameVerifier verifier, final SSLContext theContext) {
if (cm instanceof PoolingHttpClientConnectionManager) {
PoolingHttpClientConnectionManager pcm = (PoolingHttpClientConnectionManager) cm;
pcm.setValidateAfterInactivity(validateAfterInactivity);
return super.createEngine(pcm, rcBuilder, defaultProxy, responseBufferSize, verifier, theContext);
} else {
return super.createEngine(cm, rcBuilder, defaultProxy, responseBufferSize, verifier, theContext);
}
}
示例7
public DataSpaceClient(String restServerUrl, ClientHttpEngine httpEngine) {
this.httpEngine = httpEngine;
this.restDataspaceUrl = restDataspaceUrl(restServerUrl);
}
示例8
public UmaResourceService createResourceService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getResourceRegistrationEndpoint()));
return target.proxy(UmaResourceService.class);
}
示例9
public UmaPermissionService createPermissionService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getPermissionEndpoint()));
return target.proxy(UmaPermissionService.class);
}
示例10
public UmaRptIntrospectionService createRptStatusService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getIntrospectionEndpoint()));
return target.proxy(UmaRptIntrospectionService.class);
}
示例11
public UmaMetadataService createMetadataService(String umaMetadataUri, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(umaMetadataUri));
return target.proxy(UmaMetadataService.class);
}
示例12
public UmaScopeService createScopeService(String scopeEndpointUri, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(scopeEndpointUri));
return target.proxy(UmaScopeService.class);
}
示例13
public UmaTokenService createTokenService(UmaMetadata metadata, ClientHttpEngine engine) {
ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getTokenEndpoint()));
return target.proxy(UmaTokenService.class);
}
示例14
public ResteasyClient newClient(ClientHttpEngine engine) {
return new ResteasyClientBuilder().httpEngine(engine).build();
}
示例15
public static ClientHttpEngine clientEngine() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
return clientEngine(false);
}
示例16
public static ClientHttpEngine clientEngine(boolean trustAll) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
if (trustAll) {
return new ApacheHttpClient4Engine(createAcceptSelfSignedCertificateClient());
}
return new ApacheHttpClient4Engine(createClient());
}
示例17
public ClientHttpEngine getClientEngine() {
return new ApacheHttpClient4Engine(getHttpClient());
}
示例18
public static ClientHttpEngine getCustomClientHttpEngine(ResteasyClientBuilder resteasyClientBuilder, int validateAfterInactivity) {
return new CustomClientHttpEngineBuilder43(validateAfterInactivity).resteasyClientBuilder(resteasyClientBuilder).build();
}