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:com.adaptris.core.http.jetty.MetadataParameterHandler.java

private void handleParameters(AdaptrisMessage message, HttpServletRequest request, String itemPrefix) {
    String prefix = defaultIfEmpty(itemPrefix, "");

    for (Enumeration<String> e = request.getParameterNames(); e.hasMoreElements();) {
        String key = e.nextElement();
        String value = request.getParameter(key);
        message.addMetadata(prefix + key, value);
    }/*from ww w .  j  a v a 2 s  . c o  m*/
}

From source file:se.vgregion.urlservice.controllers.AdminGuiController.java

private UUID findDeletedId(HttpServletRequest request) {
    Enumeration names = request.getParameterNames();
    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        if (name.startsWith("delete-")) {
            return UUID.fromString(name.substring(7));
        }//from  ww  w .j  av a2  s  .  c om
    }

    return null;
}

From source file:com.adaptris.core.http.jetty.ObjectMetadataParameterHandler.java

private void handleParameters(AdaptrisMessage message, HttpServletRequest request, String itemPrefix) {
    String prefix = defaultIfEmpty(itemPrefix, "");

    for (Enumeration<String> e = request.getParameterNames(); e.hasMoreElements();) {
        String key = e.nextElement();
        String value = request.getParameter(key);
        String metadataKey = prefix + key;
        log.trace("Adding Object Metadata [{}: {}]", metadataKey, value);
        message.addObjectHeader(metadataKey, value);
    }/*from   w ww .j  a v  a2 s.  co  m*/
}

From source file:cec.easyshop.storefront.controllers.integration.BaseIntegrationController.java

protected Map<String, String> getParameterMap(final HttpServletRequest request) {
    final Map<String, String> map = new HashMap<>();
    final Enumeration myEnum = request.getParameterNames();
    while (myEnum.hasMoreElements()) {
        final String paramName = (String) myEnum.nextElement();
        final String paramValue = request.getParameter(paramName);
        map.put(paramName, paramValue);//w w  w  .j av  a  2  s  . c om
    }
    return map;
}

From source file:egovframework.rte.ptl.mvc.bind.CommandMapArgumentResolver.java

/**
 * Controller?  argument? commandMap?? Map ?  
 * HTTP request ??  ?? ? commandMap?  returng.
 * ? ? ?  Map? .//  ww w . ja v  a 2 s  . co  m
 * 
 * @param methodParameter -  ?? ,???  
 * @param webRequest - web request ?
 * @return argument? commandMap(java.util.Map)?  commandMap, <code>UNRESOLVED</code>.
 * @exception Exception
 */
public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) throws Exception {

    Class<?> clazz = methodParameter.getParameterType();
    String paramName = methodParameter.getParameterName();

    if (clazz.equals(Map.class) && paramName.equals("commandMap")) {

        Map<String, Object> commandMap = new HashMap<String, Object>();
        HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest();
        Enumeration<?> enumeration = request.getParameterNames();

        while (enumeration.hasMoreElements()) {
            String key = (String) enumeration.nextElement();
            String[] values = request.getParameterValues(key);
            if (values != null) {
                commandMap.put(key, (values.length > 1) ? values : values[0]);
            }
        }
        return commandMap;
    }
    return UNRESOLVED;
}

From source file:de.berlios.jhelpdesk.web.taglib.PDFLinkTag.java

@Override
public int doStartTag() throws JspException {
    log.debug("doStartTag()");
    StringBuilder sb = new StringBuilder("<a href=\"").append(this.url).append("?format=pdf");
    HttpServletRequest httpServletRequest = (HttpServletRequest) pageContext.getRequest();

    Enumeration<String> paramNames = httpServletRequest.getParameterNames();

    while (paramNames.hasMoreElements()) {
        String _param = paramNames.nextElement();
        if ("format".equalsIgnoreCase(_param)) {
            continue;
        }/*from  w w w  .ja  v  a 2 s .co  m*/
        String[] paramValues = httpServletRequest.getParameterValues(_param);
        for (int i = 0; i < paramValues.length; ++i) {
            sb.append("&").append(_param).append("=").append(paramValues[i]);
        }
    }
    sb.append("\">");
    try {
        pageContext.getOut().write(sb.toString());
    } catch (IOException ioex) {
        log.error("Wystapil problem z zapisem do strumienia.", ioex);
    }
    return EVAL_BODY_INCLUDE;
}

From source file:com.pedra.storefront.controllers.integration.BaseIntegrationController.java

protected Map<String, String> getParameterMap(final HttpServletRequest request) {
    final Map<String, String> map = new HashMap<String, String>();
    final Enumeration myEnum = request.getParameterNames();
    while (myEnum.hasMoreElements()) {
        final String paramName = (String) myEnum.nextElement();
        final String paramValue = request.getParameter(paramName);
        map.put(paramName, paramValue);//w  ww .  j av  a2s.c om
    }
    return map;
}

From source file:com.buaa.cfs.conf.ReconfigurationServlet.java

@SuppressWarnings("unchecked")
private Enumeration<String> getParams(HttpServletRequest req) {
    return req.getParameterNames();
}

From source file:MyServlet.java

public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {

    Enumeration paramNames = request.getParameterNames();

    String parName;/*from   w w  w  .  j  av  a 2s .  c  o  m*/

    boolean emptyEnum = false;
    if (!paramNames.hasMoreElements())
        emptyEnum = true;

    response.setContentType("text/html");

    java.io.PrintWriter out = response.getWriter();

    out.println("<html><head>");
    out.println("<title>Submitted Parameters</title></head><body>");

    if (emptyEnum) {
        out.println("<h2>Sorry, the request does not contain any parameters</h2>");
    } else {
        out.println("<h2>Here are the submitted parameter values</h2>");
    }

    while (paramNames.hasMoreElements()) {

        parName = (String) paramNames.nextElement();
        out.println("<strong>" + parName + "</strong> : " + request.getParameter(parName));
        out.println("<br />");
    }

    out.println("</body></html>");

}

From source file:org.tsugi.jpa.controllers.TsugiController.java

@RequestMapping({ "", "/" })
public String home(HttpServletRequest req, Principal principal, Model model) {
    commonModelPopulate(req, principal, model);

    Enumeration<String> parameterNames = req.getParameterNames();
    while (parameterNames.hasMoreElements()) {
        String paramName = parameterNames.nextElement();
        System.out.print(paramName);
        System.out.print("=");
        String[] paramValues = req.getParameterValues(paramName);
        for (int i = 0; i < paramValues.length; i++) {
            String paramValue = paramValues[i];
            if (i > 0)
                System.out.print(", ");
            System.out.print(paramValue);
        }// ww  w  . ja v a 2 s .c o  m
        System.out.println();
    }

    model.addAttribute("name", "tsugi");
    req.getSession().setAttribute("login", "oauth");
    // LTIRequest ltiRequest = (LTIRequest) req.getAttribute(LTIRequest.class.getName());
    LTIRequest ltiRequest = new LTIRequest(req, allRepositories, false);
    System.out.println("LTI Request=" + ltiRequest.toString());
    if (ltiRequest != null) {
        model.addAttribute("lti", true);
        model.addAttribute("ltiContext", ltiRequest.getLtiContextId());
        model.addAttribute("ltiUser", ltiRequest.getLtiUserDisplayName());
        model.addAttribute("ltiLink", ltiRequest.getLtiLinkId());
    }
    return "tsugi"; // name of the template
}