Class ResourceTraversor
- java.lang.Object
-
- org.apache.sling.servlets.get.impl.util.ResourceTraversor
-
public class ResourceTraversor extends Object
-
-
Constructor Summary
Constructors Constructor Description ResourceTraversor(int levels, long maxResources, org.apache.sling.api.resource.Resource resource, boolean ecmaSupport)
Create a ResourceTraversor, optionally limiting recursion and total number of resources
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
collectResources()
Recursive descent from startResource, collecting JSONObjects into startObject.jakarta.json.JsonObject
getJSONObject()
-
-
-
Constructor Detail
-
ResourceTraversor
public ResourceTraversor(int levels, long maxResources, org.apache.sling.api.resource.Resource resource, boolean ecmaSupport)
Create a ResourceTraversor, optionally limiting recursion and total number of resources- Parameters:
levels
- recursion levels limit, -1 means no limitmaxResources
- maximum number of resources to collect, ignored if levels == 1resource
- the root resource to traverse
-
-
Method Detail
-
collectResources
public int collectResources() throws org.apache.sling.api.request.RecursionTooDeepException
Recursive descent from startResource, collecting JSONObjects into startObject. Throws a RecursionTooDeepException if the maximum number of nodes is reached on a "deep" traversal (where "deep" === level greater than 1).- Returns:
- -1 if everything went fine, a positive value when the resource has more child nodes then allowed.
- Throws:
org.apache.sling.api.request.RecursionTooDeepException
-
getJSONObject
public jakarta.json.JsonObject getJSONObject()
-
-