KickJava   Java API By Example, From Geeks To Geeks.

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


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.InputBuffer;
25 import org.apache.coyote.Request;
26
27 /**
28  * Input filter interface.
29  *
30  * @author Remy Maucherat
31  */

32 public interface InputFilter extends InputBuffer {
33
34
35     /**
36      * Read bytes.
37      *
38      * @return Number of bytes read.
39      */

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

49     public void setRequest(Request request);
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(InputBuffer buffer);
68
69
70     /**
71      * End the current request.
72      *
73      * @return 0 is the expected return value. A positive value indicates that
74      * too many bytes were read. This method is allowed to use buffer.doRead
75      * to consume extra bytes. The result of this method can't be negative (if
76      * an error happens, an IOException should be thrown instead).
77      */

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