KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > coyote > http11 > OutputFilter


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.coyote.http11;
19
20 import java.io.IOException JavaDoc;
21
22 import org.apache.tomcat.util.buf.ByteChunk;
23
24 import org.apache.coyote.OutputBuffer;
25 import org.apache.coyote.Response;
26
27 /**
28  * Output filter.
29  *
30  * @author Remy Maucherat
31  */

32 public interface OutputFilter extends OutputBuffer {
33
34
35     /**
36      * Write some bytes.
37      *
38      * @return number of bytes written by the filter
39      */

40     public int doWrite(ByteChunk chunk, Response unused)
41         throws IOException JavaDoc;
42
43
44     /**
45      * Some filters need additional parameters from the response. All the
46      * necessary reading can occur in that method, as this method is called
47      * after the response header processing is complete.
48      */

49     public void setResponse(Response response);
50
51
52     /**
53      * Make the filter ready to process the next request.
54      */

55     public void recycle();
56
57
58     /**
59      * Get the name of the encoding handled by this filter.
60      */

61     public ByteChunk getEncodingName();
62
63
64     /**
65      * Set the next buffer in the filter pipeline.
66      */

67     public void setBuffer(OutputBuffer buffer);
68
69
70     /**
71      * End the current request. It is acceptable to write extra bytes using
72      * buffer.doWrite during the execution of this method.
73      *
74      * @return Should return 0 unless the filter does some content length
75      * delimitation, in which case the number is the amount of extra bytes or
76      * missing bytes, which would indicate an error.
77      * Note: It is recommended that extra bytes be swallowed by the filter.
78      */

79     public long end()
80         throws IOException JavaDoc;
81
82
83 }
84
Popular Tags