Package com.sun.jersey.client.apache.config

Examples of com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig


  public IZencoderClient createClient(ZencoderAPIVersion apiVersion) {
    ZencoderClient zencoderClient = new ZencoderClient(API_KEY, apiVersion);
    HttpClient client = new HttpClient(new SimpleHttpConnectionManager());
    ApacheHttpClientHandler apacheHttpClientHandler = new ApacheHttpClientHandler(
        client, new DefaultApacheHttpClientConfig());
    ApacheHttpClient httpClient = new ApacheHttpClient(
        apacheHttpClientHandler);
    zencoderClient.setHttpClient(httpClient);

    return zencoderClient;
View Full Code Here


  private final ProjectRolesRestClient projectRolesRestClient;


  public JerseyJiraRestClient(final URI serverUri, final AuthenticationHandler authenticationHandler) {
        this.baseUri = UriBuilder.fromUri(serverUri).path("/rest/api/latest").build();
        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
        authenticationHandler.configure(config);
        final ApacheHttpClient client = new ApacheHttpClient(createDefaultClientHander(config)) {
            @Override
            public WebResource resource(URI u) {
                final WebResource resource = super.resource(u);
View Full Code Here

        responseParser.checkStatus(response, NO_CONTENT.getStatusCode());
    }

    private static Client createClient(PlatformParameters platformParameters) {

        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();

        if (hasText(platformParameters.getProxyHost()) && (platformParameters.getProxyPort() > 0)) {
            config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PROXY_URI,
                    "http://" + platformParameters.getProxyHost() + ":" + platformParameters.getProxyPort());
            if (hasText(platformParameters.getProxyUserId()) && hasText(platformParameters.getProxyPassword())) {
                config.getState().setProxyCredentials(null, platformParameters.getProxyHost(),
                        platformParameters.getProxyPort(), platformParameters.getProxyUserId(),
                        platformParameters.getProxyPassword());
            }
        }

        for (Class<?> c : PROVIDERS_CLASSES) {
            config.getClasses().add(c);
        }
        config.getProperties().put(ApacheHttpClientConfig.PROPERTY_READ_TIMEOUT, READ_TIMEOUT_IN_MILLIS);

        Client client = ApacheHttpClient.create(config);
        client.setFollowRedirects(true);
        client.addFilter(new HTTPBasicAuthFilter(platformParameters.getPrincipal(), platformParameters.getPassword()));
       
View Full Code Here

  private WebResource prepareWebResource(URI uri) {
    WebResource wr = null;
    if (httpBasicAuthUsername != null && httpBasicAuthPassword != null) {
      if (this.client == null) {
        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
        config.getState().setCredentials(null, null, -1, httpBasicAuthUsername, httpBasicAuthPassword);
        config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION, true);
        ApacheHttpClientHandler ahcHandler = new ApacheHttpClientHandler(new HttpClient(new MultiThreadedHttpConnectionManager()), config);
        ApacheHttpClient ahc = new ApacheHttpClient(ahcHandler);
        setClient(ahc);
        wr = ahc.resource(uri);
      }
View Full Code Here

     * Returns a client configuration with the proper settings/features for
     * communication with AppThwack.
     * @return fully created client configuration object.
     */
    private ClientConfig getClientConfig(String apiKey) {
        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
        config.getState().setCredentials(null, uri.getHost(), -1, apiKey, "");
        config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION, Boolean.TRUE);
        config.getClasses().add(JacksonJaxbJsonProvider.class);
        config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
        config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, Boolean.TRUE);
        return config;
    }
View Full Code Here

     * Returns a client configuration with the proper settings/features for
     * communication with AppThwack.
     * @return fully created client configuration object.
     */
    private ClientConfig getClientConfig(String apiKey) {
        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
        config.getState().setCredentials(null, uri.getHost(), -1, apiKey, "");
        config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION, Boolean.TRUE);
        config.getClasses().add(JacksonJaxbJsonProvider.class);
        config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
        config.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, Boolean.TRUE);
        return config;
    }
View Full Code Here

    /**
     * Create a new client instance.
     *
     */
    public ApacheHttpClient() {
        this(createDefaultClientHander(new DefaultApacheHttpClientConfig()));
    }
View Full Code Here

     * Create a default client.
     *
     * @return a default client.
     */
    public static ApacheHttpClient create() {
        return create(new DefaultApacheHttpClientConfig());
    }
View Full Code Here

     * Create a new root handler with an {@link HttpClient}.
     *
     * @param client the {@link HttpClient}.
     */
    public ApacheHttpClientHandler(HttpClient client) {
        this(client, new DefaultApacheHttpClientConfig(), new DefaultApacheHttpMethodExecutor(client));
    }
View Full Code Here

  private final VersionRestClient versionRestClient;


  public JerseyJiraRestClient(final URI serverUri, final AuthenticationHandler authenticationHandler) {
        this.baseUri = UriBuilder.fromUri(serverUri).path("/rest/api/latest").build();
        DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
        authenticationHandler.configure(config);
        final ApacheHttpClient client = new ApacheHttpClient(createDefaultClientHander(config)) {
            @Override
            public WebResource resource(URI u) {
                final WebResource resource = super.resource(u);
View Full Code Here

TOP

Related Classes of com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.