001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020
021package org.apache.mina.http.api;
022
023import java.util.Map;
024
025/**
026 * An HTTP message, the ancestor of HTTP request & response.
027 * 
028 * @author The Apache MINA Project (dev@mina.apache.org)
029 */
030public interface HttpMessage {
031
032    /**
033     * The HTTP version of the message
034     * 
035     * @return HTTP/1.0 or HTTP/1.1
036     */
037    HttpVersion getProtocolVersion();
038
039    /**
040     * Gets the <tt>Content-Type</tt> header of the message.
041     * 
042     * @return The content type.
043     */
044    String getContentType();
045
046    /**
047     * @return <tt>true</tt> if this message enables keep-alive connection.
048     */
049    boolean isKeepAlive();
050
051    /**
052     * Returns the value of the HTTP header with the specified name. If more than one header with the given name is
053     * associated with this request, one is selected and returned.
054     * 
055     * @param name The name of the desired header
056     * @return The header value - or null if no header is found with the specified name
057     */
058    String getHeader(String name);
059
060    /**
061     * @param name the Header's name we are looking for
062     * @return <tt>true</tt> if the HTTP header with the specified name exists in this request.
063     */
064    boolean containsHeader(String name);
065
066    /**
067     * @return a read-only {@link Map} of HTTP headers whose key is a {@link String} and whose value is a {@link String}
068     * s.
069     */
070    Map<String, String> getHeaders();
071}