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 <a href="http://mina.apache.org">Apache MINA Project</a> 29 * 30 */ 31 public interface HttpMessage extends HttpPdu { 32 33 /** 34 * The HTTP version of the message 35 * 36 * @return HTTP/1.0 or HTTP/1.1 37 */ 38 HttpVersion getProtocolVersion(); 39 40 /** 41 * Gets the <tt>Content-Type</tt> header of the message. 42 * 43 * @return The content type. 44 */ 45 String getContentType(); 46 47 /** 48 * Returns <tt>true</tt> if this message enables keep-alive connection. 49 */ 50 boolean isKeepAlive(); 51 52 /** 53 * Returns the value of the HTTP header with the specified name. If more than one header with the given name is 54 * associated with this request, one is selected and returned. 55 * 56 * @param name The name of the desired header 57 * @return The header value - or null if no header is found with the specified name 58 */ 59 String getHeader(String name); 60 61 /** 62 * Returns <tt>true</tt> if the HTTP header with the specified name exists in this request. 63 */ 64 boolean containsHeader(String name); 65 66 /** 67 * Returns 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 }