Mercurial Hosting > luan
diff src/org/eclipse/jetty/http/AbstractGenerator.java @ 982:dbecd7faa1f5
remove Generator
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 16 Oct 2016 21:40:27 -0600 |
parents | fef4392f4905 |
children | 23ec25435b8c |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/AbstractGenerator.java Sun Oct 16 21:10:25 2016 -0600 +++ b/src/org/eclipse/jetty/http/AbstractGenerator.java Sun Oct 16 21:40:27 2016 -0600 @@ -38,10 +38,13 @@ * faster, but will consume more memory. This option is just for testing and tuning. * */ -public abstract class AbstractGenerator implements Generator +public abstract class AbstractGenerator { private static final Logger LOG = LoggerFactory.getLogger(AbstractGenerator.class); + public static final boolean LAST=true; + public static final boolean MORE=false; + // states public final static int STATE_HEADER = 0; public final static int STATE_CONTENT = 2; @@ -90,6 +93,19 @@ this._endp = io; } + /* ------------------------------------------------------------ */ + /** + * Add content. + * + * @param content + * @param last + * @throws IllegalArgumentException if <code>content</code> is {@link Buffer#isImmutable immutable}. + * @throws IllegalStateException If the request is not expecting any more content, + * or if the buffers are full and cannot be flushed. + * @throws IOException if there is a problem flushing the buffers. + */ + public abstract void addContent(Buffer content, boolean last) throws IOException; + /* ------------------------------------------------------------------------------- */ public abstract boolean isRequest(); @@ -275,16 +291,11 @@ _noContent=true; } - /* ------------------------------------------------------------ */ public int getVersion() { return _version; } - /* ------------------------------------------------------------ */ - /** - * @see org.eclipse.jetty.http.Generator#setDate(org.eclipse.jetty.io.Buffer) - */ public void setDate(Buffer timeStampBuffer) { _date=timeStampBuffer; @@ -462,12 +473,12 @@ if (content != null) { completeHeader(null, false); - addContent(new View(new ByteArrayBuffer(content)), Generator.LAST); + addContent(new View(new ByteArrayBuffer(content)), LAST); } else if (code>=400) { completeHeader(null, false); - addContent(new View(new ByteArrayBuffer("Error: "+(reason==null?(""+code):reason))), Generator.LAST); + addContent(new View(new ByteArrayBuffer("Error: "+(reason==null?(""+code):reason))), LAST); } else {