Package org.apache.sling.commons.json.io

Examples of org.apache.sling.commons.json.io.JSONWriter.endObject()


            w.object();
            for (Map.Entry<String, String> e : data.entrySet()) {
                w.key(e.getKey());
                w.value(e.getValue());
            }
            w.endObject();

        } catch (JSONException jse) {
            out.write(jse.toString());

        } finally {
View Full Code Here


            w.key("tasks").array();
            for (RcpTask task: taskMgr.getTasks().values()) {
                task.write(w);
            }
            w.endArray();
            w.endObject();
        } catch (JSONException e) {
            throw new IOException(e.toString());
        }

    }
View Full Code Here

            w.object();
            w.key("status").value("ok");
            if (task != null) {
                w.key("id").value(task.getId());
            }
            w.endObject();

        } catch (Exception e) {
            log.error("Error while executing command {}", cmd, e);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
View Full Code Here

            w.setTidy(true);
            try {
                w.object();
                w.key("status").value("error");
                w.key("message").value("Error while executing '" + cmd + "': " + e.getMessage());
                w.endObject();
            } catch (JSONException e1) {
                // ignore
            }
        }
    }
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.