annotate src/org/eclipse/jetty/http/Generator.java @ 913:17f4fe8271de

simplify connectors
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 08 Oct 2016 23:57:11 -0600
parents fef4392f4905
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 package org.eclipse.jetty.http;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import org.eclipse.jetty.io.Buffer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 public interface Generator
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 {
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
28 public static final boolean LAST=true;
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
29 public static final boolean MORE=false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
31 /* ------------------------------------------------------------ */
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
32 /**
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
33 * Add content.
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
34 *
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
35 * @param content
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
36 * @param last
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
37 * @throws IllegalArgumentException if <code>content</code> is {@link Buffer#isImmutable immutable}.
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
38 * @throws IllegalStateException If the request is not expecting any more content,
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
39 * or if the buffers are full and cannot be flushed.
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
40 * @throws IOException if there is a problem flushing the buffers.
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
41 */
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
42 void addContent(Buffer content, boolean last) throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
44 void complete() throws IOException;
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
45
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
46 void completeHeader(HttpFields responseFields, boolean last) throws IOException;
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
47
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
48 int flushBuffer() throws IOException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
50 int getContentBufferSize();
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
51
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
52 long getContentWritten();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
54 boolean isWritten();
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
55
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
56 boolean isAllContentWritten();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
57
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
58 void increaseContentBufferSize(int size);
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
59
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
60 boolean isBufferFull();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
61
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
62 boolean isCommitted();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
63
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
64 boolean isComplete();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
65
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
66 boolean isPersistent();
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
67
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
68 void reset();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
69
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
70 void resetBuffer();
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
71
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
72 void returnBuffers();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
73
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
74 void sendError(int code, String reason, String content, boolean close) throws IOException;
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
75
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
76 void setHead(boolean head);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
77
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
78 void setRequest(String method, String uri);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
79
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
80 void setResponse(int status, String reason);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
81
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
82
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
83 void setVersion(int version);
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
84
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
85 boolean isIdle();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
86
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
87 void setContentLength(long length);
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
88
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
89 void setPersistent(boolean persistent);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
90
877
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
91 void setDate(Buffer timeStampBuffer);
fef4392f4905 remove sendServerVersion
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
92
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
93
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
94 }