Package com.sun.jersey.api.client.WebResource

Examples of com.sun.jersey.api.client.WebResource.Builder


    public JaxRsResponse get(String path, String data) {
        return get(path, data, MediaType.APPLICATION_JSON_TYPE);
    }

    public JaxRsResponse get(String path, String data, final MediaType mediaType) {
        Builder builder = builder(path);
        if (data != null) {
            builder = builder.entity(data, mediaType);
        } else {
            builder = builder.type(mediaType);
        }
        return JaxRsResponse.extractFrom(builder.get(ClientResponse.class));
    }
View Full Code Here


        return post(path, data, MediaType.APPLICATION_JSON_TYPE);
    }

    public JaxRsResponse post(String path, String data,
            final MediaType mediaType) {
        Builder builder = builder(path);
        if (data != null) {
            builder = builder.entity(data, mediaType);
        } else {
            builder = builder.type(mediaType);
        }
        return JaxRsResponse.extractFrom(builder.post(ClientResponse.class));
    }
View Full Code Here

        }
        return JaxRsResponse.extractFrom(builder.post(ClientResponse.class));
    }

    public JaxRsResponse put(String path, String data) {
        Builder builder = builder(path);
        if (data != null) {
            builder = builder.entity(data, MediaType.APPLICATION_JSON_TYPE);
        }
        return new JaxRsResponse(builder.put(ClientResponse.class));
    }
View Full Code Here

    public JaxRsResponse get() {
        return get("");
    }

    public JaxRsResponse get(String path, final MediaType acceptType) {
        Builder builder = builder(path, acceptType);
        return JaxRsResponse.extractFrom(builder.get(ClientResponse.class));
    }
View Full Code Here

    public RequestResult get( String path ) {
        return RequestResult.extractFrom(builder(path).get(ClientResponse.class));
    }

    public RequestResult get( String path, String data ) {
        Builder builder = builder(path);
        if ( data != null ) {
            builder = builder.entity( data, MediaType.APPLICATION_JSON_TYPE );
        }
        return RequestResult.extractFrom(builder.get(ClientResponse.class));
    }
View Full Code Here

    public RequestResult delete(String path) {
        return RequestResult.extractFrom(builder(path).delete(ClientResponse.class));
    }

    public RequestResult post( String path, String data ) {
        Builder builder = builder( path );
        if ( data != null ) {
            builder = builder.entity( data, MediaType.APPLICATION_JSON_TYPE );
        }
        return RequestResult.extractFrom(builder.post(ClientResponse.class));
    }
View Full Code Here

        }
        return RequestResult.extractFrom(builder.post(ClientResponse.class));
    }

    public void put( String path, String data ) {
        Builder builder = builder( path );
        if ( data != null ) {
            builder = builder.entity( data, MediaType.APPLICATION_JSON_TYPE );
        }
        final ClientResponse response = builder.put(ClientResponse.class);
        response.close();
    }
View Full Code Here

    WebResource webResource = client.resource(restEndpointUrl + String.format("/containers/%s/start", containerId));

    try {
      LOGGER.trace("POST: {}", webResource);
      Builder builder = webResource.accept(MediaType.TEXT_PLAIN);
      if (hostConfig != null) {
        builder.type(MediaType.APPLICATION_JSON).post(hostConfig);
      } else {
        builder.post((HostConfig) null);
      }
    } catch (UniformInterfaceException exception) {
      if (exception.getResponse().getStatus() == 404) {
        throw new NotFoundException(String.format("No such container %s", containerId));
      } else if (exception.getResponse().getStatus() == 204) {
View Full Code Here

    WebResource webResource = client.resource(restEndpointUrl + String.format("/containers/%s/start", containerId));

    try {
      LOGGER.trace("POST: {}", webResource);
      Builder builder = webResource.accept(MediaType.TEXT_PLAIN);
      if (hostConfig != null) {
        builder.type(MediaType.APPLICATION_JSON).post(hostConfig);
      } else {
        builder.post((HostConfig) null);
      }
    } catch (UniformInterfaceException exception) {
      if (exception.getResponse().getStatus() == 404) {
        throw new NotFoundException(String.format("No such container %s", containerId));
      } else if (exception.getResponse().getStatus() == 204) {
View Full Code Here

    }

    private ZSession createSession(String expire) {
        WebResource wr = sessionsr.queryParam("op", "create")
            .queryParam("expire", expire);
        Builder b = wr.accept(MediaType.APPLICATION_JSON);

        ClientResponse cr = b.post(ClientResponse.class, null);
        assertEquals(ClientResponse.Status.CREATED, cr
                .getClientResponseStatus());

        return cr.getEntity(ZSession.class);
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.WebResource.Builder

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.