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

org.refcodes.net.HeaderField Maven / Gradle / Ivy

Go to download

This artifact provides networking (TCP/IP) related definitions and types being used by REFCODES.ORG networking related functionality and artifacts.

There is a newer version: 3.3.9
Show newest version
// /////////////////////////////////////////////////////////////////////////////
// REFCODES.ORG
// /////////////////////////////////////////////////////////////////////////////
// This code is copyright (c) by Siegfried Steiner, Munich, Germany and licensed
// under the following (see "http://en.wikipedia.org/wiki/Multi-licensing")
// licenses:
// -----------------------------------------------------------------------------
// GNU General Public License, v3.0 ("http://www.gnu.org/licenses/gpl-3.0.html")
// -----------------------------------------------------------------------------
// Apache License, v2.0 ("http://www.apache.org/licenses/LICENSE-2.0")
// -----------------------------------------------------------------------------
// Please contact the copyright holding author(s) of the software artifacts in
// question for licensing issues not being covered by the above listed licenses,
// also regarding commercial licensing models or regarding the compatibility
// with other open source licenses.
// /////////////////////////////////////////////////////////////////////////////

package org.refcodes.net;

import org.refcodes.mixin.NameAccessor;

public enum HeaderField implements NameAccessor {

	// @formatter:off
	ALLOW ("Allow"),
	CONTENT_ENCODING("Content-Encoding"),
	CONTENT_LANGUAGE("Content-Language"),
	CONTENT_LENGTH ("Content-Length"),
	CONTENT_LOCATION("Content-Location"),
	CONTENT_MD5 ("Content-MD5"),
	CONTENT_RANGE ("Content-Range"),
	CONTENT_TYPE ("Content-Type"),
	EXPIRES ("Expires"),
	LAST_MODIFIED ("Last-Modified"),
	EXTENSION_HEADER("Extension-Header"),
	COOKIE("Cookie"),
	SET_COOKIE("Set-Cookie"),
	ACCEPT("Accept"),
	ACCEPT_ENCODING("Accept-encoding"),
	CONNECTION("Connection"),
	HOST("Host"),
	USER_AGENT("User-agent"),
	CORRELATION_ID("Correlation-ID");
	
	// @formatter:on

	// /////////////////////////////////////////////////////////////////////////
	// VARIABLES:
	// /////////////////////////////////////////////////////////////////////////

	private String _name;

	// /////////////////////////////////////////////////////////////////////////
	// CONSTRUCTORS:
	// /////////////////////////////////////////////////////////////////////////

	private HeaderField( String aName ) {
		_name = aName;
	}

	// /////////////////////////////////////////////////////////////////////////
	// METHODS:
	// /////////////////////////////////////////////////////////////////////////

	@Override
	public String getName() {
		return _name;
	}

	// /////////////////////////////////////////////////////////////////////////
	// HELPER:
	// /////////////////////////////////////////////////////////////////////////

	/**
	 * Retrieves the {@link HeaderField} which corresponds to the given HTTP
	 * header field name. The provided HTTP header field name is tested case
	 * insensitive.
	 * 
	 * @param aHttpHeaderField The HTTP header field name for which to get a
	 *        unified {@link HeaderField}.
	 * 
	 * @return Returns the according {@link HeaderField} or null if none such
	 *         {@link HeaderField} has yet been defined.
	 */
	public static HeaderField toHeaderField( String aHttpHeaderField ) {
		for ( HeaderField eField : values() ) {
			if ( eField.getName().equalsIgnoreCase( aHttpHeaderField ) ) return eField;
		}
		return null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy