01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
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: */package org.apache.cxf.helpers;
19:
20: import java.util.HashMap;
21: import java.util.List;
22: import java.util.Map;
23:
24: public final class HttpHeaderHelper {
25:
26: public static final String CONTENT_TYPE = "Content-Type";
27: public static final String CONTENT_ID = "Content-ID";
28: public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
29: public static final String COOKIE = "Cookie";
30: public static final String TRANSFER_ENCODING = "Transfer-Encoding";
31: public static final String CHUNKED = "chunked";
32: public static final String CONNECTION = "Connection";
33: public static final String CLOSE = "close";
34:
35: private static Map<String, String> internalHeaders = new HashMap<String, String>();
36:
37: static {
38: internalHeaders.put("Content-Type", "content-type");
39: internalHeaders.put("Content-ID", "content-id");
40: internalHeaders.put("Content-Transfer-Encoding",
41: "content-transfer-encoding");
42: internalHeaders.put("Transfer-Encoding", "transfer-encoding");
43: internalHeaders.put("Connection", "connection");
44: }
45:
46: private HttpHeaderHelper() {
47:
48: }
49:
50: public static List getHeader(Map<String, List<String>> headerMap,
51: String key) {
52: return headerMap.get(getHeaderKey(key));
53: }
54:
55: public static String getHeaderKey(String key) {
56: if (internalHeaders.containsKey(key)) {
57: return internalHeaders.get(key);
58: } else {
59: return key;
60: }
61: }
62: }
|