Package javax.ws.rs.client

Examples of javax.ws.rs.client.WebTarget.request()


      for (Object o : entry.getValue()) {
        target = target.queryParam(entry.getKey(), o);
      }
    }
        target.register(logger);
    Invocation.Builder invocation = target.request();

    for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) {
      StringBuilder sb = new StringBuilder();
      for(Object v : h.getValue()) {
        sb.append(String.valueOf(v));
View Full Code Here


  }

  private static void createServerAdminUser() {
    Client client = ClientBuilder.newClient();
    WebTarget target = client.target( serverUri + "/_config/admins/" + serverAdminUser );
    target.request().put( Entity.text( "\"" + serverAdminPassword + "\"" ) ).close();
  }

  private static void createDatabaseUser() throws Exception {
    // 1.) create user
    WebTarget target = client.target( serverUri + "/_users/org.couchdb.user:" + databaseUser );
View Full Code Here

  }

  private static void createDatabaseUser() throws Exception {
    // 1.) create user
    WebTarget target = client.target( serverUri + "/_users/org.couchdb.user:" + databaseUser );
    Response response = target.request().put( Entity.text(
        "{ " +
            "\"_id\" : \"org.couchdb.user:" + databaseUser + "\", " +
            "\"type\" : \"user\", " +
            "\"name\" : \"" + databaseUser + "\", " +
            "\"roles\" : [], " +
View Full Code Here

    databaseUserRevision = (String) new ObjectMapper().readValue( entity, Map.class ).get( "rev" );
    response.close();

    // 2.) make the user an admin of the database
    target = client.target( serverUri + "/" + database + "/_security" );
    response = target.request().put( Entity.text(
        "{" +
            "\"admins\": {" +
                "\"names\":[\"" + databaseUser + "\"]," +
                " \"roles\":[]" +
            "}, " +
View Full Code Here

    response.close();
  }

  private static void createTestDatabase() {
    WebTarget target = client.target( serverUri + "/" + database );
    target.request().put( null ).close();
  }

  private static void deleteDatabaseUser() {
    WebTarget target = client.target( serverUri + "/_users/org.couchdb.user:" + databaseUser + "?rev=" + databaseUserRevision );
    target.request().delete().close();
View Full Code Here

    target.request().put( null ).close();
  }

  private static void deleteDatabaseUser() {
    WebTarget target = client.target( serverUri + "/_users/org.couchdb.user:" + databaseUser + "?rev=" + databaseUserRevision );
    target.request().delete().close();
  }

  private static void dropTestDatabase() {
    WebTarget target = client.target( serverUri + "/" + database );
    target.request().delete().close();
View Full Code Here

    target.request().delete().close();
  }

  private static void dropTestDatabase() {
    WebTarget target = client.target( serverUri + "/" + database );
    target.request().delete().close();
  }

  private static void deleteServerAdminUser() {
    WebTarget target = client.target( serverUri + "/_config/admins/" + serverAdminUser );
    target.request().delete().close();
View Full Code Here

    target.request().delete().close();
  }

  private static void deleteServerAdminUser() {
    WebTarget target = client.target( serverUri + "/_config/admins/" + serverAdminUser );
    target.request().delete().close();
  }

  private static ResteasyClient getClientWithServerAdminCredentials() {
    DefaultHttpClient httpClient = new DefaultHttpClient();
View Full Code Here

        target.register(new BraveClientRequestFilter(clientTracer, Optional.<String>absent()));
        target.register(new BraveClientResponseFilter(clientTracer, Optional.<String>absent()));

        final EndPointSubmitter endPointSubmitter = Brave.getEndPointSubmitter();
        endPointSubmitter.submit("127.0.0.1", 9998, "brave-jersey2");
        final Response response = target.request().get();
        assertEquals(200, response.getStatus());

        final List<Span> collectedSpans = SpanCollectorForTesting.getInstance().getCollectedSpans();
        assertEquals(2, collectedSpans.size());
        final Span clientSpan = collectedSpans.get(0);
View Full Code Here

    }

    public String changeInterval(String location,int newValue){
        JsonObject interval = Json.createObjectBuilder().add("interval", newValue).add("location",location).build();
        WebTarget administrationTarget = getAdministrationTarget();
        final Response response = administrationTarget.request().post(Entity.json(interval));
        return response.readEntity(JsonObject.class).getString("nextTimeout");

    }

    private WebTarget getAdministrationTarget() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.