List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession();
From source file:com.vtxii.smallstuff.etl.filewatcher.FileWatcherController.java
@RequestMapping(value = "/restart", method = RequestMethod.GET) public @ResponseBody String handleRestartRequest(HttpServletRequest request) { Monitor monitor = (Monitor) request.getSession().getServletContext().getAttribute(ContextListener.MONITOR); logger.debug("handling restart request with monitor: {}", monitor); monitor.restart();//from w w w . j ava2s . com return monitor.getStatus(); }
From source file:com.vtxii.smallstuff.etl.filewatcher.FileWatcherController.java
@RequestMapping(value = "/stop", method = RequestMethod.GET) public @ResponseBody String handleStopRequest(HttpServletRequest request) { Monitor monitor = (Monitor) request.getSession().getServletContext().getAttribute(ContextListener.MONITOR); logger.debug("handling stop request with monitor: {}", monitor); monitor.stop();//from www. ja v a2 s.co m return monitor.getStatus(); }
From source file:com.soltec.mmc.controllers.MiCuentaController.java
@RequestMapping(value = "mi_cuenta", method = RequestMethod.GET) public String showView(ModelMap model, HttpServletRequest request) { Usuario usr = (Usuario) request.getSession().getAttribute("usuarioActual"); if (usr.getTipoCuenta().compareTo("Administrador") == 0) { Administrador admin = (Administrador) administradorService .obtenerAdministradorPorIdCuenta(usr.getIdCuenta()); request.getSession().setAttribute("cuentaInfo", admin); } else {/*from w ww .j a v a 2s . com*/ Artista artista = (Artista) artistaService.obtenerArtistaPorIdCuenta(usr.getIdCuenta()); request.getSession().setAttribute("cuentaInfo", artista); } return "mi_cuenta"; }
From source file:com.hrm.controller.RegisterController.java
/** * ?/*from ww w. j a v a 2s. c om*/ * @param delpath * @return * @throws FileNotFoundException * @throws IOException */ @RequestMapping("deleteImg") public static boolean deleteFile(HttpServletRequest request, String imgUrl) throws FileNotFoundException, IOException { int deleteStauts = 0; String url = request.getSession().getServletContext().getRealPath("/"); try { File file = new File(url + imgUrl); if (!file.exists()) { deleteStauts = 1;//? } else { if (file.delete()) { System.out.println(file.getName() + "is deleted"); deleteStauts = 1;//? } else { System.out.println("Delete failed."); } } } catch (Exception e) { System.out.println("Exception occured"); e.printStackTrace(); } if (deleteStauts == 1) { return true; } else { return false; } }
From source file:com.sslexplorer.vfs.webdav.DAVServlet.java
/** * Add the headers required for the browser to popup an authentication * dialog for a specified realm, and send the * {@link HttpServletResponse.SC_UNAUTHORIZED} HTTP response code. * /* w w w . jav a2s .c om*/ * @param request request * @param response response * @param realm realm. * @throws IOException */ public static void sendAuthorizationError(HttpServletRequest request, HttpServletResponse response, String realm) throws IOException { /* * If this is for the default realm (i.e SSL-Explorer Authentication, we * need to set up an authentication scheme */ if (realm.equals(WebDAVAuthenticationModule.DEFAULT_REALM)) { configureAuthenticationScheme(request, response); } // Configure the response if (log.isDebugEnabled()) log.debug("Sending auth request for realm " + realm); response.setHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); request.getSession().setAttribute(DAVTransaction.ATTR_EXPECTING_REALM_AUTHENTICATION, realm); }
From source file:com.controller.PanelController.java
@RequestMapping("panel.htm") public ModelAndView getPanel(HttpServletRequest request) { sesion = request.getSession(); ModelAndView mav = new ModelAndView(); String mensaje = null;/*from w ww . jav a 2 s. co m*/ if (sesion.getAttribute("usuario") == null) { mav.setViewName("login/login"); } else { sesionUser = sesion.getAttribute("usuario").toString(); if (sesion.getAttribute("tipoUsuario").toString().compareTo("Administrador") == 0) { mav.setViewName("viewsAdmin/panelAdmin"); System.out.println("el usuario es administrador"); } else { mav.setViewName("panel/panel"); } } return mav; }
From source file:com.uniquesoft.uidl.servlet.UploadServlet.java
/** * Return the list of FileItems stored in session under the provided session key. */// w w w . j av a2 s . co m @SuppressWarnings("unchecked") public static List<FileItem> getSessionFileItems(HttpServletRequest request, String sessionFilesKey) { return (List<FileItem>) request.getSession().getAttribute(sessionFilesKey); }
From source file:Controllers.LogoutController.java
@RequestMapping(method = RequestMethod.GET) public String logout(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); if (session != null) { //session.removeAttribute("username"); session.invalidate();//w w w . ja v a2 s . com } return "redirect:/index.htm"; }
From source file:no.dusken.barweb.WelcomeController.java
private void hackToMakeNullAuthPluginWork(HttpServletRequest request) { HttpSession session = request.getSession(); }
From source file:org.impalaframework.extension.mvc.annotation.collector.HttpSessionArgumentCollector.java
public Object getArgument(NativeWebRequest request, ExtendedModelMap implicitModel, TypeConverter typeConverter) {// w w w. j av a 2 s . c o m //FIXME test HttpServletRequest req = (HttpServletRequest) request.getNativeRequest(); return req.getSession(); }