Example usage for javax.servlet.http HttpServletRequest getParameterNames

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

Introduction

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

Prototype

public Enumeration<String> getParameterNames();

Source Link

Document

Returns an Enumeration of String objects containing the names of the parameters contained in this request.

Usage

From source file:de.hybris.platform.acceleratorservices.web.payment.controllers.SilentOrderPostMockController.java

protected Map<String, String> cloneRequestParameters(final HttpServletRequest request) {
    final Enumeration<String> paramNames = request.getParameterNames();
    final Map<String, String> params = new HashMap<String, String>();
    while (paramNames.hasMoreElements()) {
        final String paramName = paramNames.nextElement();
        params.put(paramName, request.getParameter(paramName));
    }/*from   ww w  .  j a v  a 2s . c  o  m*/
    return params;
}

From source file:org.appverse.web.framework.backend.api.controllers.FileRetrievalController.java

@RequestMapping(value = "/*.rpc", method = RequestMethod.POST)
public void handleFormUpload(HttpServletRequest request, HttpServletResponse response) throws Exception {
    @SuppressWarnings("unchecked")
    Enumeration<String> parameterNames = request.getParameterNames();
    Map<String, String> parameters = new HashMap<String, String>();
    while (parameterNames.hasMoreElements()) {
        String parameterName = parameterNames.nextElement();
        String parameter = request.getParameter(parameterName);
        parameters.put(parameterName, parameter);
    }//  ww w  .j av  a  2 s .  c om
    SecurityHelper.checkXSRFToken(request);

    String path = request.getServletPath();
    serviceName.set(path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.')));
    processCall(response, parameters);

}

From source file:org.impalaframework.extension.mvc.annotation.resolver.RequestParameterMapArgumentResolver.java

@SuppressWarnings("unchecked")
protected Object getValue(NativeWebRequest webRequest, String encoding) {

    Object nativeRequest = webRequest.getNativeRequest();
    if (nativeRequest instanceof HttpServletRequest) {
        HttpServletRequest req = (HttpServletRequest) nativeRequest;

        Map<String, String> parameters = new HashMap<String, String>();
        final Enumeration<String> parameterNames = req.getParameterNames();
        while (parameterNames.hasMoreElements()) {
            String parameterName = parameterNames.nextElement();
            String parameterValue = req.getParameter(parameterName);
            parameters.put(parameterName, parameterValue);
        }//from   w w w .ja  va  2  s .  c om
        return parameters;
    }
    return null;
}

From source file:de.yaio.services.metaextract.server.controller.MetaExtractController.java

private Map<String, String> getRequestMap(HttpServletRequest request) {
    Map<String, String> typesafeRequestMap = new HashMap<>();
    Enumeration<?> requestParamNames = request.getParameterNames();
    while (requestParamNames.hasMoreElements()) {
        String requestParamName = (String) requestParamNames.nextElement();
        String requestParamValue = request.getParameter(requestParamName);
        typesafeRequestMap.put(requestParamName, requestParamValue);
    }//from   w ww  . ja v  a2s . c  om
    return typesafeRequestMap;
}

From source file:Main.java

protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();

    Enumeration en = request.getParameterNames();

    while (en.hasMoreElements()) {
        String paramName = (String) en.nextElement();
        out.println(paramName + " = " + request.getParameter(paramName) + "<br/>");
    }//from w ww  . j a v  a  2  s.c  o  m
}

From source file:com.weitaomi.systemconfig.filter.LoggingFilter.java

private String getPostParamsStr(HttpServletRequest request) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");

    Enumeration<String> parameterNames = request.getParameterNames();

    while (parameterNames.hasMoreElements()) {
        String name = parameterNames.nextElement();
        sb.append("\"").append(name).append("\"").append(":")
                .append(StringUtil.stringArrayToStringWithQuot(request.getParameterValues(name))).append(",");
    }//from w  ww .  j av  a 2 s.  com
    if (sb.length() > 1) {
        sb.deleteCharAt(sb.length() - 1);
    }
    sb.append("}");

    return sb.toString();
}

From source file:com.alfaariss.oa.ManagerServlet.java

private Properties cloneConfigurationFromRequest(HttpServletRequest oRequest) {
    Properties configuration = new Properties();
    Enumeration keys = oRequest.getParameterNames();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        String value = oRequest.getParameter(key);
        configuration.put(key, value);//  w  ww.ja va2 s .c  o  m
    }
    return configuration;
}

From source file:org.openmrs.module.laboratory.web.controller.form.FormController.java

@SuppressWarnings("rawtypes")
private Map<String, String> buildParameterList(HttpServletRequest request) {
    Map<String, String> parameters = new HashMap<String, String>();
    for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
        String parameterName = (String) e.nextElement();
        if (!parameterName.equalsIgnoreCase("id"))
            if (!parameterName.equalsIgnoreCase("mode"))
                if (!parameterName.equalsIgnoreCase("encounterId"))
                    parameters.put(parameterName, request.getParameter(parameterName));

    }/*from w w  w.j a  va  2s .com*/
    return parameters;
}

From source file:com.apress.progwt.server.web.controllers.ErrorController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse arg1)
        throws Exception {

    log.error("\nErrorController reqServ " + req.getServletPath() + " PathInfo:" + req.getPathInfo()
            + " Param: " + req.getParameterNames().toString() + " Q: " + req.getQueryString() + "</>");

    //        if(log.isDebugEnabled()){
    //            for(Object s :req.getParameterMap().keySet()){
    //                log.debug("param "+s);
    //            }
    //            Enumeration attrs = req.getAttributeNames();
    //            while(attrs.hasMoreElements()){
    //                String attr = (String) attrs.nextElement();
    //                log.debug("attr: "+attr+" "+req.getAttribute(attr));
    //            }
    //        }/*from w  w w  . ja  v  a2s.  c o m*/

    ModelAndView m = super.handleRequestInternal(req, arg1);
    String code = req.getParameter("code");
    if (code != null) {
        Object uri = req.getAttribute("javax.servlet.error.request_ uri");
        m.addObject("message", code + " error for page " + uri);
    }
    return m;
}

From source file:org.openmrs.module.hospitalcore.web.controller.patientsearch.PatientSearchController.java

@SuppressWarnings("rawtypes")
@RequestMapping(value = "/module/hospitalcore/searchPatient.form", method = RequestMethod.POST)
public String searchPatient(@RequestParam("query") String query, @RequestParam("view") String view,
        HttpServletRequest request, Model model) {
    List<Patient> patients = Context.getService(HospitalCoreService.class).searchPatient(query);

    for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
        String parameterName = (String) e.nextElement();
        model.addAttribute(parameterName, request.getParameter(parameterName));
    }/*  w  ww .  j a  va  2 s.  c  o m*/
    Map<Integer, Map<Integer, String>> attributeMap = buildAttributeMap(patients);
    Map<Integer, java.util.Date> lastVisitTime = getLastVisitTime(patients);

    model.addAttribute("lastVisitTime", lastVisitTime);
    model.addAttribute("patients", patients);
    model.addAttribute("attributeMap", attributeMap);
    return view;
}