Class JsonPipe
- java.lang.Object
-
- org.apache.sling.pipes.BasePipe
-
- org.apache.sling.pipes.AbstractInputStreamPipe
-
- org.apache.sling.pipes.internal.inputstream.JsonPipe
-
- All Implemented Interfaces:
Pipe
public class JsonPipe extends AbstractInputStreamPipe
Pipe outputting binding related to a json stream: either an object
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringARRAY_STARTprotected static StringINDEX_SUFFIXstatic StringJSON_KEYprotected static PatternJSONPATH_FIRSTTOKENprotected static StringJSONPATH_ROOTprotected static StringOBJ_STARTprotected static StringPN_RAWproperty specifying wether we should bind the computed json as a whole, or loop over it (not set or raw=false)protected static StringPN_VALUEPATHproperty specifying the json path where to fetched the used valuestatic StringRESOURCE_TYPE-
Fields inherited from class org.apache.sling.pipes.AbstractInputStreamPipe
binding, BINDING_IS, REMOTE_START, VALID_PATH
-
Fields inherited from class org.apache.sling.pipes.BasePipe
afterHook, beforeHook, bindingProviders, bindings, distributionAgent, DRYRUN_EXPR, DRYRUN_KEY, EMPTY_ITERATOR, IGNORED_NODES, IGNORED_PROPERTIES, parent, plumber, PN_AFTERHOOK, PN_BEFOREHOOK, PN_STATUS, PN_STATUS_MODIFIED, properties, READ_ONLY, resolver, resource, RT_PREFIX, SLASH, STATUS_FINISHED, STATUS_STARTED
-
-
Constructor Summary
Constructors Constructor Description JsonPipe(Plumber plumber, org.apache.sling.api.resource.Resource resource, PipeBindings upperBindings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<org.apache.sling.api.resource.Resource>getOutput(InputStream is)in case there is no successful retrieval of some JSON data, we cut the pipe hereprotected javax.json.JsonStructuregetValue(javax.json.JsonStructure json, String valuePath)Returns fetched json value from value path-
Methods inherited from class org.apache.sling.pipes.AbstractInputStreamPipe
after, computeOutput, getOutputBinding
-
Methods inherited from class org.apache.sling.pipes.BasePipe
before, getBindings, getComputedPath, getConfiguration, getDistributionAgent, getExpr, getInput, getName, getOutput, getParent, getPath, getPreviousPipe, getPreviousResource, getRawExpression, getRawPath, getResource, isDryRun, isRootPath, modifiesContent, provideAdditionalBindings, setParent, toString
-
-
-
-
Field Detail
-
JSON_KEY
public static final String JSON_KEY
- See Also:
- Constant Field Values
-
RESOURCE_TYPE
public static final String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
PN_VALUEPATH
protected static final String PN_VALUEPATH
property specifying the json path where to fetched the used value- See Also:
- Constant Field Values
-
PN_RAW
protected static final String PN_RAW
property specifying wether we should bind the computed json as a whole, or loop over it (not set or raw=false)- See Also:
- Constant Field Values
-
JSONPATH_ROOT
protected static final String JSONPATH_ROOT
- See Also:
- Constant Field Values
-
ARRAY_START
protected static final String ARRAY_START
- See Also:
- Constant Field Values
-
OBJ_START
protected static final String OBJ_START
- See Also:
- Constant Field Values
-
INDEX_SUFFIX
protected static final String INDEX_SUFFIX
- See Also:
- Constant Field Values
-
JSONPATH_FIRSTTOKEN
protected static final Pattern JSONPATH_FIRSTTOKEN
-
-
Constructor Detail
-
JsonPipe
public JsonPipe(Plumber plumber, org.apache.sling.api.resource.Resource resource, PipeBindings upperBindings)
-
-
Method Detail
-
getOutput
public Iterator<org.apache.sling.api.resource.Resource> getOutput(InputStream is)
in case there is no successful retrieval of some JSON data, we cut the pipe here- Specified by:
getOutputin classAbstractInputStreamPipe- Returns:
- input resource of the pipe, can be reouputed N times in case output json binding is an array of N element (output binding would be here each time the Nth element of the array)
-
getValue
protected javax.json.JsonStructure getValue(javax.json.JsonStructure json, String valuePath)Returns fetched json value from value path- Parameters:
json- json structure from which to startvaluePath- path to follow- Returns:
- value fetched after following the path
-
-