use of org.apache.sling.servlets.get.impl.helpers.JsonRendererServlet in project sling by apache.
the class RedirectServlet method getJsonRendererServlet.
private Servlet getJsonRendererServlet() {
if (jsonRendererServlet == null) {
Servlet jrs = new JsonRendererServlet(jsonMaximumResults);
try {
jrs.init(getServletConfig());
} catch (Exception e) {
// don't care too much here
}
jsonRendererServlet = jrs;
}
return jsonRendererServlet;
}
use of org.apache.sling.servlets.get.impl.helpers.JsonRendererServlet in project sling by apache.
the class JsonRendererServletTest method getJSON.
private String getJSON(String path, String depth) throws Throwable {
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(path, depth, ".json", null, null);
request.setMethod("GET");
request.setResourceResolver(resolver);
request.setResource(resolver.getResource(path));
MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
JsonRendererServlet servlet = new JsonRendererServlet(1000);
PrivateAccessor.invoke(servlet, "doGet", new Class[] { SlingHttpServletRequest.class, SlingHttpServletResponse.class }, new Object[] { request, response });
return response.getOutput().toString();
}
Aggregations