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

com.adobe.forms.common.submitutils.CustomParameterRequest Maven / Gradle / Ivy

/**************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2014 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.forms.common.submitutils;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.request.RequestParameter;
import org.apache.sling.api.request.RequestParameterMap;
import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;

public class CustomParameterRequest extends SlingHttpServletRequestWrapper {
    private ParameterMap parameters;
    private String method;

    public CustomParameterRequest(SlingHttpServletRequest request, ParameterMap params, String method) {
        super(request);
        this.parameters = params;
        this.method = method;
    }
    
    public CustomParameterRequest(SlingHttpServletRequest request, String method) {
        super(request);
        this.method = method;
	    this.parameters = new ParameterMap();
	    this.parameters.putAll(request.getRequestParameterMap());
    }

    @Override
    public RequestParameter getRequestParameter(String name) {
        return parameters.getValue(name);
    }

    @Override
    public RequestParameterMap getRequestParameterMap() {
        return parameters;
    }

    @Override
    public RequestParameter[] getRequestParameters(String name) {
        return parameters.getValues(name);
    }

    @Override
    public String getParameter(String name) {
        return parameters.getStringValue(name);
    }

    @Override
    public Map getParameterMap() {
        return parameters.getStringParameterMap();
    }

    @Override
    public Enumeration getParameterNames() {
        return Collections.enumeration(parameters.keySet());
    }

    @Override
    public String[] getParameterValues(String name) {
        return parameters.getStringValues(name);
    }

    @Override
    public String getMethod() {
        return method;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy