Package org.restlet.ext.json

Examples of org.restlet.ext.json.JsonRepresentation


    if (result == null) {
      this.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
      result = Status.CLIENT_ERROR_NOT_FOUND.getDescription();
    }
    JsonRepresentation jsonRepresentation = new JsonRepresentation(result);
   
    // Buffering avoids a Chunked response, Chunked caused last chunk timeouts.
    BufferingRepresentation bufferingRep = new BufferingRepresentation(jsonRepresentation);
   
    return bufferingRep;
View Full Code Here


     *
     * @param layer
     * @return
     */
    public JsonRepresentation getJsonRepresentation(TileLayer layer) {
        JsonRepresentation rep = null;
        try {
            XStream xs = xmlConfig.getConfiguredXStreamWithContext(new XStream(
                    new JsonHierarchicalStreamDriver()), Context.REST);
            JSONObject obj = new JSONObject(xs.toXML(layer));
            rep = new JsonRepresentation(obj);
        } catch (JSONException jse) {
            jse.printStackTrace();
        }
        return rep;
    }
View Full Code Here

                }
                list = seeder.getStatusList(layerName);
            }
            obj = new JSONObject(xs.toXML(list));

            rep = new JsonRepresentation(obj);
        } catch (JSONException jse) {
            jse.printStackTrace();
        }

        resp.setEntity(rep);
View Full Code Here

    }

    @Override
    public Representation getPreferredRepresentation() {
        DiskQuotaConfig config = monitor.getConfig();
        JsonRepresentation jsonRepresentation;
        try {
            jsonRepresentation = getJsonRepresentation(config);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        }
        return jsonRepresentation;
    }

    private JsonRepresentation getJsonRepresentation(DiskQuotaConfig config) throws JSONException {
        JsonRepresentation rep = null;
        XStream xs = ConfigLoader.getConfiguredXStream(new XStream(
                new JsonHierarchicalStreamDriver()));
        JSONObject obj = new JSONObject(xs.toXML(config));
        rep = new JsonRepresentation(obj);
        return rep;
    }
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.