Class OutputWriter


  • public abstract class OutputWriter
    extends Object
    defines how pipe's output get written to a servlet response or output stream
    • Constructor Detail

      • OutputWriter

        public OutputWriter()
    • 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 IOException
        Init the writer, writes beginning of the output
        Parameters:
        request - request from which writer will output
        response - 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
      • computeValue

        protected String computeValue​(String key)