ffang commented on code in PR #3620:
URL: https://github.com/apache/cxf/pull/3620#discussion_r4389955933


##########
rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServletResponseHeaders.java:
##########
@@ -0,0 +1,61 @@
+/**
+ * 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.cxf.transport.http;
+
+import java.util.AbstractMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import jakarta.servlet.http.HttpServletResponse;
+import org.apache.cxf.message.Message;
+
+/**
+ * A response header view evaluated when read, after application interceptors 
have added headers.
+ * Each iteration uses an immutable snapshot; the transport owns servlet 
access and merging rules.
+ */
+final class ServletResponseHeaders extends AbstractMap<String, List<String>> {

Review Comment:
   Thanks @reta for the feedback! It was already read-only in practice: `put` 
throws in `AbstractMap`, `remove`/`clear` go through the unmodifiable snapshot, 
and `prepare()` wrapped the view in `Collections.unmodifiableMap`. But it 
relied on the caller doing that wrapping. In <hash> the constructor is private 
and a `ServletResponseHeaders.of(message, response)` factory always returns the 
unmodifiable view. The test now also checks that `remove` and `clear` throw 
`UnsupportedOperationException`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to