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

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


                writer.array();
                while (allowedLevel >= 0) {
                    writer.value(r.getResourceMetadata().getResolutionPath() + "." + tidyUrl + allowedLevel + ".json");
                    allowedLevel--;
                }
                writer.endArray();
            }
        } catch (JSONException je) {
            reportException(je);
        }
    }
View Full Code Here


                w.endObject();


                count--;
            }
            w.endArray();
        } catch (JSONException je) {
            throw wrapException(je);
        }
    }
View Full Code Here

            }

            jw.endObject();
        }

        jw.endArray();
        return sw.toString();
    }

    private String determineMode(List<String> extensions) {
        if(extensions.contains("groovy")){
View Full Code Here

                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");
            }
           
            // Output the layers array in JSON
View Full Code Here

                out.write("var layers = ");
                w.array();
                for(String layer : layers) {
                    w.value(layer);
                };
                w.endArray();
                out.write(";");
            }
           
        } catch(JSONException je) {
            throw new ServletException("JSONException in doGet", je);
View Full Code Here

                        writer.object();
                        writer.key("text").value(item.getTitle());
                        writer.key("value").value(item.getValue());
                        writer.endObject();
                    }
                    writer.endArray();
                    writer.endObject();
                    return (AdapterType) new ByteArrayInputStream(buffer.toString().getBytes("UTF-8"));
                } catch (Exception e) {
                    log.warn("Unable to generate JSON object.", e);
                    return null;
View Full Code Here

                        jsonWriter.value(path);
                    }
                }

            }
            jsonWriter.endArray();
        } catch (JSONException e) {
            throw new ServletException("Unable to generate JSON result", e);
        }
    }
View Full Code Here

                }

                w.endObject();
                count--;
            }
            w.endArray();
        } catch (JSONException je) {
            throw wrapException(je);
        }
    }
View Full Code Here

        final JSONWriter w = new JSONWriter(out);
        w.array();
        while (it.hasNext()) {
            dumpSingleNode(it.nextNode(), w, 1, 0);
        }
        w.endArray();
    }

    /** Dump given node in JSON, optionally recursing into its child nodes */
    public void dump(Node node, Writer w, int maxRecursionLevels)
            throws RepositoryException, JSONException {
View Full Code Here

                } catch (IllegalArgumentException e) {
                    // no matching type. no need to log, just return empty array.
                }
            }
            writer.endArray();
        } catch (JSONException e) {
            response.reset();
            throw new ServletException("Unable to produce JSON", e);
        }
    }
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.