Class JsonRenderer
java.lang.Object
org.apache.sling.servlets.get.impl.helpers.JsonRenderer
- All Implemented Interfaces:
- Renderer
The 
JsonRendererServlet renders the current resource in JSON
 on behalf of the DefaultGetServlet.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringSelector that causes hierarchy to be rendered as arrays instead of child objects - useful to preserve the order of those child objectsstatic final intHow much to indent in tidy modestatic final StringRecursion level selector that means "all levels"static final StringSelector that means "pretty-print the output
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected intGet recursion level from selectors. as per SLING-167: the last selector, if present, gives the recursion level.protected booleanhasSelector(SlingHttpServletRequest req, String selectorToCheck) Checks if the provided request contains a certain selector.protected booleanTrue if our request wants the "tidy" pretty-printed formatvoid
- 
Field Details- 
INFINITYRecursion level selector that means "all levels"- See Also:
 
- 
TIDYSelector that means "pretty-print the output- See Also:
 
- 
HARRAYSelector that causes hierarchy to be rendered as arrays instead of child objects - useful to preserve the order of those child objects- See Also:
 
- 
INDENT_SPACESpublic static final int INDENT_SPACESHow much to indent in tidy mode- See Also:
 
 
- 
- 
Constructor Details- 
JsonRendererpublic JsonRenderer(long maximumResults, boolean ecmaSupport) 
 
- 
- 
Method Details- 
render- Specified by:
- renderin interface- Renderer
- Throws:
- IOException
 
- 
getMaxRecursionLevelGet recursion level from selectors. as per SLING-167: the last selector, if present, gives the recursion level.- Parameters:
- req- the request
- Returns:
- the recursion level
- Throws:
- IllegalArgumentException- if the detected selector is not a number
 
- 
hasSelectorChecks if the provided request contains a certain selector.- Parameters:
- req- the request
- selectorToCheck- the selector
- Returns:
- trueif the selector is present,- falseotherwise
 
- 
isTidyTrue if our request wants the "tidy" pretty-printed format- Parameters:
- req- the request
- Returns:
- trueif the request contains the- TIDYselector,- falseotherwise
 
 
-