Example usage for javax.servlet.http HttpServletRequest removeAttribute

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

Introduction

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

Prototype

public void removeAttribute(String name);

Source Link

Document

Removes an attribute from this request.

Usage

From source file:com.glaf.oa.withdrawal.web.springmvc.WithdrawalApproveController.java

@RequestMapping("/approve")
public ModelAndView approve(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");
    Withdrawal withdrawal = withdrawalService.getWithdrawal(RequestUtils.getLong(request, "withdrawalids"));

    if (withdrawal.getBrands1() != null && withdrawal.getBrands2() != null) {
        withdrawal.setBrand("MUL");
    } else if (withdrawal.getBrands1() != null && withdrawal.getBrands2() == null) {

    } else if (withdrawal.getBrands1() == null && withdrawal.getBrands2() != null) {

    }/* w  ww. j  a va2s  . com*/

    request.setAttribute("withdrawal", withdrawal);
    JSONObject rowJSON = withdrawal.toJsonObject();
    request.setAttribute("x_json", rowJSON.toJSONString());

    return new ModelAndView("/oa/withdrawal/approve_edit", modelMap);
}

From source file:info.magnolia.cms.taglibs.Include.java

/**
 *
 *//*from   w w w . j av a 2s .  co m*/
private void removeAttributes() {
    HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
    if ((attributes != null) && (attributes.size() > 0)) {
        Iterator i = attributes.iterator();
        while (i.hasNext()) {
            Object[] s = (Object[]) i.next();
            req.removeAttribute((String) s[0]);
        }
    }
    attributes = null;
}

From source file:com.glaf.oa.borrow.web.springmvc.BorrowmoneyController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Borrowmoney borrowmoney = borrowmoneyService.getBorrowmoney(RequestUtils.getLong(request, "borrowmoneyid"));
    if (borrowmoney != null) {
        request.setAttribute("borrowmoney", borrowmoney);
        JSONObject rowJSON = borrowmoney.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }//from   w w  w.  j av a2 s  .  com

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (borrowmoney != null) {
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("borrowmoney.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/borrowmoney/edit", modelMap);
}

From source file:com.glaf.oa.assessscore.web.springmvc.AssessscoreController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Assessscore assessscore = assessscoreService.getAssessscore(RequestUtils.getLong(request, "scoreid"));
    if (assessscore != null) {
        request.setAttribute("assessscore", assessscore);
        JSONObject rowJSON = assessscore.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/*w  ww .  j a  v  a  2  s .  c o  m*/

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (assessscore != null) {
            canUpdate = true;
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("assessscore.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/assessscore/edit", modelMap);
}

From source file:com.glaf.oa.borrow.web.springmvc.BorrowadderssController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Borrowadderss borrowadderss = borrowadderssService
            .getBorrowadderss(RequestUtils.getLong(request, "addressid"));
    if (borrowadderss != null) {
        request.setAttribute("borrowadderss", borrowadderss);
        JSONObject rowJSON = borrowadderss.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }//from w ww.j av  a2  s  .  c  o  m

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (borrowadderss != null) {
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("borrowadderss.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/borrowadderss/edit", modelMap);
}

From source file:com.glaf.oa.assesssort.web.springmvc.AssesssortController.java

@RequestMapping("/edit")
public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");

    Assesssort assesssort = assesssortService.getAssesssort(RequestUtils.getLong(request, "assesssortid"));
    if (assesssort != null) {
        request.setAttribute("assesssort", assesssort);
        JSONObject rowJSON = assesssort.toJsonObject();
        request.setAttribute("x_json", rowJSON.toJSONString());
    }/*from   w  ww .  ja v a  2 s.c o  m*/

    boolean canUpdate = false;
    String x_method = request.getParameter("x_method");
    if (StringUtils.equals(x_method, "submit")) {

    }

    if (StringUtils.containsIgnoreCase(x_method, "update")) {
        if (assesssort != null) {
            canUpdate = true;
        }
    }

    request.setAttribute("canUpdate", canUpdate);

    String view = request.getParameter("view");
    if (StringUtils.isNotEmpty(view)) {
        return new ModelAndView(view, modelMap);
    }

    String x_view = ViewProperties.getString("assesssort.edit");
    if (StringUtils.isNotEmpty(x_view)) {
        return new ModelAndView(x_view, modelMap);
    }

    return new ModelAndView("/oa/assesssort/edit", modelMap);
}

