org.jboss.resteasy.client.jaxrs.ClientHttpEngine Java Examples

The following examples show how to use org.jboss.resteasy.client.jaxrs.ClientHttpEngine. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UmaClientFactory.java    From oxAuth with MIT License 6 votes vote down vote up
public UmaPermissionService createPermissionService(UmaMetadata metadata, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getPermissionEndpoint()));
    return target.proxy(UmaPermissionService.class);
}
 
Example #2
Source File: UmaClientFactory.java    From oxAuth with MIT License 6 votes vote down vote up
public UmaTokenService createTokenService(UmaMetadata metadata, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getTokenEndpoint()));
    return target.proxy(UmaTokenService.class);
}
 
Example #3
Source File: AdminClientUtil.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #4
Source File: SchedulerRestClient.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #5
Source File: RMRestClient.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example #6
Source File: ResteasyGitLabClientBuilder.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
protected ClientHttpEngine initDefaultEngine() {
    ApacheHttpClient4Engine httpEngine = (ApacheHttpClient4Engine) super.initDefaultEngine();
    if (proxyCredentials != null) {
        ((DefaultHttpClient) httpEngine.getHttpClient()).setCredentialsProvider(proxyCredentials);
    }
    return httpEngine;
}
 
Example #7
Source File: ClientFactory.java    From oxAuth with MIT License 5 votes vote down vote up
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;
}
 
Example #8
Source File: RestClientFactoryImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@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();
  }
}
 
Example #9
Source File: UmaClientFactory.java    From oxAuth with MIT License 4 votes vote down vote up
public UmaMetadataService createMetadataService(String umaMetadataUri, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(umaMetadataUri));
    return target.proxy(UmaMetadataService.class);
}
 
Example #10
Source File: AdminClientUtil.java    From keycloak with Apache License 2.0 4 votes vote down vote up
public static ClientHttpEngine getCustomClientHttpEngine(ResteasyClientBuilder resteasyClientBuilder, int validateAfterInactivity) {
    return new CustomClientHttpEngineBuilder43(validateAfterInactivity).resteasyClientBuilder(resteasyClientBuilder).build();
}
 
Example #11
Source File: HttpService.java    From oxd with Apache License 2.0 4 votes vote down vote up
public ClientHttpEngine getClientEngine() {
    return new ApacheHttpClient4Engine(getHttpClient());
}
 
Example #12
Source File: BaseTest.java    From oxAuth with MIT License 4 votes vote down vote up
public static ClientHttpEngine clientEngine(boolean trustAll) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
    if (trustAll) {
        return new ApacheHttpClient4Engine(createAcceptSelfSignedCertificateClient());
    }
    return new ApacheHttpClient4Engine(createClient());
}
 
Example #13
Source File: BaseTest.java    From oxAuth with MIT License 4 votes vote down vote up
public static ClientHttpEngine clientEngine() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
    return clientEngine(false);
}
 
Example #14
Source File: UmaClientFactory.java    From oxAuth with MIT License 4 votes vote down vote up
public ResteasyClient newClient(ClientHttpEngine engine) {
    return new ResteasyClientBuilder().httpEngine(engine).build();
}
 
Example #15
Source File: UmaClientFactory.java    From oxAuth with MIT License 4 votes vote down vote up
public UmaScopeService createScopeService(String scopeEndpointUri, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(scopeEndpointUri));
    return target.proxy(UmaScopeService.class);
}
 
Example #16
Source File: UmaClientFactory.java    From oxAuth with MIT License 4 votes vote down vote up
public UmaRptIntrospectionService createRptStatusService(UmaMetadata metadata, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getIntrospectionEndpoint()));
    return target.proxy(UmaRptIntrospectionService.class);
}
 
Example #17
Source File: UmaClientFactory.java    From oxAuth with MIT License 4 votes vote down vote up
public UmaResourceService createResourceService(UmaMetadata metadata, ClientHttpEngine engine) {
    ResteasyWebTarget target = newClient(engine).target(new ResteasyUriBuilder().uri(metadata.getResourceRegistrationEndpoint()));
    return target.proxy(UmaResourceService.class);
}
 
Example #18
Source File: DataSpaceClient.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
public DataSpaceClient(String restServerUrl, ClientHttpEngine httpEngine) {
    this.httpEngine = httpEngine;
    this.restDataspaceUrl = restDataspaceUrl(restServerUrl);
}