1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20
21 package org.apache.mina.http.api;
22
23 import java.util.Map;
24
25 /**
26 * An HTTP message, the ancestor of HTTP request & response.
27 *
28 * @author The Apache MINA Project (dev@mina.apache.org)
29 */
30 public interface HttpMessage {
31
32 /**
33 * The HTTP version of the message
34 *
35 * @return HTTP/1.0 or HTTP/1.1
36 */
37 HttpVersion getProtocolVersion();
38
39 /**
40 * Gets the <tt>Content-Type</tt> header of the message.
41 *
42 * @return The content type.
43 */
44 String getContentType();
45
46 /**
47 * @return <tt>true</tt> if this message enables keep-alive connection.
48 */
49 boolean isKeepAlive();
50
51 /**
52 * Returns the value of the HTTP header with the specified name. If more than one header with the given name is
53 * associated with this request, one is selected and returned.
54 *
55 * @param name The name of the desired header
56 * @return The header value - or null if no header is found with the specified name
57 */
58 String getHeader(String name);
59
60 /**
61 * @param name the Header's name we are looking for
62 * @return <tt>true</tt> if the HTTP header with the specified name exists in this request.
63 */
64 boolean containsHeader(String name);
65
66 /**
67 * @return a read-only {@link Map} of HTTP headers whose key is a {@link String} and whose value is a {@link String}
68 * s.
69 */
70 Map<String, String> getHeaders();
71 }