History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/net/httpserver/UnmodifiableHeaders.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/net/httpserver/UnmodifiableHeaders.java+101−0
@@ -0,0 +1,101 @@
1+/*
2+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package sun.net.httpserver;
27+
28+import java.util.*;
29+import com.sun.net.httpserver.*;
30+
31+class UnmodifiableHeaders extends Headers {
32+
33+ Headers map;
34+
35+ UnmodifiableHeaders(Headers map) {
36+ this.map = map;
37+ }
38+
39+ public int size() {return map.size();}
40+
41+ public boolean isEmpty() {return map.isEmpty();}
42+
43+ public boolean containsKey(Object key) {
44+ return map.containsKey (key);
45+ }
46+
47+ public boolean containsValue(Object value) {
48+ return map.containsValue(value);
49+ }
50+
51+ public List<String> get(Object key) {
52+ return map.get(key);
53+ }
54+
55+ public String getFirst (String key) {
56+ return map.getFirst(key);
57+ }
58+
59+
60+ public List<String> put(String key, List<String> value) {
61+ return map.put (key, value);
62+ }
63+
64+ public void add (String key, String value) {
65+ throw new UnsupportedOperationException ("unsupported operation");
66+ }
67+
68+ public void set (String key, String value) {
69+ throw new UnsupportedOperationException ("unsupported operation");
70+ }
71+
72+ public List<String> remove(Object key) {
73+ throw new UnsupportedOperationException ("unsupported operation");
74+ }
75+
76+ public void putAll(Map<? extends String,? extends List<String>> t) {
77+ throw new UnsupportedOperationException ("unsupported operation");
78+ }
79+
80+ public void clear() {
81+ throw new UnsupportedOperationException ("unsupported operation");
82+ }
83+
84+ public Set<String> keySet() {
85+ return Collections.unmodifiableSet (map.keySet());
86+ }
87+
88+ public Collection<List<String>> values() {
89+ return Collections.unmodifiableCollection(map.values());
90+ }
91+
92+ /* TODO check that contents of set are not modifable : security */
93+
94+ public Set<Map.Entry<String, List<String>>> entrySet() {
95+ return Collections.unmodifiableSet (map.entrySet());
96+ }
97+
98+ public boolean equals(Object o) {return map.equals(o);}
99+
100+ public int hashCode() {return map.hashCode();}
101+ }