01: /*
02: * Copyright 1999-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.coyote.http11;
18:
19: import java.io.IOException;
20:
21: import org.apache.tomcat.util.buf.ByteChunk;
22:
23: import org.apache.coyote.OutputBuffer;
24: import org.apache.coyote.Response;
25:
26: /**
27: * Output filter.
28: *
29: * @author Remy Maucherat
30: */
31: public interface OutputFilter extends OutputBuffer {
32:
33: /**
34: * Write some bytes.
35: *
36: * @return number of bytes written by the filter
37: */
38: public int doWrite(ByteChunk chunk, Response unused)
39: throws IOException;
40:
41: /**
42: * Some filters need additional parameters from the response. All the
43: * necessary reading can occur in that method, as this method is called
44: * after the response header processing is complete.
45: */
46: public void setResponse(Response response);
47:
48: /**
49: * Make the filter ready to process the next request.
50: */
51: public void recycle();
52:
53: /**
54: * Get the name of the encoding handled by this filter.
55: */
56: public ByteChunk getEncodingName();
57:
58: /**
59: * Set the next buffer in the filter pipeline.
60: */
61: public void setBuffer(OutputBuffer buffer);
62:
63: /**
64: * End the current request. It is acceptable to write extra bytes using
65: * buffer.doWrite during the execution of this method.
66: *
67: * @return Should return 0 unless the filter does some content length
68: * delimitation, in which case the number is the amount of extra bytes or
69: * missing bytes, which would indicate an error.
70: * Note: It is recommended that extra bytes be swallowed by the filter.
71: */
72: public long end() throws IOException;
73:
74: }
|