Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpPut.addHeader()


    public void testUpdateCustomerBodyAndHeaders() throws Exception {
        HttpPut put = new HttpPut("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/123");
        StringWriter sw = new StringWriter();
        jaxb.createMarshaller().marshal(new Customer(123, "Raul"), sw);
        put.setEntity(new StringEntity(sw.toString()));
        put.addHeader("Content-Type", "text/xml");
        put.addHeader("Accept", "text/xml");
        HttpResponse response = httpclient.execute(put);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
   
View Full Code Here


        HttpPut put = new HttpPut("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/123");
        StringWriter sw = new StringWriter();
        jaxb.createMarshaller().marshal(new Customer(123, "Raul"), sw);
        put.setEntity(new StringEntity(sw.toString()));
        put.addHeader("Content-Type", "text/xml");
        put.addHeader("Accept", "text/xml");
        HttpResponse response = httpclient.execute(put);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
   
    @Test
View Full Code Here

    public void testUpdateVipCustomer() throws Exception {
        HttpPut put = new HttpPut("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/vip/gold/123");
        StringWriter sw = new StringWriter();
        jaxb.createMarshaller().marshal(new Customer(123, "Raul2"), sw);
        put.setEntity(new StringEntity(sw.toString()));
        put.addHeader("Content-Type", "text/xml");
        put.addHeader("Accept", "text/xml");
        HttpResponse response = httpclient.execute(put);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
   
View Full Code Here

        HttpPut put = new HttpPut("http://localhost:" + PORT_PATH + "/rest/customerservice/customers/vip/gold/123");
        StringWriter sw = new StringWriter();
        jaxb.createMarshaller().marshal(new Customer(123, "Raul2"), sw);
        put.setEntity(new StringEntity(sw.toString()));
        put.addHeader("Content-Type", "text/xml");
        put.addHeader("Accept", "text/xml");
        HttpResponse response = httpclient.execute(put);
        assertEquals(200, response.getStatusLine().getStatusCode());
    }
   
    @Test
View Full Code Here

        StringWriter writer = new StringWriter();
        ObjectMapper mapper = new ObjectMapper();
        mapper.writeValue(writer, n);

        HttpPut putRequest = new HttpPut("http://localhost:8080/plato/rest/notification");
        putRequest.addHeader("content-type", "application/json");

        WebResource fileResource = endpoint.path("notification");
        ClientResponse response = fileResource.type(MediaType.APPLICATION_JSON).put(ClientResponse.class,
            writer.toString());
View Full Code Here

      if(userClass == true)
        path = Parse.getParseAPIUrlUsers();
      path += "/" + mData.get("objectId");

      HttpPut httpPut = new HttpPut(path);
      httpPut.addHeader("X-Parse-Application-Id", Parse.getApplicationId());
      httpPut.addHeader("X-Parse-REST-API-Key", Parse.getRestAPIKey());
      if(userClass == true)
        httpPut.addHeader("X-Parse-Session-Token", getSessionToken());
      httpPut.addHeader("Content-Type", "application/json");
View Full Code Here

        path = Parse.getParseAPIUrlUsers();
      path += "/" + mData.get("objectId");

      HttpPut httpPut = new HttpPut(path);
      httpPut.addHeader("X-Parse-Application-Id", Parse.getApplicationId());
      httpPut.addHeader("X-Parse-REST-API-Key", Parse.getRestAPIKey());
      if(userClass == true)
        httpPut.addHeader("X-Parse-Session-Token", getSessionToken());
      httpPut.addHeader("Content-Type", "application/json");

      httpPut.setEntity(new StringEntity(toJSONObjectUpdateData().toString()));
View Full Code Here

      HttpPut httpPut = new HttpPut(path);
      httpPut.addHeader("X-Parse-Application-Id", Parse.getApplicationId());
      httpPut.addHeader("X-Parse-REST-API-Key", Parse.getRestAPIKey());
      if(userClass == true)
        httpPut.addHeader("X-Parse-Session-Token", getSessionToken());
      httpPut.addHeader("Content-Type", "application/json");

      httpPut.setEntity(new StringEntity(toJSONObjectUpdateData().toString()));
      HttpResponse httpresponse = httpclient.execute(httpPut);
      ParseResponse response = new ParseResponse(httpresponse);
View Full Code Here

      HttpPut httpPut = new HttpPut(path);
      httpPut.addHeader("X-Parse-Application-Id", Parse.getApplicationId());
      httpPut.addHeader("X-Parse-REST-API-Key", Parse.getRestAPIKey());
      if(userClass == true)
        httpPut.addHeader("X-Parse-Session-Token", getSessionToken());
      httpPut.addHeader("Content-Type", "application/json");

      httpPut.setEntity(new StringEntity(toJSONObjectUpdateData().toString()));
      HttpResponse httpresponse = httpclient.execute(httpPut);
      ParseResponse response = new ParseResponse(httpresponse);
      if (!response.isFailed()) {
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.