All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twelvemonkeys.servlet.SerlvetHeadersMapAdapter Maven / Gradle / Ivy

package com.twelvemonkeys.servlet;

import com.twelvemonkeys.util.CollectionUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.Iterator;

/**
 * HeaderMap
 *
 * @author Harald Kuhr
 * @author last modified by $Author: haku $
 * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-servlet/src/main/java/com/twelvemonkeys/servlet/SerlvetHeadersMapAdapter.java#1 $
 */
class SerlvetHeadersMapAdapter extends AbstractServletMapAdapter {

    protected final HttpServletRequest mRequest;

    public SerlvetHeadersMapAdapter(HttpServletRequest pRequest) {
        if (pRequest == null) {
            throw new IllegalArgumentException("request == null");
        }
        mRequest = pRequest;
    }


    protected Iterator valuesImpl(String pName) {
        //noinspection unchecked
        Enumeration headers = mRequest.getHeaders(pName);
        return headers == null ? null : CollectionUtil.iterator(headers);
    }

    protected Iterator keysImpl() {
        //noinspection unchecked
        Enumeration headerNames = mRequest.getHeaderNames();
        return headerNames == null ? null : CollectionUtil.iterator(headerNames);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy