Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.WebResource.queryParam()


  @Override
  public <T> OpenStackResponse request(OpenStackRequest<T> request) {
    WebResource target = client.resource(request.endpoint()).path(request.path());
    for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) {
      for (Object o : entry.getValue()) {
        target = target.queryParam(entry.getKey(), String.valueOf(o));
      }
    }
    target.addFilter(logger);
    MultivaluedMap<String, Object> headers = new OutBoundHeaders();
    for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) {
View Full Code Here


    WebResource rt = r;
    for (String path : paths) {
      rt = rt.path(path);
    }
    if (isAuthenticationEnabled()) {
      rt = rt.queryParam("user.name", webserviceUserName);
    }
    return rt;
  }

  private WebResource constructWebResource(String... paths) {
View Full Code Here

        String locationHeaderValue =
            response.getHeaders().getFirst(HttpHeaders.LOCATION);
        Client c = Client.create();
        WebResource tmp = c.resource(locationHeaderValue);
        if (isAuthenticationEnabled()) {
          tmp = tmp.queryParam("user.name", webserviceUserName);
        }
        response = tmp.get(ClientResponse.class);
        assertEquals(Status.OK, response.getClientResponseStatus());
        assertTrue(locationHeaderValue.endsWith("/ws/v1/cluster/apps/"
            + app.getApplicationId().toString() + "/state"));
View Full Code Here

    String locURL = response.getHeaders().getFirst(HttpHeaders.LOCATION);
    assertTrue(locURL.indexOf("/apps/application") != -1);
    appId = locURL.substring(locURL.indexOf("/apps/") + "/apps/".length());

    WebResource res = resource().uri(new URI(locURL));
    res = res.queryParam("user.name", webserviceUserName);
    response = res.get(ClientResponse.class);
    assertEquals(Status.OK, response.getClientResponseStatus());

    RMApp app =
        rm.getRMContext().getRMApps()
View Full Code Here

  }

  protected BatchRequestResponse performApiGetRequest(String relativeUri, boolean queryAllFields) {
    WebResource webResource = ambariWebResource.path(relativeUri);
    if (queryAllFields) {
      webResource = webResource.queryParam("fields", "*");
    }
    ClientResponse response;
    try {
      response = webResource.get(ClientResponse.class);
    } catch (UniformInterfaceException e) {
View Full Code Here

                                     String entityName, String colo) throws FalconCLIException {

        WebResource resource = service.path(entities.path)
                .path(entityType).path(entityName);
        if (colo != null) {
            resource = resource.queryParam("colo", colo);
        }
        ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
                .accept(entities.mimeType).type(MediaType.TEXT_XML)
                .method(entities.method, ClientResponse.class);
View Full Code Here

    private String sendEntityRequestWithObject(Entities entities, String entityType,
                                               Object requestObject, String colo) throws FalconCLIException {
        WebResource resource = service.path(entities.path)
                .path(entityType);
        if (colo != null) {
            resource = resource.queryParam("colo", colo);
        }
        ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
                .accept(entities.mimeType).type(MediaType.TEXT_XML)
                .method(entities.method, ClientResponse.class, requestObject);
View Full Code Here

    }

    public InstancesResult instanceCmd(Instances instances, String type, String name,
                                       String start, String end, String colo) {
        WebResource resource = service.path(instances.path).path(type).path(name);
        resource = resource.queryParam("start", start);
        if (end != null) {
            resource = resource.queryParam("end", end);
        }
        resource = resource.queryParam("colo", colo);
View Full Code Here

    public InstancesResult instanceCmd(Instances instances, String type, String name,
                                       String start, String end, String colo) {
        WebResource resource = service.path(instances.path).path(type).path(name);
        resource = resource.queryParam("start", start);
        if (end != null) {
            resource = resource.queryParam("end", end);
        }
        resource = resource.queryParam("colo", colo);

        return resource.header(REMOTE_USER, USER)
                .accept(instances.mimeType)
View Full Code Here

        WebResource resource = service.path(instances.path).path(type).path(name);
        resource = resource.queryParam("start", start);
        if (end != null) {
            resource = resource.queryParam("end", end);
        }
        resource = resource.queryParam("colo", colo);

        return resource.header(REMOTE_USER, USER)
                .accept(instances.mimeType)
                .method(instances.method, InstancesResult.class);
    }
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.