List of usage examples for org.springframework.web.bind ServletRequestUtils getStringParameter
@Nullable public static String getStringParameter(ServletRequest request, String name) throws ServletRequestBindingException
From source file:com.googlecode.psiprobe.controllers.apps.RemoveApplicationAttributeController.java
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String attrName = ServletRequestUtils.getStringParameter(request, "attr"); context.getServletContext().removeAttribute(attrName); return new ModelAndView( new RedirectView(request.getContextPath() + getViewName() + "?" + request.getQueryString())); }
From source file:com.googlecode.psiprobe.controllers.sessions.RemoveSessAttributeController.java
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sid = ServletRequestUtils.getStringParameter(request, "sid"); String attrName = ServletRequestUtils.getStringParameter(request, "attr"); Session session = context.getManager().findSession(sid); if (session != null) { session.getSession().removeAttribute(attrName); }//w ww. j a va 2s . c o m return new ModelAndView( new RedirectView(request.getContextPath() + getViewName() + "?" + request.getQueryString())); }
From source file:psiprobe.controllers.apps.RemoveApplicationAttributeController.java
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String attrName = ServletRequestUtils.getStringParameter(request, "attr"); context.getServletContext().removeAttribute(attrName); return new ModelAndView( new RedirectView(request.getContextPath() + getViewName() + "?" + request.getQueryString())); }
From source file:psiprobe.controllers.sessions.RemoveSessAttributeController.java
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sid = ServletRequestUtils.getStringParameter(request, "sid"); String attrName = ServletRequestUtils.getStringParameter(request, "attr"); Session session = context.getManager().findSession(sid); if (session != null) { session.getSession().removeAttribute(attrName); }//from w ww .java 2 s . c o m return new ModelAndView( new RedirectView(request.getContextPath() + getViewName() + "?" + request.getQueryString())); }
From source file:psiprobe.controllers.sessions.ExpireSessionController.java
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sessionId = ServletRequestUtils.getStringParameter(request, "sid"); Session session = context.getManager().findSession(sessionId); if (session != null) { session.expire();//w ww . ja v a 2s .c om } return new ModelAndView(new InternalResourceView(getViewName())); }
From source file:com.googlecode.psiprobe.controllers.RememberVisibilityController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String cookieName = ServletRequestUtils.getStringParameter(request, "cn"); String state = ServletRequestUtils.getStringParameter(request, "state"); if (cookieName != null && state != null) { cookieName = Functions.safeCookieName(cookieName); ///* ww w . ja v a 2 s.co m*/ // expire the cookis at the current date + 10years (roughly, nevermind leap years) // response.addHeader("Set-Cookie", cookieName + "=" + state + "; Expires=" + sdf.format(new Date(System.currentTimeMillis() + 315360000000L))); } return null; }
From source file:com.googlecode.psiprobe.controllers.sessions.ExpireSessionController.java
protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sessionID = ServletRequestUtils.getStringParameter(request, "sid"); Session session = context.getManager().findSession(sessionID); if (session != null) { session.expire();/* ww w. j a v a2s . c om*/ } return new ModelAndView(new InternalResourceView(getViewName())); }
From source file:psiprobe.controllers.RememberVisibilityController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String cookieName = ServletRequestUtils.getStringParameter(request, "cn"); String state = ServletRequestUtils.getStringParameter(request, "state"); if (cookieName != null && state != null) { cookieName = Functions.safeCookieName(cookieName); // expire the cookis at the current date + 10years (roughly, nevermind leap years) response.addHeader("Set-Cookie", cookieName + "=" + state + "; Expires=" + sdf.format(new Date(System.currentTimeMillis() + 315360000000L))); }/*from ww w . ja v a 2 s . co m*/ return null; }
From source file:psiprobe.controllers.logs.DownloadLogController.java
@Override protected ModelAndView handleLogFile(HttpServletRequest request, HttpServletResponse response, LogDestination logDest) throws Exception { boolean compressed = "true".equals(ServletRequestUtils.getStringParameter(request, "compressed")); File file = logDest.getFile(); logger.info("Sending {}{} to {} ({})", file, (compressed ? " compressed" : ""), request.getRemoteAddr(), request.getRemoteUser());/* w ww .j a va 2 s.c om*/ if (compressed) { Utils.sendCompressedFile(request, response, file); } else { Utils.sendFile(request, response, file); } return null; }
From source file:psiprobe.controllers.sessions.ListSessionAttributesController.java
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean privileged = SecurityUtils.hasAttributeValueRole(getServletContext(), request); boolean calcSize = ServletRequestUtils.getBooleanParameter(request, "size", false) && privileged; String sid = ServletRequestUtils.getStringParameter(request, "sid"); ApplicationSession appSession = ApplicationUtils .getApplicationSession(context.getManager().findSession(sid), calcSize, true); if (appSession != null) { appSession.setAllowedToViewValues(privileged); return new ModelAndView(getViewName(), "session", appSession); }/* w ww .ja v a2s. c om*/ return new ModelAndView(getViewName()); }