Package org.apache.sling.pipes
Class OutputWriter
- java.lang.Object
-
- org.apache.sling.pipes.OutputWriter
-
public abstract class OutputWriter extends Object
defines how pipe's output get written to a servlet response or output stream
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanautoCloseprotected Map<String,Object>customOutputsprotected List<String>errorsstatic StringKEY_ERRORSstatic StringKEY_ITEMSstatic StringKEY_NB_ERRORSstatic StringKEY_SIZEprotected longmaxstatic intNB_MAXprotected longnbErrorsprotected static StringNEW_LINEstatic StringPARAM_SIZEstatic StringPARAM_WRITERstatic StringPATH_KEYprotected Pipepipeprotected longsizeprotected Writerwriter
-
Constructor Summary
Constructors Constructor Description OutputWriter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanautoClose()protected StringcomputeValue(String key)voiddisableAutoClose()abstract voidends()writes the end of the outputvoiderror(String path)Write a given errorMap<String,Object>getCustomOutputs()abstract booleanhandleRequest(org.apache.sling.api.SlingHttpServletRequest request)voidinit(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Init the writer, writes beginning of the outputprotected abstract voidinitResponse(org.apache.sling.api.SlingHttpServletResponse response)Specifically init the responsevoidsetCustomOutputs(Map<String,Object> customOutputs)voidsetMax(int max)Setter for max (will put to max if value is negative)voidsetPipe(Pipe pipe)SettervoidsetWriter(Writer writer)x Set the writerabstract voidstarts()Init the writer, writes beginning of the outputStringtoString()voidwrite(org.apache.sling.api.resource.Resource resource)Write a given resourceprotected abstract voidwriteItem(org.apache.sling.api.resource.Resource resource)Write a given resource
-
-
-
Field Detail
-
KEY_SIZE
public static final String KEY_SIZE
- See Also:
- Constant Field Values
-
KEY_ITEMS
public static final String KEY_ITEMS
- See Also:
- Constant Field Values
-
KEY_ERRORS
public static final String KEY_ERRORS
- See Also:
- Constant Field Values
-
KEY_NB_ERRORS
public static final String KEY_NB_ERRORS
- See Also:
- Constant Field Values
-
NEW_LINE
protected static final String NEW_LINE
- See Also:
- Constant Field Values
-
PARAM_SIZE
public static final String PARAM_SIZE
- See Also:
- Constant Field Values
-
NB_MAX
public static final int NB_MAX
- See Also:
- Constant Field Values
-
autoClose
protected boolean autoClose
-
size
protected long size
-
nbErrors
protected long nbErrors
-
max
protected long max
-
pipe
protected Pipe pipe
-
writer
protected Writer writer
-
PATH_KEY
public static final String PATH_KEY
- See Also:
- Constant Field Values
-
PARAM_WRITER
public static final String PARAM_WRITER
- See Also:
- Constant Field Values
-
-
Method Detail
-
handleRequest
public abstract boolean handleRequest(org.apache.sling.api.SlingHttpServletRequest request)
- Parameters:
request- current request- Returns:
- true if this writer handles that request
-
init
public void init(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOExceptionInit the writer, writes beginning of the output- Parameters:
request- request from which writer will outputresponse- response on which writer will output- Throws:
IOException- error handling streams
-
setCustomOutputs
public void setCustomOutputs(Map<String,Object> customOutputs)
- Parameters:
customOutputs- custom outputs
-
initResponse
protected abstract void initResponse(org.apache.sling.api.SlingHttpServletResponse response)
Specifically init the response- Parameters:
response- response on which to write
-
starts
public abstract void starts()
Init the writer, writes beginning of the output
-
setMax
public void setMax(int max)
Setter for max (will put to max if value is negative)- Parameters:
max- positive max value to set
-
setWriter
public void setWriter(Writer writer)
x Set the writer- Parameters:
writer- writer on which to write output
-
write
public void write(org.apache.sling.api.resource.Resource resource)
Write a given resource- Parameters:
resource- resource that will be written
-
error
public void error(String path)
Write a given error- Parameters:
path- resource that lead to the error
-
writeItem
protected abstract void writeItem(org.apache.sling.api.resource.Resource resource)
Write a given resource- Parameters:
resource- resource that will be written
-
ends
public abstract void ends()
writes the end of the output
-
autoClose
public boolean autoClose()
- Returns:
- true if to be closed internally by the plumber
-
disableAutoClose
public void disableAutoClose()
-
setPipe
public void setPipe(Pipe pipe)
Setter- Parameters:
pipe- pipe this writer should be associated with
-
-