Example usage for javax.servlet.http HttpServletRequest getParameterMap

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

Introduction

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

Prototype

public Map<String, String[]> getParameterMap();

Source Link

Document

Returns a java.util.Map of the parameters of this request.

Usage

From source file:de.micromata.genome.logging.LogRequestParameterAttribute.java

/**
 * Builds the value./*from  w  w w  .  j  a v  a  2 s.c o m*/
 *
 * @param req the req
 * @param excludingKeys the excluding keys
 */
private void buildValue(HttpServletRequest req, String... excludingKeys) {
    setType(GenomeAttributeType.RequestParams);
    if (req == null || req.getParameterMap().isEmpty() == true) {
        setValue("<no parameter>");
        return;
    }
    String v = getRequestForLogging(req, excludingKeys);
    setValue(v);
}

From source file:org.jnap.core.mvc.interceptor.PagingSetupInterceptor.java

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    Map<String, Object> params = request.getParameterMap();
    if (params.containsKey(this.startParamName) && params.containsKey(this.limitParamName)) {

        String startParam = null;
        String limitParam = null;
        try {//w  w w  .ja va 2s. com
            startParam = getParameterAsString(params, this.startParamName);
            limitParam = getParameterAsString(params, this.limitParamName);
            Integer start = Integer.parseInt(startParam);
            Integer limit = Integer.parseInt(limitParam);

            if (start != null && limit != null) {
                PagingDataHolder.setCurrentPage((start + limit) / limit);
                PagingDataHolder.setResultsPerPage(limit);
            }
        } catch (Exception e) {
            logger.warn(MessageFormat.format(
                    "Warning! Paging was not set because paging "
                            + "params were set, but in the wrong format: start={0}, limit={1}",
                    startParam, limitParam), e);
        }
    }
    return true;
}

From source file:guru.nidi.raml.doc.servlet.MirrorServlet.java

private Map<String, Object> query(HttpServletRequest req) {
    final Map<String, Object> map = new HashMap<>();
    for (Map.Entry<String, String[]> entry : req.getParameterMap().entrySet()) {
        map.put(entry.getKey(), entry.getValue());
    }//from w  w  w .j  a  v a  2s  .c o m
    return map;
}

From source file:com.mirth.connect.server.servlets.MirthServlet.java

protected Integer getIntegerParameter(HttpServletRequest request, String key,
        Map<String, Object> parameterMap) {
    Integer param = null;//w w w. j  av a 2s  . com

    if (request.getParameterMap().containsKey(key)) {
        param = Integer.parseInt(request.getParameter(key));
        parameterMap.put(key, param);
    }

    return param;
}

From source file:com.revolsys.ui.web.config.HttpServletRequestJexlContext.java

@Override
public Map getVars() {
    return new AbstractMap<String, Object>() {
        @Override/*from www  .j  ava  2s  . c  om*/
        @SuppressWarnings("unchecked")
        public Set<Entry<String, Object>> entrySet() {
            final HttpServletRequest request = getRequest();
            final Map<String, Object> map = new HashMap<>();
            map.putAll(request.getParameterMap());
            for (final Enumeration<String> names = request.getAttributeNames(); names.hasMoreElements();) {
                final String name = names.nextElement();
                map.put(name, request.getAttribute(name));
            }
            if (HttpServletRequestJexlContext.this.servletContext != null) {
                for (final Enumeration<String> names = HttpServletRequestJexlContext.this.servletContext
                        .getAttributeNames(); names.hasMoreElements();) {
                    final String name = names.nextElement();
                    map.put(name, HttpServletRequestJexlContext.this.servletContext.getAttribute(name));
                }
            }
            final Map<String, Object> attributes = HttpServletRequestJexlContext.this.localAttributes.get();
            if (attributes != null) {
                map.putAll(attributes);
            }
            map.put("request", request);
            map.put("requestURI",
                    HttpServletRequestJexlContext.this.urlPathHelper.getOriginatingRequestUri(request));
            return map.entrySet();
        }
    };
}

From source file:com.handu.open.dubbo.monitor.controller.UnregisterController.java

