Package org.restlet.ext.json

Examples of org.restlet.ext.json.JsonRepresentation


//                + "}";


        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


        String pluginData = plugin.formatBaseData() + ",";
        pluginData += plugin.formatFieldOS() + ",";
        pluginData += plugin.formatFieldFile();
        pluginData += "}"
                + "}";
        Representation rep = pluginResource.put(new JsonRepresentation(pluginData));
        Response resp2 = pluginResource.getResponse();
        if (resp2.getStatus().isSuccess()) {
            try {
                System.out.println(resp2.getEntity().getText());
            } catch (IOException e) {
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

    } else if (path == "") {
      json = get(0);
    } else if (CoffeeFilter.unixtimeWithCallback(path)) {
      json = get(5);
    }
    JsonRepresentation jsr = new JsonRepresentation(json);
    if (verbose) {
      jsr.setIndenting(true);
    }
    jsr.setMediaType(MediaType.APPLICATION_JSON);
    return jsr;
  }
View Full Code Here

        if (resp.getStatus().isError()) {
            throw resp.getStatus().getThrowable();
        }

        try {
            JsonRepresentation repr = new JsonRepresentation(resp.getEntity());
            JSONObject o = repr.toJsonObject();
            System.out.println("Server version:   " + o.optString("server_version"));
            System.out.println("ReST API version: " + o.optInt("api_version"));
        }
        catch (JSONException err) {
            throw new Exception ("Cannot Decode JSON", err);
View Full Code Here

                .put("group_ids", groups)
                .put("account_ids", accounts)
                .put("annotations", annos)
            ;
               
            JsonRepresentation signal_repr = new JsonRepresentation(signal);
            Request r = newJsonRequest(Method.POST, "/data/signals", signal_repr);
            Response resp = client.handle(r);

            if (resp.getStatus().isError()) {
                throw resp.getStatus().getThrowable();
View Full Code Here

   */
  @Get("json")
  public Representation getJsonServicesList() {
    JsonResourcePublisher publisher = new JsonResourcePublisher();
    publishAllServcies(publisher);
    JsonRepresentation representation = new JsonRepresentation(publisher.toJSON());
    return representation;
  }
View Full Code Here

        array.put(-10);
        array.put(-40);
        array.put(30);
        array.put(80);

        return new JsonRepresentation(array);
    }
View Full Code Here

   */
  @Get("json")
  public Representation getJsonServicesList() {
    JsonResourcePublisher publisher = new JsonResourcePublisher();
    publishAllServcies(publisher);
    JsonRepresentation representation = new JsonRepresentation(publisher.toJSON());
    return representation;
  }
View Full Code Here

    public void acceptRepresentation(Representation entity) throws ResourceException {

        String _strJson = "{\"type\":\"Feature\",\"id\":\"tiger_roads.1\",\"geometry\":{\"type\":\"MultiLineString\",\"coordinates\":[[[-73.999559,40.73158],[-73.999079,40.732188]]]},\"geometry_name\":\"the_geom\",\"properties\":{\"CFCC\":\"A41\",\"NAME\":\"Washington Sq W\",\"bbox\":[-73.999559,40.73158,-73.999079,40.732188]}}";


        Representation rep = new JsonRepresentation(_strJson);
        getResponse().setEntity(rep);
        getResponse().setStatus(Status.SUCCESS_OK);

        return;
    }
View Full Code Here

TOP

Related Classes of org.restlet.ext.json.JsonRepresentation

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.