View Javadoc

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