/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.management.internal.web.http;
import org.apache.geode.internal.lang.StringUtils;
/**
* The HttpHeader enum is an enumeration of all HTTP request/response header names.
* <p/>
*
* @see <a href=
* "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
* @since GemFire 8.0
*/
@SuppressWarnings("unused")
public enum HttpHeader {
ACCEPT("Accept"), ACCEPT_CHARSET("Accept-Charset"), ACCEPT_ENCODING(
"Accept-Encoding"), ACCEPT_LANGUAGE("Accept-Language"), ACCEPT_RANGES("Accept-Ranges"), AGE(
"Age"), ALLOW("Allow"), AUTHORIZATION("Authorization"), CACHE_CONTROL(
"Cache-Control"), CONNECTION("Connection"), 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"), DATE("Date"), ETAG(
"ETag"), EXPECT("Expect"), EXPIRES("Expires"), FROM("From"), HOST(
"Host"), IF_MATCH("If-Match"), IF_MODIFIED_SINCE(
"If-Modified-Since"), IF_NONE_MATCH(
"If-None-Match"), IF_RANGE(
"If-Range"), IF_UNMODIFIED_SINCE(
"If-Unmodified-Since"), LAST_MODIFIED(
"Last-Modified"), LOCATION(
"Location"), MAX_FORWARDS(
"Max-Forwards"), PRAGMA(
"Pragma"), PROXY_AUTHENTICATE(
"Proxy-Authenticate"), PROXY_AUTHORIZATION(
"Proxy-Authorization"), RANGE(
"Range"), REFERER(
"Referer"), RETRY_AFTER(
"Retry-After"), SERVER(
"Server"), TE(
"TE"), TRAILER(
"Trailer"), TRANSFER_ENCODING(
"Transfer-Encoding"), UPGRADE(
"Upgrade"), USER_AGENT(
"User-Agent"), VARY(
"Vary"), VIA(
"Via"), WARNING(
"Warning"), WWW_AUTHENTICATE(
"WWW-Authenticate");
// the name of the Http request or response header
private final String name;
HttpHeader(final String name) {
assert !StringUtils.isBlank(name) : "The name of the HTTP request header must be specified!";
this.name = name;
}
public static HttpHeader valueOfName(final String name) {
for (final HttpHeader header : values()) {
if (header.getName().equalsIgnoreCase(name)) {
return header;
}
}
return null;
}
public String getName() {
return name;
}
}