Package org.restlet.resource

Examples of org.restlet.resource.ClientResource.post()


//                + "}"
//                + "}";

        cr2.setMethod(Method.POST);

        Representation rep2 = cr2.post(new JsonRepresentation(pluginData));
        Response resp = cr2.getResponse();
        String jsonResponse = "";
        String nid = "";
        if (resp.getStatus().isSuccess()) {
            try {
View Full Code Here


                + "\"filesize\":\"" + size + "\","
                + "\"file\":\"" + base64String + "\""
                + "}";
        testFileResource.setMethod(Method.POST);

        Representation rep2 = testFileResource.post(new JsonRepresentation(fileData));
        Response resp = testFileResource.getResponse();
        // {"fid":"320","uri":"http://freedomotic.com/rest/file/320"}    
        String jsonResponse = "";
        String fid = "";
        if (resp.getStatus().isSuccess()) {
View Full Code Here

        try {
            ClientResource cr = new ClientResource(DRUPALPATH + "/rest/user/login");
            String jsonData = "{\"username\":\"" + username + "\",\"password\":\"" + password + "\"}";
            JsonRepresentation jsonRep = new JsonRepresentation(jsonData);
            cr.setMethod(Method.POST);
            Representation rep = cr.post(jsonRep);
            Response resp = cr.getResponse();
            String jsonResponse = "";
            if (resp.getStatus().isSuccess()) {
                try {
                    jsonResponse = resp.getEntity().getText();
View Full Code Here

//                + "}";


        cr2.setMethod(Method.POST);

        Representation rep2 = cr2.post(new JsonRepresentation(pluginData));
        Response resp2 = cr2.getResponse();
        if (resp2.getStatus().isSuccess()) {
            try {
                System.out.println(resp2.getEntity().getText());
                return (resp2.getEntity().getText());
View Full Code Here

                + "\"filesize\":\"" + size + "\","
                + "\"file\":\"" + base64String + "\""
                + "}";
        testFileResource.setMethod(Method.POST);

        Representation rep2 = testFileResource.post(new JsonRepresentation(fileData));
        Response resp2 = testFileResource.getResponse();
        if (resp2.getStatus().isSuccess()) {
            try {
                return resp2.getEntity().getText();
            } catch (IOException e) {
View Full Code Here

    ClientResource cr = new ClientResource(
        "http://localhost:8080/resources/utilisateurs");
    String test = createJSONChasse();
    System.out.println(test);
    cr.post(test);

  }

  public static String createJSONChasse() {
View Full Code Here

        if (dryRun) {
            addHeaderAttribute(clientResource, DRY_RUN_PARAM, TRUE);
        }
        writeRequestInfoToLog(clientResource);
        try {
            clientResource.post(user);
        } catch (ResourceException e) {
            logger.debug("Poulpe registration request error: {}", e.getStatus());
        }
        return clientResource;
    }
View Full Code Here

   
    List<ProcessInstance> instanceList = runtimeService.createProcessInstanceQuery().list();
    assertEquals(1, instanceList.size());
   
    ClientResource client = getAuthenticatedClient("process-instance/" + instance.getProcessInstanceId() + "/event/stopSignal");
    Representation response = client.post(null);
    JsonNode responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
    assertTrue(responseNode.get("success").getBooleanValue());
   
    instanceList = runtimeService.createProcessInstanceQuery().list();
View Full Code Here

    ObjectMapper objectMapper = new ObjectMapper();
    ObjectNode objectNode = objectMapper.createObjectNode();
    objectNode.put("test", "hello");
    objectNode.put("test2", 1);
   
    Representation response = client.post(objectNode);
    JsonNode responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
    assertTrue(responseNode.get("success").getBooleanValue());
   
    Task task = taskService.createTaskQuery().taskAssignee("kermit").singleResult();
View Full Code Here

  @Deployment
  public void testStartInstance() throws Exception {
    ClientResource client = getAuthenticatedClient("process-instance");
    ObjectNode requestNode = objectMapper.createObjectNode();
    requestNode.put("processDefinitionKey", "simpleProcess");
    Representation response = client.post(requestNode);
    JsonNode responseNode = objectMapper.readTree(response.getStream());
    assertNotNull(responseNode);
   
    String processInstanceId = responseNode.get("processInstanceId").asText();
    assertNotNull(processInstanceId);
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.