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

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

There is a newer version: 2.3
Show newest version
package com.twelvemonkeys.servlet;

import com.twelvemonkeys.util.CollectionUtil;

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

/**
 * 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/SerlvetParametersMapAdapter.java#1 $
 */
class SerlvetParametersMapAdapter extends AbstractServletMapAdapter {

    protected final HttpServletRequest mRequest;

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

    protected Iterator valuesImpl(String pName) {
        String[] values = mRequest.getParameterValues(pName);
        return values == null ? null : CollectionUtil.iterator(values);
    }

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy