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

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


        webResource = addOptionalQueryParam(webResource, "visibilitytimeout",
                options.getVisibilityTimeoutInSeconds());
        webResource = addOptionalQueryParam(webResource, "numofmessages",
                options.getNumberOfMessages());

        Builder builder = webResource.header("x-ms-version", API_VERSION);

        return builder.get(ListMessagesResult.class);
    }
View Full Code Here


        WebResource webResource = getResource(options).path(queue)
                .path("messages").queryParam("peekonly", "true");
        webResource = addOptionalQueryParam(webResource, "numofmessages",
                options.getNumberOfMessages());

        Builder builder = webResource.header("x-ms-version", API_VERSION);

        return builder.get(PeekMessagesResult.class);
    }
View Full Code Here

        WebResource webResource = getResource(options).path(queue)
                .path("messages").path(messageId);
        webResource = addOptionalQueryParam(webResource, "popreceipt",
                popReceipt);

        Builder builder = webResource.header("x-ms-version", API_VERSION);

        builder.delete();
    }
View Full Code Here

        }

        WebResource webResource = getResource(options).path(queue).path(
                "messages");

        Builder builder = webResource.header("x-ms-version", API_VERSION);

        builder.delete();
    }
View Full Code Here

     */
    @Override
    public <T> T action(EntityTypeActionOperation<T> entityTypeActionOperation)
            throws ServiceException {
        entityTypeActionOperation.setProxyData(createProxyData());
        Builder webResource = getResource(entityTypeActionOperation.getUri())
                .queryParams(entityTypeActionOperation.getQueryParameters())
                .accept(entityTypeActionOperation.getAcceptType())
                .accept(MediaType.APPLICATION_XML_TYPE)
                .entity(entityTypeActionOperation.getRequestContents(),
                        MediaType.APPLICATION_XML_TYPE)
                .type(MediaType.APPLICATION_XML);

        ClientResponse clientResponse = webResource.method(
                entityTypeActionOperation.getVerb(), ClientResponse.class);
        return entityTypeActionOperation.processTypeResponse(clientResponse);
    }
View Full Code Here

     * @return the action client response
     */
    private ClientResponse getActionClientResponse(
            EntityActionOperation entityActionOperation) {
        entityActionOperation.setProxyData(createProxyData());
        Builder webResource = getResource(entityActionOperation.getUri())
                .queryParams(entityActionOperation.getQueryParameters())
                .accept(entityActionOperation.getAcceptType())
                .accept(MediaType.APPLICATION_XML_TYPE)
                .type(MediaType.APPLICATION_XML_TYPE);
        if (entityActionOperation.getRequestContents() != null) {
            webResource = webResource.entity(
                    entityActionOperation.getRequestContents(),
                    entityActionOperation.getContentType());
        } else {
            webResource = webResource.header("Content-Length", "0");
        }
        return webResource.method(entityActionOperation.getVerb(),
                ClientResponse.class);
    }
View Full Code Here

    public void addOptionalSourceAccessConditionHeaderSuccess()
            throws Exception {
        // Arrange
        Client client = Client.create();
        WebResource webResource = client.resource("http://www.microsoft.com");
        Builder builder = webResource.header("ms-version", "1.0");
        AccessConditionHeader accessCondition = AccessConditionHeader
                .ifMatch("thisIsAETag");

        // Act
        Builder resultBuilder = PipelineHelpers
                .addOptionalSourceAccessConditionHeader(builder,
                        accessCondition);

        // Assert
        assertNotNull(resultBuilder);
View Full Code Here

        return resource;
    }

    @Override
    public void sendMessage(String path, BrokeredMessage message) {
        Builder request = getResource().path(path).path("messages")
                .getRequestBuilder();

        if (message.getContentType() != null) {
            request = request.type(message.getContentType());
        }

        if (message.getBrokerProperties() != null) {
            request = request.header("BrokerProperties",
                    mapper.toString(message.getBrokerProperties()));
        }

        for (java.util.Map.Entry<String, Object> entry : message
                .getProperties().entrySet()) {
            request.header(entry.getKey(),
                    customPropertiesMapper.toString(entry.getValue()));
        }

        request.post(message.getBody());
    }
View Full Code Here

    }

    @Override
    public CreateQueueResult createQueue(QueueInfo queueInfo)
            throws ServiceException {
        Builder webResourceBuilder = getResource().path(queueInfo.getPath())
                .type("application/atom+xml;type=entry;charset=utf-8");
        if ((queueInfo.getForwardTo() != null)
                && !queueInfo.getForwardTo().isEmpty()) {
            webResourceBuilder.header("ServiceBusSupplementaryAuthorization",
                    queueInfo.getForwardTo());
        }
        return new CreateQueueResult(webResourceBuilder.put(QueueInfo.class,
                queueInfo));
    }
View Full Code Here

        return result;
    }

    @Override
    public QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException {
        Builder webResourceBuilder = getResource().path(queueInfo.getPath())
                .type("application/atom+xml;type=entry;charset=utf-8")
                .header("If-Match", "*");
        if ((queueInfo.getForwardTo() != null)
                && !queueInfo.getForwardTo().isEmpty()) {
            webResourceBuilder.header("ServiceBusSupplementaryAuthorization",
                    queueInfo.getForwardTo());
        }
        return webResourceBuilder.put(QueueInfo.class, queueInfo);
    }
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.