1
//========================================================================
2
//Copyright 2006 Mort Bay Consulting Pty. Ltd.
3
//------------------------------------------------------------------------
4
//Licensed under the Apache License, Version 2.0 (the "License");
5
//you may not use this file except in compliance with the License.
6
//You may obtain a copy of the License at
7
//http://www.apache.org/licenses/LICENSE-2.0
8
//Unless required by applicable law or agreed to in writing, software
9
//distributed under the License is distributed on an "AS IS" BASIS,
10
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
//See the License for the specific language governing permissions and
12
//limitations under the License.
13
//========================================================================
16
package org.mortbay.jetty;
18
import java.io.IOException;
20
import org.mortbay.io.Buffer;
22
public interface Generator
24
public static final boolean LAST=true;
25
public static final boolean MORE=false;
27
/* ------------------------------------------------------------ */
33
* @throws IllegalArgumentException if <code>content</code> is {@link Buffer#isImmutable immutable}.
34
* @throws IllegalStateException If the request is not expecting any more content,
35
* or if the buffers are full and cannot be flushed.
36
* @throws IOException if there is a problem flushing the buffers.
38
void addContent(Buffer content, boolean last) throws IOException;
40
/* ------------------------------------------------------------ */
45
* @return true if the buffers are full
48
boolean addContent(byte b) throws IOException;
50
void complete() throws IOException;
52
void completeHeader(HttpFields responseFields, boolean last) throws IOException;
54
long flush() throws IOException;
56
int getContentBufferSize();
58
long getContentWritten();
60
boolean isContentWritten();
62
void increaseContentBufferSize(int size);
64
boolean isBufferFull();
66
boolean isCommitted();
70
boolean isPersistent();
72
void reset(boolean returnBuffers);
76
void sendError(int code, String reason, String content, boolean close) throws IOException;
78
void setHead(boolean head);
80
void setRequest(String method, String uri);
82
void setResponse(int status, String reason);
85
void setSendServerVersion(boolean sendServerVersion);
87
void setVersion(int version);
91
void setContentLength(long length);
93
void setPersistent(boolean persistent);