Package org.restlet.ext.json

Examples of org.restlet.ext.json.JsonRepresentation


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


            //GR: I bet synchronizing on list is unnecessary here...
            synchronized (list) {
                obj = new JSONObject(xs.toXML(list));
            }

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

        resp.setEntity(rep);
View Full Code Here

     */
    public static String login(String username, String password) {

        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();
        if (resp.getStatus().isSuccess()) {
            try {
View Full Code Here

    public static String postTaxonomyGetTree(String vocabularyNumber) {
        ClientResource cr2 = new ClientResource(DRUPALPATH + "/rest/taxonomy_vocabulary/getTree");
        String text = "{\"vid\":\"" + vocabularyNumber + "\"}";

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

        try {
            ClientResource cr2 = new ClientResource(DRUPALPATH + "/rest/taxonomy_term/selectNodes?page=" + page);
            //String text = "{\"tids\":\""+taxonomyTreeNumber+"\",\"pager\":false}";       
            String text = "{\"tids\":\"" + taxonomyTreeNumber + "\"}";
            cr2.setMethod(Method.POST);
            JsonRepresentation jsonRepresentation = new JsonRepresentation(text);
            if (jsonRepresentation != null) {
                Representation rep2 = cr2.post(jsonRepresentation);
                Response resp = cr2.getResponse();
                String jsonResponse = "";
                String nid = "";
View Full Code Here

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

        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

        //pluginData += "\"field_plugin_category\":[{\"value\":\"151\"},{\"value\":null},{\"value\":null},{\"value\":null},{\"value\":null}]" +",";       
        //pluginData += plugin.formatFieldCategory();
        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

                + plugin.formatFieldPluginCategory() + ","
                + plugin.formatFieldOS() + ","
                + plugin.formatFieldFile()
                + "}";
        System.out.println("PluginData " + 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 resp = testFileResource.getResponse();
        // {"fid":"320","uri":"http://freedomotic.com/rest/file/320"}    
        String jsonResponse = "";
        String fid = "";
        if (resp.getStatus().isSuccess()) {
View Full Code Here

    public static CookieSetting login(String username, String password) {
        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()) {
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.