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

Examples of com.sun.jersey.api.client.WebResource.Builder.post()


        ClientResponse cr;
        if (data == null) {
            cr = builder.post(ClientResponse.class);
        } else {
            cr = builder.post(ClientResponse.class, data);
        }
        assertEquals(expectedStatus, cr.getResponseStatus());

        if (expectedPath == null) {
            return;
View Full Code Here


        if ( data != null ) {
            Object payload = data instanceof InputStream ? data : JsonHelper.createJsonFrom(data);
            builder = builder.entity( payload , APPLICATION_JSON_TYPE );
        }
        if (log.isDebugEnabled()) log.debug("POST "+path+" "+data);
        return RequestResult.extractFrom(builder.post(ClientResponse.class));
    }

    @Override
    public RequestResult put( String path, Object data ) {
        Builder builder = builder( path );
View Full Code Here

    if("GET".equals(method)) {
      response = (ClientResponse) builder.get(ClientResponse.class);
    }
    else if ("POST".equals(method)) {
      if(body == null)
        response = builder.post(ClientResponse.class, null);
      else if(body instanceof FormDataMultiPart) {
        response = builder.type(contentType).post(ClientResponse.class, body);
      }
      else
        response = builder.type(contentType).post(ClientResponse.class, serialize(body));
View Full Code Here

    if("GET".equals(method)) {
      response = (ClientResponse) builder.get(ClientResponse.class);
    }
    else if ("POST".equals(method)) {
      if(body == null)
        response = builder.post(ClientResponse.class, serialize(body));
      else
        response = builder.type(contentType).post(ClientResponse.class, serialize(body));
    }
    else if ("PUT".equals(method)) {
      if(body == null)
View Full Code Here

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

        QueueMessage queueMessage = new QueueMessage();
        queueMessage.setMessageText(messageText);

        builder.post(queueMessage);
    }

    @Override
    public UpdateMessageResult updateMessage(String queue, String messageId,
            String popReceipt, String messageText,
View Full Code Here

                .getProperties().entrySet()) {
            request.header(entry.getKey(),
                    customPropertiesMapper.toString(entry.getValue()));
        }

        request.post(message.getBody());
    }

    @Override
    public void sendQueueMessage(String path, BrokeredMessage message)
            throws ServiceException {
View Full Code Here

    Builder builder = webResource.accept(MediaType.APPLICATION_JSON);
    ClientResponse response = null;
    if (Method.GET.equals(method)) {
      response = builder.get(ClientResponse.class);
    } else if (Method.POST.equals(method)) {
      response = builder.post(ClientResponse.class);
    }
   
//    System.out.println("DEBUG data=" + data);
//    System.out.println("DEBUG response=" + response.toString());
//    System.out.println("DEBUG response headers=" + response.getHeaders().toString());
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.