@RequestMapping(method = RequestMethod.GET)
public String unregister(@RequestParam String provider, HttpServletRequest request) {
    URL providerUrl = URL.valueOf(provider);
    registryContainer.getRegistry().unregister(providerUrl);

    String page;//from  w  w w  .j  a v  a  2  s. c o m
    Map<String, String[]> params = request.getParameterMap();

    if (params.containsKey("service")) {
        page = "services/providers?service=" + request.getParameter("service");
    } else if (params.containsKey("host")) {
        page = "hosts/providers?host=" + request.getParameter("host");
    } else if (params.containsKey("application")) {
        page = "applications/providers?application=" + request.getParameter("application");
    } else {
        page = "services/providers?service=" + providerUrl.getServiceInterface();
    }

    return "redirect:" + page;
}

From source file:net.navasoft.madcoin.backend.services.security.CustomAuthenticationEntryPoint.java

/**
 * Commence./*from   w  w  w.  ja  v  a2  s.  c om*/
 * 
 * @param request
 *            the request
 * @param response
 *            the response
 * @param authException
 *            the auth exception
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 * @throws ServletException
 *             the servlet exception
 * @since 27/07/2014, 06:48:55 PM
 */
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
        AuthenticationException authException) throws IOException, ServletException {
    System.out.println("Entra...");
    System.out.println(request.getParameterMap());
    response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
            "Unauthorized: Authentication token was either missing or invalid.");
}

From source file:net.triptech.metahive.web.model.RecordFilter.java

/**
 * Process the parameters from the search form.
 *
 * @param request the request//from w  w w  . j  a v  a  2 s .c  o  m
 */
public void processSearchForm(final HttpServletRequest request) {

    FilterVector filterVector = new FilterVector();

    for (Object objParam : request.getParameterMap().keySet()) {
        String param = (String) objParam;
        if (StringUtils.startsWith(param, "d_")) {
            // This is a search term - put the param and its value into the map
            Object objValue = request.getParameterMap().get(param);
            if (objValue != null && objValue instanceof String[]) {
                String[] value = (String[]) objValue;
                if (StringUtils.isNotBlank(value[0]) && !StringUtils.equalsIgnoreCase(value[0], "*")) {
                    filterVector.addVariable(param, value[0]);
                }
            }
        }
    }
    this.filterVectors.add(filterVector);
}

From source file:org.schedoscope.metascope.service.MetascopeURLService.java

public String removeFromFilterURL(HttpServletRequest request, String key) {
    String queryParams = "";
    for (Entry<String, String[]> e : request.getParameterMap().entrySet()) {
        if (!e.getKey().equals(key)) {
            if (!queryParams.isEmpty()) {
                queryParams += URL_PARAMS_AND;
            }/*from w  w w.  j  a v  a2  s . com*/
            queryParams += e.getKey() + URL_PARAMS_EQUALS + cleanseValue(e.getValue()[0]);
        }
    }
    return request.getRequestURL() + URL_PARAMS_DIVIDER + queryParams;
}

From source file:net.shopxx.plugin.tenpayEscowPayment.TenpayEscowPaymentPlugin.java

@Override
public boolean verifyNotify(PaymentPlugin.NotifyMethod notifyMethod, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    if (generateSign(request.getParameterMap()).equals(request.getParameter("sign"))
            && pluginConfig.getAttribute("partner").equals(request.getParameter("partner"))
            && "0".equals(request.getParameter("trade_state"))) {
        try {//  w  ww .  j  a v a2s  .co  m
            Map<String, Object> parameterMap = new HashMap<String, Object>();
            parameterMap.put("input_charset", "utf-8");
            parameterMap.put("sign_type", "MD5");
            parameterMap.put("partner", pluginConfig.getAttribute("partner"));
            parameterMap.put("notify_id", request.getParameter("notify_id"));
            String verifyUrl = "https://gw.tenpay.com/gateway/simpleverifynotifyid.xml?input_charset=utf-8&sign_type=MD5&partner="
                    + pluginConfig.getAttribute("partner") + "&notify_id=" + request.getParameter("notify_id")
                    + "&sign=" + generateSign(parameterMap);
            Document document = new SAXReader().read(new URL(verifyUrl));
            Node node = document.selectSingleNode("/root/retcode");
            if ("0".equals(node.getText().trim())) {
                return true;
            }
        } catch (DocumentException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
    return false;
}