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:fr.paris.lutece.portal.web.user.AdminLoginJspBean.java

/**
 * Returns the view of forgot password form
 *
 * @param request The request/*from w w  w  .j av a2s  .  c  o m*/
 * @return The HTML form
 */
public String getForgotPassword(HttpServletRequest request) {
    Map<String, Object> model = new HashMap<String, Object>();

    // Invalidate a previous session
    HttpSession session = request.getSession();

    if (session != null) {
        session.removeAttribute(SESSION_ATTRIBUTE_USER);
    }

    Locale locale = AdminUserService.getLocale(request);

    Enumeration<String> enumParams = request.getParameterNames();
    ReferenceList listParams = new ReferenceList();
    String strParamName;

    while (enumParams.hasMoreElements()) {
        strParamName = enumParams.nextElement();

        String strParamValue = request.getParameter(strParamName);
        listParams.addItem(strParamName, strParamValue);
    }

    model.put(MARK_PARAM_VERSION, AppInfo.getVersion());
    model.put(MARK_PARAMS_LIST, listParams);

    HtmlTemplate template = AppTemplateService.getTemplate(TEMPLATE_ADMIN_FORGOT_PASSWORD, locale, model);

    return template.getHtml();
}

From source file:fr.paris.lutece.portal.web.user.AdminLoginJspBean.java

/**
 * Returns the view of forgot password form
 *
 * @param request The request//from  ww  w  .j a v a  2  s .com
 * @return The HTML form
 */
public String getForgotLogin(HttpServletRequest request) {
    Map<String, Object> model = new HashMap<String, Object>();

    // Invalidate a previous session
    HttpSession session = request.getSession();

    if (session != null) {
        session.removeAttribute(SESSION_ATTRIBUTE_USER);
    }

    Locale locale = AdminUserService.getLocale(request);

    Enumeration<String> enumParams = request.getParameterNames();
    ReferenceList listParams = new ReferenceList();
    String strParamName;

    while (enumParams.hasMoreElements()) {
        strParamName = enumParams.nextElement();

        String strParamValue = request.getParameter(strParamName);
        listParams.addItem(strParamName, strParamValue);
    }

    model.put(MARK_PARAM_VERSION, AppInfo.getVersion());
    model.put(MARK_PARAMS_LIST, listParams);

    HtmlTemplate template = AppTemplateService.getTemplate(TEMPLATE_ADMIN_FORGOT_LOGIN, locale, model);

    return template.getHtml();
}

From source file:es.pode.visualizador.presentacion.noticias.NoticiasVer.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final NoticiasVerFormImpl specificForm = (NoticiasVerFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {/*from ww  w.  jav  a2 s  .  c o m*/
        forward = mapping.findForward("ver");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:es.pode.administracion.presentacion.faqs.faqs.FaqsVerFaq.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final FaqsVerFaqFormImpl specificForm = (FaqsVerFaqFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {/*  w  w w . j a v a 2s. c  o m*/
        forward = mapping.findForward("ver.faq");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:com.tremolosecurity.proxy.filter.HttpFilterRequestImpl.java

public HttpFilterRequestImpl(HttpServletRequest request, AuthInfo authInfo) {
    this.request = request;

    this.headers = new HashMap<String, Attribute>();
    this.cookies = new HashMap<String, ArrayList<Cookie>>();
    this.params = new HashMap<String, Attribute>();
    this.paramNames = new ArrayList<String>();

    Enumeration enumer = request.getParameterNames();
    while (enumer.hasMoreElements()) {
        String name = (String) enumer.nextElement();
        this.paramNames.add(name);
    }/*from  w  ww . j  ava  2s  .c  om*/

    this.authInfo = authInfo;

    boolean first = true;

    ProxyUtil.loadParams(request, this.params);

    enumer = request.getHeaderNames();
    while (enumer.hasMoreElements()) {
        String name = (String) enumer.nextElement();
        Enumeration enumerVals = request.getHeaders(name);
        Attribute attrib = new Attribute(name);
        this.headers.put(attrib.getName().toLowerCase(), attrib);
        while (enumerVals.hasMoreElements()) {
            attrib.getValues().add((String) enumerVals.nextElement());
        }
    }

    Cookie[] cookies = request.getCookies();
    if (cookies == null) {
        cookies = new Cookie[0];
    }
    for (int i = 0; i < cookies.length; i++) {
        ArrayList<Cookie> cookieList = this.cookies.get(cookies[i].getName());
        if (cookieList == null) {
            cookieList = new ArrayList<Cookie>();
            this.cookies.put(cookies[i].getName(), cookieList);
        }
        cookieList.add(cookies[i]);

    }

}

From source file:es.pode.administracion.presentacion.planificador.listarTareasEjecutadas.ListarInforme.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final ListarInformeFormImpl specificForm = (ListarInformeFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {//from   w w  w.  jav a2 s .c o  m
        forward = mapping.findForward("informe");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:es.pode.administracion.presentacion.planificador.listarTareasPendientes.ListarMostrar.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final ListarMostrarFormImpl specificForm = (ListarMostrarFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {// ww w  .  j a  va2s.  co m
        forward = mapping.findForward("mostrar");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:es.pode.administracion.presentacion.faqs.faqs.FaqsModificar.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final FaqsModificarFormImpl specificForm = (FaqsModificarFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {/*from   w w w  .jav a 2 s .  co  m*/
        forward = mapping.findForward("modificar");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:es.pode.buscador.presentacion.basico.enviarMail.EnvioMailBuscar.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final EnvioMailBuscarFormImpl specificForm = (EnvioMailBuscarFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {//w  ww.j a v a 2s  .co m
        forward = mapping.findForward("buscar");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}

From source file:es.pode.administracion.presentacion.noticias.noticias.NoticiasVerNoti.java

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
        org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {
    final NoticiasVerNotiFormImpl specificForm = (NoticiasVerNotiFormImpl) form;

    org.apache.struts.action.ActionForward forward = null;

    try {// w  w w  .j ava 2 s.c o m
        forward = mapping.findForward("ver.noti");
    } catch (java.lang.Exception exception) {
        // we populate the current form with only the request parameters
        Object currentForm = request.getSession().getAttribute("form");
        // if we can't get the 'form' from the session, try from the request
        if (currentForm == null) {
            currentForm = request.getAttribute("form");
        }
        if (currentForm != null) {
            final java.util.Map parameters = new java.util.HashMap();
            for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) {
                final String name = String.valueOf(names.nextElement());
                parameters.put(name, request.getParameter(name));
            }
            try {
                org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
            } catch (java.lang.Exception populateException) {
                // ignore if we have an exception here (we just don't populate).
            }
        }
        throw exception;
    }
    request.getSession().setAttribute("form", form);

    return forward;
}