From source file:com.adito.core.CoreUtil.java

/**
 * Save the specified warnings messages.
 * //www  .  j  a  va  2  s  .c om
 * @param request request
 * @param warnings warnings
 */
public static void saveWarnings(HttpServletRequest request, ActionMessages warnings) {
    if ((warnings == null) || warnings.isEmpty()) {
        request.removeAttribute(Constants.REQ_ATTR_WARNINGS);
        return;
    }
    request.setAttribute(Constants.REQ_ATTR_WARNINGS, warnings);
}

From source file:org.springframework.security.config.annotation.web.builders.DebugFilter.java

private void invokeWithWrappedRequest(HttpServletRequest request, HttpServletResponse response,
        FilterChain filterChain) throws IOException, ServletException {
    request.setAttribute(ALREADY_FILTERED_ATTR_NAME, Boolean.TRUE);
    request = new DebugRequestWrapper(request);
    try {/*  ww  w . j av  a2 s  .  co m*/
        fcp.doFilter(request, response, filterChain);
    } finally {
        request.removeAttribute(ALREADY_FILTERED_ATTR_NAME);
    }
}

From source file:com.opencnc.controllers.ModeloController.java

/**
 * *****************************************************************************
 * Crea los modelos por usuario.//from  w w w. ja v a2s . c o m
 * *****************************************************************************
 * @param request
 * @param response
 * @return
 * @throws Exception 
 */
@RequestMapping("/modelo/crearModelo")
static ModelAndView crearModelo(HttpServletRequest request, HttpServletResponse response) throws Exception {

    HttpSession sess = request.getSession();
    if (sess != null) {
        Modelo md = new Modelo();
        ModelAndView m = new ModelAndView("/modelo/crearModelo");
        m.addObject("modelo", md);
        Session s = HibernateUtil.getSessionFactory().openSession();
        //Usuario us = (Usuario)request.getAttribute("usuario");
        Usuario us = (Usuario) sess.getAttribute("usuario");

        Criteria c = s.createCriteria(TipoMaquina.class);
        Criteria ma = s.createCriteria(UnidadMedida.class);
        Criteria user = s.createCriteria(Usuario.class);

        List<UnidadMedida> lm = ma.list();
        List<TipoMaquina> l = c.list();
        //List<Usuario> luser = user.list();
        Integer luser = us.getUsuarioId();

        m.addObject("listaTipoMaquina", l);
        m.addObject("listaUnidadMedida", lm);
        m.addObject("listaUsuarios", luser);
        m.addObject("nombreUsuario", us.getNombre());
        //HttpSession session = request.getSession();
        //m.addObject("numUsuarioId", us.getUsuarioId());
        return m;
    } else {
        request.removeAttribute("usuario");
        return new ModelAndView("redirect:/usuario/login.htm");
    }
}

From source file:com.glaf.oa.purchase.web.springmvc.PurchaseApproveController.java

@RequestMapping("/approve")
public ModelAndView approve(HttpServletRequest request, ModelMap modelMap) {
    RequestUtils.setRequestParameterToAttribute(request);
    request.removeAttribute("canSubmit");
    Purchase purchase = purchaseService.getPurchase(RequestUtils.getLong(request, "purchaseId"));

    request.setAttribute("purchase", purchase);
    JSONObject rowJSON = purchase.toJsonObject();
    request.setAttribute("x_json", rowJSON.toJSONString());

    return new ModelAndView("/oa/purchase/approve_edit", modelMap);
}