All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xsocket.connection.http.IHttpMessageHeader Maven / Gradle / Ivy

There is a newer version: 2.0-beta-1
Show newest version
/*
 *  Copyright (c) xsocket.org, 2006 - 2008. All rights reserved.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
 * The latest copy of this software may be found on http://www.xsocket.org/
 */
package org.xsocket.connection.http;

import java.util.Enumeration;
import java.util.List;
import java.util.Set;




/**
 * The message header definition 
 *
 * @author [email protected]
 */
public interface IHttpMessageHeader  {
	

	
	/**
	 * adds a header 
	 * 
	 * @param headername    the header name
	 * @param headervalue   the header value
	 */
	public void addHeader(String headername, String headervalue);

	
	/**
	 * set a header. Existing headers with the same name will be removed 
	 * 
	 * @param headername    the header name
	 * @param headervalue   the header value
	 */
	public void setHeader(String headername, String headervalue);

	
	/**
	 * removes a header 
	 * 
	 * @param headername    the header name
	 */
	public void removeHeader(String headername);

	
	/**
	 * removes hop-by-hop headers (see {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1})  
	 */
	public void removeHopByHopHeaders();
	
	
	/**
	 * removes the named hop-by-hop headers (see {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1})
	 *  
	 * @param headernames the header names
	 */
	public void removeHopByHopHeaders(String... headernames);
	
	
	/**
	 * returns if a header exits
	 * 
	 * @param headername the header name
	 * @return true, if the header exits
	 */
	public boolean containsHeader(String headername);
	
	
	/**
	 * returns if a header with an specific value exist
	 * 
	 * @param headername   the header name
	 * @param headervalue  the header value
	 * @return true, if the header with the given value exits
	 */
	public boolean containsHeaderValue(String headername, String headervalue);

	
	/**
	 * returns the header names 
	 * 
	 * @return the header names enumeration
	 */
	@SuppressWarnings("unchecked")
	public Enumeration getHeaderNames();
	 
	
	/**
	 * returns the header names 
	 * 
	 * @return the header names set
	 */
	public Set getHeaderNameSet();
		
	
	/**
	 * returns a header
	 * 
	 * @param headername  the header name
	 * @return  the header value or null
	 */
	public String getHeader(String headername);
	
	
	/**
	 * returns the headers 
	 * 
	 * @param headername the header name
	 * @return the header value enumeration
	 */
	@SuppressWarnings("unchecked")
	public Enumeration getHeaders(String headername);
	
	
	/**
	 * returns the headers 
	 * 
	 * @param headername the header name
	 * @return the header value list
	 */
	public List getHeaderList(String headername);
	
	
	/**
	 * sets the content type
	 * @param type the content type
	 */
	public void setContentType(String type);

	
	/**
	 * returns the content type
	 * 
	 * @return the content type
	 */
	public String getContentType();
	
	
	/**
	 * gets the character encoding
	 * @return the character encoding
	 */
	public String getCharacterEncoding();
	
	
	/**
	 * sets the content length
	 * 
	 * @param length the content length
	 */
	public void setContentLength(int length);
	
	
	/**
	 * gets the content length
	 * 
	 * @return the content length
	 */
	public int getContentLength();

	
	/**
	 * sets the transfer encoding 
	 * @param transferEncoding the transfer encoding 
	 */
	public void setTransferEncoding(String transferEncoding);
	
	
	/**
	 * gets the transfer encoding 
	 * 
	 * @return the transfer encoding 
	 */
	public String getTransferEncoding();
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy