Package com.sun.jersey.api.client.config

Examples of com.sun.jersey.api.client.config.ClientConfig


  }

  @Test
  public void agentRegistration() throws UniformInterfaceException, JSONException {
    RegistrationResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/register/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(RegistrationResponse.class, createDummyJSONRegister());
    LOG.info("Returned from Server responce=" + response);
View Full Code Here


  }

  @Test
  public void agentHeartBeat() throws UniformInterfaceException, JSONException {
    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeat());
    LOG.info("Returned from Server: "
View Full Code Here

  }

  @Test
  public void agentHeartBeatWithEnv() throws UniformInterfaceException, JSONException {
    HeartBeatResponse response;
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    WebResource webResource = client.resource("http://localhost:9998/heartbeat/dummyhost");
    response = webResource.type(MediaType.APPLICATION_JSON)
        .post(HeartBeatResponse.class, createDummyHeartBeatWithAgentEnv());
    LOG.info("Returned from Server: "
View Full Code Here

  private URI resURI;
  private boolean isEnabled;

  public TimelineClientImpl() {
    super(TimelineClientImpl.class.getName());
    ClientConfig cc = new DefaultClientConfig();
    cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
    client = Client.create(cc);
  }
View Full Code Here

    builder = addHeaders( builder );
    return builder;
  }

  private Client createIgnoreHttpsValidationClient() {
    ClientConfig config = new DefaultClientConfig();
    try {
      HTTPSProperties httpProperties = new HTTPSProperties( new HostnameVerifier() {
        @Override
        public boolean verify( String arg0, SSLSession arg1 ) {
          return true;
        }
      } );
      config.getProperties().put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpProperties );
    } catch( NoSuchAlgorithmException shouldNotHappen ) {
      throw new IllegalStateException( shouldNotHappen );
    }
    return Client.create( config );
  }
View Full Code Here

    public static class RestClient{
        private Client client;
        private final ObjectMapper objectMapper = createObjectMapper();

        public RestClient() {
            ClientConfig cc = new DefaultClientConfig();
            JacksonConfigurator jc = new JacksonConfigurator(objectMapper);
            cc.getSingletons().add(jc);
            cc.getClasses().add(JacksonJsonProvider.class);
            this.client =  Client.create(cc);
            this.client.addFilter(new LoggingFilter());
        }
View Full Code Here

       * be holding the Client as a static variable.
       */
      if(httpClient != null) {
        return httpClient;
      }
      ClientConfig config = new DefaultClientConfig();
      httpClient = Client.create(config);
      return httpClient;
    }
    catch(Exception e) {
      e.printStackTrace();
View Full Code Here

       */
      if(httpClient != null) {
        return httpClient;
      }
     
      ClientConfig config = new DefaultClientConfig();
      SSLContext ctx = SSLContext.getDefault();
     
        config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(new HostnameVerifier() {
              @Override
              public boolean verify(String arg0, SSLSession arg1) {
                  return true;
              }}, ctx));
      Client http_client = Client.create(config);
View Full Code Here

        } else if (new File("src/main/webapp").exists()) {
            this.server = new EmbeddedServer(15000, "src/main/webapp");
        } else {
            throw new RuntimeException("Cannot run jersey tests");
        }
        ClientConfig config = new DefaultClientConfig();
        Client client = Client.create(config);
        this.service = client.resource(UriBuilder.fromUri(BASE_URL).build());
        this.server.start();

        if (System.getProperty("ivory.test.hadoop.embedded", "true").equals("true")) {
View Full Code Here

            this.resourceConfig = ad.getResourceConfig();
            this.webApp = WebApplicationFactory.createWebApplication();
        }

        public Client getClient() {
            ClientConfig clientConfig = new DefaultClientConfig();

            clientConfig.getSingletons().addAll(resourceConfig.getProviderSingletons());

            return new Client(new TestResourceClientHandler(baseUri, webApp), clientConfig);
        }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.config.ClientConfig

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.