Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 package org.apache.sling.engine.impl.request;
 
 
 
The ContentData class provides objects which are relevant for the processing of a single Content object by its Component.

See also:
RequestData
 
 public class ContentData implements BufferProvider {
 
     private RequestPathInfo requestPathInfo;
 
     private Resource resource;
 
     private Servlet servlet;
 
     private Buffer buffer;
 
     private int requestedBufferSize;
 
     private BufferProvider parent;
 
     public ContentData(Resource resourceRequestPathInfo requestPathInfo,
             BufferProvider parent) {
         this. = resource;
         this. = requestPathInfo;
         this. = parent;
         this. = parent.getBufferSize();
     }
 
     /* package */void dispose() {
         this. = null;
 
         // flush buffer contents to output
         try {
             this.flushBuffer();
         } catch (IOException ioe) {
             // TODO: handle
         }
     }
 
     public Resource getResource() {
         return ;
     }
 
     public RequestPathInfo getRequestPathInfo() {
         return ;
     }
 
     public Servlet getServlet() {
         return ;
     }
 
     public void setServlet(Servlet servlet) {
         this. = servlet;
     }
 
     // ---------- BufferProvider interface -------------------------------
 
     public void setBufferSize(int buffersize) {
         if (this. != null) {
             this..setBufferSize(buffersize);
         }
 
         this. = buffersize;
     }
 
    public int getBufferSize() {
        if (this. != null) {
            return this..getBufferSize();
        }
        return this.;
    }
    public void flushBuffer() throws IOException {
        if (this. != null) {
            this..flushBuffer();
        }
    }
    public void resetBuffer() {
        if (this. != null) {
            this..resetBuffer();
        }
    }
    public ServletOutputStream getOutputStream() throws IOException {
        if (this. instanceof OutputStream) {
            return (ServletOutputStreamthis.;
        } else if (this. != null) {
            throw new IllegalStateException("Writer already retrieved");
        }
        ServletOutputStream parentStream = this..getOutputStream();
            parentStreamthis.getBufferSize());
        this. = stream;
        return stream;
    }
    public PrintWriter getWriter() throws IOException {
        if (this. instanceof PrintWriter) {
            return (PrintWriterthis.;
        } else if (this. != null) {
            throw new IllegalStateException("OutputStream already retrieved");
        }
        PrintWriter parentWriter = this..getWriter();
        BufferedPrintWriter writer = new BufferedPrintWriter(parentWriter,
            this.getBufferSize());
        this. = writer;
        return writer;
    }
New to GrepCode? Check out our FAQ X