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

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


                // We are not allowed to do the dump.
                // Send a 300
                String tidyUrl = (tidy) ? "tidy." : "";
                resp.setStatus(HttpServletResponse.SC_MULTIPLE_CHOICES);
                JSONWriter writer = new JSONWriter(resp.getWriter());
                writer.array();
                while (allowedLevel >= 0) {
                    writer.value(r.getResourceMetadata().getResolutionPath() + "." + tidyUrl + allowedLevel + ".json");
                    allowedLevel--;
                }
                writer.endArray();
View Full Code Here


            resp.setCharacterEncoding("UTF-8");

            final JSONWriter w = new JSONWriter(resp.getWriter());
            w.setTidy(isTidy(req));

            w.array();

            long count = -1;
            if (req.getParameter(ROWS) != null) {
                count = Long.parseLong(req.getParameter(ROWS));
            }
View Full Code Here

    private String getScriptConfig0() throws JSONException {
        StringWriter sw = new StringWriter();
        JSONWriter jw = new JSONWriter(sw);
        jw.setTidy(true);
        jw.array();

        for(ScriptEngineFactory sef : scriptEngineManager.getEngineFactories()){
            jw.object();
            if(sef.getExtensions().isEmpty()){
                continue;
View Full Code Here

            // from those that have the stats data resource type
            {
                final JSONWriter w = new JSONWriter(response.getWriter());
                w.setTidy(true);
                out.write("var statsData = ");
                w.array();
                dumpStatsData(request.getResource(), w, layers);
                w.endArray();
                out.flush();
                out.write(";\n");
            }
View Full Code Here

            // Output the layers array in JSON
            {
                final JSONWriter w = new JSONWriter(response.getWriter());
                w.setTidy(true);
                out.write("var layers = ");
                w.array();
                for(String layer : layers) {
                    w.value(layer);
                };
                w.endArray();
                out.write(";");
View Full Code Here

                StringWriter buffer = new StringWriter();
                try {
                    JSONWriter writer = new JSONWriter(buffer);
                    writer.object();
                    writer.key("options");
                    writer.array();
                    for (Item item : list.getItems()) {
                        writer.object();
                        writer.key("text").value(item.getTitle());
                        writer.key("value").value(item.getValue());
                        writer.endObject();
View Full Code Here

            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");

            JSONWriter jsonWriter = new JSONWriter(response.getWriter());
            jsonWriter.array();

            if (StringUtils.isNotBlank(vanityPath)) {
                String xpath = "//element(*)[" + NameConstants.PN_SLING_VANITY_PATH + "='" + vanityPath + "']";
                @SuppressWarnings("deprecation")
                Iterator<Resource> resources = resolver.findResources(xpath, Query.XPATH);
View Full Code Here

            resp.setContentType(JsonRendererServlet.responseContentType);
            resp.setCharacterEncoding("UTF-8");

            final JSONWriter w = new JSONWriter(resp.getWriter());
            w.array();

            long count = -1;
            if (req.getParameter(ROWS) != null) {
                count = Long.parseLong(req.getParameter(ROWS));
            }
View Full Code Here

     * @throws JSONException
     */
    public void dump(NodeIterator it, Writer out) throws RepositoryException,
            JSONException {
        final JSONWriter w = new JSONWriter(out);
        w.array();
        while (it.hasNext()) {
            dumpSingleNode(it.nextNode(), w, 1, 0);
        }
        w.endArray();
    }
View Full Code Here

    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("application/json");
        final JSONWriter writer = new JSONWriter(response.getWriter());
        try {
            writer.array();
            String type = request.getRequestPathInfo().getSelectorString();
            if (type != null) {
                try {
                    Set<String> categories = new TreeSet<String>();
                    LibraryType libraryType = LibraryType.valueOf(type.toUpperCase());
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.