Void input filter, which returns -1 when attempting a read. Used with a GET, HEAD, or a similar request.
| 29 | * Void input filter, which returns -1 when attempting a read. Used with a GET, HEAD, or a similar request. |
| 30 | */ |
| 31 | public class VoidInputFilter implements InputFilter { |
| 32 | |
| 33 | /** |
| 34 | * Constructs a new VoidInputFilter. |
| 35 | */ |
| 36 | public VoidInputFilter() { |
| 37 | } |
| 38 | |
| 39 | |
| 40 | // -------------------------------------------------------------- Constants |
| 41 | |
| 42 | /** |
| 43 | * Name of the void encoding. |
| 44 | */ |
| 45 | protected static final String ENCODING_NAME = "void"; |
| 46 | /** |
| 47 | * ByteChunk representation of the void encoding name. |
| 48 | */ |
| 49 | protected static final ByteChunk ENCODING = new ByteChunk(); |
| 50 | |
| 51 | |
| 52 | // ----------------------------------------------------- Static Initializer |
| 53 | |
| 54 | static { |
| 55 | ENCODING.setBytes(ENCODING_NAME.getBytes(StandardCharsets.ISO_8859_1), 0, ENCODING_NAME.length()); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | // ---------------------------------------------------- InputBuffer Methods |
| 60 | |
| 61 | @Override |
| 62 | public int doRead(ApplicationBufferHandler handler) throws IOException { |
| 63 | return -1; |
| 64 | } |
| 65 | |
| 66 | |
| 67 | // ---------------------------------------------------- InputFilter Methods |
| 68 | |
| 69 | @Override |
| 70 | public void setRequest(Request request) { |
| 71 | // NOOP: Request isn't used so ignore it |
| 72 | } |
| 73 | |
| 74 | |
| 75 | @Override |
| 76 | public void setBuffer(InputBuffer buffer) { |
| 77 | // NOOP: No body to read |
| 78 | } |
| 79 | |
| 80 | |
| 81 | @Override |
| 82 | public void recycle() { |
| 83 | // NOOP |
| 84 | } |
| 85 | |
| 86 | |
| 87 | @Override |
| 88 | public ByteChunk getEncodingName() { |