Example usage for javax.servlet.http HttpServletRequest getParameterValues

List of usage examples for javax.servlet.http HttpServletRequest getParameterValues

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getParameterValues.

Prototype

public String[] getParameterValues(String name);

Source Link

Document

Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

Usage

From source file:org.apache.sling.distribution.util.RequestUtils.java

public static DistributionRequest fromServletRequest(HttpServletRequest request) {
    String action = request.getParameter(DistributionParameter.ACTION.toString());
    String[] paths = request.getParameterValues(DistributionParameter.PATH.toString());
    String deepParam = request.getParameter(DistributionParameter.DEEP.toString());

    boolean deep = false;
    if ("true".equals(deepParam)) {
        deep = true;/*from   w w  w.j ava2 s .com*/
    }

    if (paths == null) {
        paths = new String[0];
    }

    return new SimpleDistributionRequest(DistributionRequestType.fromName(action), deep, paths);
}

From source file:edu.stanford.muse.webapp.NewFilter.java

/** in future, could create Filter from a list of detailed facet items to make it more robust
// currently, we create a filter from the given request */
public static NewFilter createFilterFromRequest(HttpServletRequest request) {
    NewFilter f = new NewFilter();
    // copy over the request params into the filter's map
    for (Object p : request.getParameterMap().keySet())
        f.map.put((String) p, request.getParameterValues((String) p));
    return f;/* w  ww.j  a  v  a 2  s.c o m*/
}

From source file:eu.eubrazilcc.lvl.oauth2.rest.LinkedInAuthz.java

private static String parseQuery(final HttpServletRequest request, final String param) {
    String value = null;//from   ww w.  j  a  va 2s .  c  o m
    if (request == null || request.getParameterValues(param) == null
            || request.getParameterValues(param).length != 1
            || isBlank(trimToNull(value = request.getParameter(param)))) {
        throw new WebApplicationException("Missing required parameters", Response.Status.BAD_REQUEST);
    }
    return value;
}

From source file:com.mapviewer.business.UserRequestManager.java

/**
 * Updates the request done by the user.
 *
 * @param request//ww  w . ja  v a  2  s  . c  o  m
 */
public static boolean updateDataSelected(HttpServletRequest request) {
    String[] url = request.getParameterValues("URL");
    boolean existeURL = false;
    if (url != null) {
        existeURL = true;
        request.setAttribute("layersSpecData", url);
    }
    return existeURL;
}

From source file:com.age.core.utils.web.ServletUtils.java

/**
 * ?Request Parameter.//  www  .j  a v  a2  s.c  o m
 */
@SuppressWarnings("unchecked")
public static List<String> getListParameter(HttpServletRequest request, String name) {
    String[] values = request.getParameterValues(name);
    return values == null ? Collections.EMPTY_LIST : Arrays.asList(values);
}

From source file:com.hbc.api.gateway.alizhifu.util.AlipayCallBackValidator.java

public static Map<String, String> getParameterMap(HttpServletRequest request) {
    Set<String> keyset = request.getParameterMap().keySet();
    Map<String, String> result = new HashMap<String, String>();
    for (String key : keyset) {
        String[] values = request.getParameterValues(key);
        for (int i = 0; i < values.length; i++) {
            String value = values[i];
            result.put(key, value);/*from ww w.  ja  va 2 s.  c o m*/
        }
    }
    return result;
}

From source file:com.sunway.cbm.util.ServletUtils.java

/**
 * ?Request Parameter.//from   ww w  .j  a  v  a 2s.c  o m
 */
public static List<String> getListParameter(HttpServletRequest request, String name) {
    String[] values = request.getParameterValues(name);
    return values == null ? Collections.emptyList() : Arrays.asList(values);
}

From source file:architecture.ee.web.util.ParamUtils.java

public static int[] getIntParameters(HttpServletRequest request, String name, int defaultNum) {
    String paramValues[] = request.getParameterValues(name);
    if (paramValues == null || paramValues.length == 0)
        return new int[0];
    int values[] = new int[paramValues.length];
    for (int i = 0; i < paramValues.length; i++)
        try {/*from   www.j a v  a2  s.c o  m*/
            values[i] = Integer.parseInt(paramValues[i].trim());
        } catch (Exception e) {
            values[i] = defaultNum;
        }

    return values;
}

From source file:architecture.ee.web.util.ParamUtils.java

public static long[] getLongParameters(HttpServletRequest request, String name, long defaultNum) {
    String paramValues[] = request.getParameterValues(name);
    if (paramValues == null || paramValues.length == 0)
        return new long[0];
    long values[] = new long[paramValues.length];
    for (int i = 0; i < paramValues.length; i++)
        try {/*  w w  w.j  ava2s .  c  o m*/
            values[i] = Long.parseLong(paramValues[i].trim());
        } catch (Exception e) {
            values[i] = defaultNum;
        }

    return values;
}

From source file:com.doculibre.constellio.wicket.utils.SimpleParamsUtils.java

@SuppressWarnings("unchecked")
public static SimpleParams toSimpleParams(HttpServletRequest request) {
    SimpleParams params = new SimpleParams();
    Enumeration<String> paramNames = request.getParameterNames();
    while (paramNames.hasMoreElements()) {
        String paramName = (String) paramNames.nextElement();
        List<String> paramValues = Arrays.asList(request.getParameterValues(paramName));
        params.add(paramName, paramValues);
    }/*from   w w w.j  av a2  s. c om*/
    return params;
}