1/*2 * $Id: HeaderExtractor.java 1066849 2011-02-03 16:12:39Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.request.portlet.extractor;
2223import java.util.Enumeration;
2425import javax.portlet.PortletRequest;
26import javax.portlet.PortletResponse;
2728import org.apache.tiles.request.attribute.EnumeratedValuesExtractor;
2930/**31 * Extracts and puts headers in portlet requests and responses.32 *33 * @version $Rev: 1066849 $ $Date: 2011-02-04 03:12:39 +1100 (Fri, 04 Feb 2011) $34 */35publicclassHeaderExtractorimplementsEnumeratedValuesExtractor {
3637/**38 * The request.39 */40private PortletRequest request;
4142/**43 * The response.44 */45private PortletResponse response;
4647/**48 * Constructor.49 *50 * @param request The request.51 * @param response The response.52 */53publicHeaderExtractor(PortletRequest request,
54 PortletResponse response) {
55this.request = request;
56this.response = response;
57 }
5859 @Override
60public Enumeration<String> getKeys() {
61return request.getPropertyNames();
62 }
6364 @Override
65public String getValue(String key) {
66return request.getProperty(key);
67 }
6869 @Override
70public Enumeration<String> getValues(String key) {
71return request.getProperties(key);
72 }
7374 @Override
75publicvoid setValue(String key, String value) {
76 response.setProperty(key, value);
77 }
78 }