List of usage examples for javax.servlet.http HttpSession removeAttribute
public void removeAttribute(String name);
From source file:controller.ImageCTMH.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); String mamh = session.getAttribute("mamh").toString(); session.removeAttribute("mamh"); if (!ServletFileUpload.isMultipartContent(request)) { out.println("Nothing to upload"); return;//from w ww. j av a2 s . c om } FileItemFactory itemfactory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(itemfactory); String a = ""; try { List<FileItem> items = upload.parseRequest(request); for (FileItem item : items) { String myfolder = ("asset/Images") + "/"; File uploadDir = new File( "E:/Cng ngh phn m?m/? ?n/1996Shop/ShopOnline/web/asset/Images"); File file = File.createTempFile("img", ".png", uploadDir); item.write(file); a = myfolder + file.getName(); ct.setHinhAnh(a); ct.setMaMh(Long.parseLong(mamh)); cTHinhAnhDAO.insert(ct); response.sendRedirect("CTSanPham.jsp?MaMH=" + mamh + ""); } } catch (FileUploadException e) { out.println("upload fail"); } catch (Exception ex) { } }
From source file:com.beto.test.securityinterceptor.security.MySimpleUrlAuthenticationSuccessHandler.java
protected void clearAuthenticationAttributes(HttpServletRequest request) { LOGGER.debug("clearAuthenticationAttributes method is called..."); HttpSession session = request.getSession(false); if (session == null) { return;// w ww .j av a 2 s . co m } session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION); }
From source file:be.fedict.eid.idp.sp.protocol.saml2.AbstractAuthenticationResponseServlet.java
private void clearAllSessionAttribute(HttpSession httpSession) { httpSession.removeAttribute(this.responseSessionAttribute); }
From source file:org.itracker.web.actions.admin.workflow.EditWorkflowScriptAction.java
public ActionForward execute(ActionMapping mapping, final ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ActionMessages errors = new ActionMessages(); if (!LoginUtilities.hasPermission(UserUtilities.PERMISSION_USER_ADMIN, request, response)) { return mapping.findForward("unauthorized"); }/*from w w w . java 2 s . c o m*/ if (!isTokenValid(request)) { log.debug("Invalid request token while editing workflow script."); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.transaction")); saveErrors(request, errors); return mapping.findForward("listworkflow"); } resetToken(request); try { ConfigurationService configurationService = ServletContextUtils.getItrackerServices() .getConfigurationService(); WorkflowScript workflowScript = new WorkflowScript(); WorkflowScriptForm form = (WorkflowScriptForm) actionForm; workflowScript.setId(form.getId()); workflowScript.setName(form.getName()); workflowScript.setEvent(form.getEvent()); workflowScript.setScript(form.getScript()); workflowScript.setLanguage(WorkflowScript.ScriptLanguage.valueOf(form.getLanguage())); String action = form.getAction(); if ("create".equals(action)) { workflowScript = configurationService.createWorkflowScript(workflowScript); } else if ("update".equals(action)) { workflowScript = configurationService.updateWorkflowScript(workflowScript); } if (log.isDebugEnabled()) { log.debug("updated workflowscript was: " + workflowScript); } if (workflowScript == null) { throw new Exception("Error creating/updating workflow script."); } HttpSession session = request.getSession(true); session.removeAttribute(Constants.WORKFLOW_SCRIPT_KEY); request.setAttribute("action", action); saveToken(request); return new ActionForward(mapping.findForward("listworkflow").getPath() + "?id=" + workflowScript.getId() + "&action=update"); } catch (DataAccessException dae) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.system.message", dae.getRootCause().getMessage(), "Data")); saveErrors(request, errors); return toInputForward(request, mapping); } catch (Exception e) { log.error("Exception processing form data", e); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.system")); } if (!errors.isEmpty()) { saveErrors(request, errors); } return mapping.findForward("error"); }
From source file:net.sourceforge.vulcan.web.struts.forms.ProjectImportForm.java
@Override public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); schedulerNames = ArrayUtils.EMPTY_STRING_ARRAY; labels = ArrayUtils.EMPTY_STRING_ARRAY; username = StringUtils.EMPTY;//from w w w .jav a2 s . co m password = StringUtils.EMPTY; authenticationRequired = false; final HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute("projectImportStatus"); } }
From source file:com.easysoft.jeap.controller.admin.LoginController.java
/** * //from ww w.ja v a 2s .com * @param request * @return */ @RequestMapping("/logout") public String logout(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session == null) { return "/adminthemes/default/login"; } session.removeAttribute("admin_user_key"); return "/adminthemes/default/login"; }
From source file:org.lightadmin.core.web.security.LightAdminRequestCache.java
@Override public void removeRequest(HttpServletRequest currentRequest, HttpServletResponse response) { HttpSession session = currentRequest.getSession(false); if (session != null) { logger.debug("Removing DefaultSavedRequest from session if present"); session.removeAttribute(savedRequestKey); }//w w w .jav a 2 s . c o m }
From source file:team.curise.controller.LoginController.java
@RequestMapping(value = "/logout", method = RequestMethod.POST) public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { System.out.println("logoutlogoutlogoutlogoutlogoutlogout"); HttpSession session = request.getSession(true); session.removeAttribute("account"); response.sendRedirect("login"); }
From source file:de.hybris.platform.b2bpunchoutaddon.controllers.pages.DefaultPunchOutController.java
/** * Used to create a new punch out session by authenticating a punch out user. * * @param key/* ww w . j a v a2s . c o m*/ * Secured key that have been exchanged with the punch out provider (or security hub). * @param sessionId * the hybris session ID */ @RequestMapping(value = "/punchout/cxml/session", method = RequestMethod.GET) public void handlePunchOutSession(@RequestParam final String key, @RequestParam("sid") final String sessionId, final HttpServletRequest request, final HttpServletResponse response) { final PunchOutSession punchOutSession = punchoutSessionService.loadPunchOutSession(sessionId); LOG.debug("PunchOut session: " + printSessionInfo(punchOutSession)); final String userId = cipherService.retrieveUserId(key, punchOutSession); final HttpSession session = request.getSession(); session.removeAttribute(B2bpunchoutaddonConstants.PUNCHOUT_USER); getPunchOutUserAuthenticationService().authenticate(userId, true, punchOutSession, request, response); // if user was authenticated (no exception was thrown), set the current cart with the one from the setup request session punchoutSessionService.setCurrentCartFromPunchOutSetup(sessionId); session.setAttribute(B2bpunchoutaddonConstants.PUNCHOUT_USER, userId); }
From source file:org.openmrs.module.conceptsearch.web.controller.ConceptNameEditorFormController.java
@RequestMapping(value = "/module/conceptsearch/conceptNameEditor", method = RequestMethod.GET) public void showBasicSearch(ModelMap model, WebRequest request, HttpSession session) { //display basicSearch.jsp session.removeAttribute("searchResult"); session.removeAttribute("sortResults"); session.removeAttribute("conceptSearch"); }