1/*
2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpServerConnection.java $
3 * $Revision: 542199 $
4 * $Date: 2007-05-28 04:23:46 -0700 (Mon, 28 May 2007) $
5 *
6 * ====================================================================
7 * Licensed to the Apache Software Foundation (ASF) under one
8 * or more contributor license agreements.  See the NOTICE file
9 * distributed with this work for additional information
10 * regarding copyright ownership.  The ASF licenses this file
11 * to you under the Apache License, Version 2.0 (the
12 * "License"); you may not use this file except in compliance
13 * with the License.  You may obtain a copy of the License at
14 *
15 *   http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing,
18 * software distributed under the License is distributed on an
19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 * KIND, either express or implied.  See the License for the
21 * specific language governing permissions and limitations
22 * under the License.
23 * ====================================================================
24 *
25 * This software consists of voluntary contributions made by many
26 * individuals on behalf of the Apache Software Foundation.  For more
27 * information on the Apache Software Foundation, please see
28 * <http://www.apache.org/>.
29 *
30 */
31
32package org.apache.http;
33
34import java.io.IOException;
35
36/**
37 * An HTTP connection for use on the server side.
38 * Requests are received, responses are sent.
39 *
40 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
41 *
42 * @version $Revision: 542199 $
43 *
44 * @since 4.0
45 */
46public interface HttpServerConnection extends HttpConnection {
47
48    /**
49     * Receives the request line and all headers available from this connection.
50     * The caller should examine the returned request and decide if to receive a
51     * request entity as well.
52     *
53     * @return a new HttpRequest object whose request line and headers are
54     *         initialized.
55     * @throws HttpException
56     * @throws IOException
57     */
58    HttpRequest receiveRequestHeader()
59        throws HttpException, IOException;
60
61    /**
62     * Receives the next request entity available from this connection and attaches it to
63     * an existing request.
64     * @param request the request to attach the entity to.
65     * @throws HttpException
66     * @throws IOException
67     */
68    void receiveRequestEntity(HttpEntityEnclosingRequest request)
69        throws HttpException, IOException;
70
71    /**
72     * Sends the response line and headers of a response over this connection.
73     * @param response the response whose headers to send.
74     * @throws HttpException
75     * @throws IOException
76     */
77    void sendResponseHeader(HttpResponse response)
78        throws HttpException, IOException;
79
80    /**
81     * Sends the response entity of a response over this connection.
82     * @param response the response whose entity to send.
83     * @throws HttpException
84     * @throws IOException
85     */
86    void sendResponseEntity(HttpResponse response)
87        throws HttpException, IOException;
88
89    /**
90     * Sends all pending buffered data over this connection.
91     * @throws IOException
92     */
93    void flush()
94        throws IOException;
95
96}
97