List of usage examples for javax.servlet.http HttpServletRequest getRequestedSessionId
public String getRequestedSessionId();
From source file:it.greenvulcano.gvesb.adapter.http.utils.DumpUtils.java
public static void dump(HttpServletRequest request, StringBuffer log) throws IOException { String hN;/*from ww w . j a v a2s .c o m*/ log.append("-- DUMP HttpServletRequest START").append("\n"); log.append("Method : ").append(request.getMethod()).append("\n"); log.append("RequestedSessionId : ").append(request.getRequestedSessionId()).append("\n"); log.append("Scheme : ").append(request.getScheme()).append("\n"); log.append("IsSecure : ").append(request.isSecure()).append("\n"); log.append("Protocol : ").append(request.getProtocol()).append("\n"); log.append("ContextPath : ").append(request.getContextPath()).append("\n"); log.append("PathInfo : ").append(request.getPathInfo()).append("\n"); log.append("QueryString : ").append(request.getQueryString()).append("\n"); log.append("RequestURI : ").append(request.getRequestURI()).append("\n"); log.append("RequestURL : ").append(request.getRequestURL()).append("\n"); log.append("ContentType : ").append(request.getContentType()).append("\n"); log.append("ContentLength : ").append(request.getContentLength()).append("\n"); log.append("CharacterEncoding : ").append(request.getCharacterEncoding()).append("\n"); log.append("---- Headers START\n"); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { hN = headerNames.nextElement(); log.append("[" + hN + "]="); Enumeration<String> headers = request.getHeaders(hN); while (headers.hasMoreElements()) { log.append("[" + headers.nextElement() + "]"); } log.append("\n"); } log.append("---- Headers END\n"); log.append("---- Body START\n"); log.append(IOUtils.toString(request.getInputStream())).append("\n"); log.append("---- Body END\n"); log.append("-- DUMP HttpServletRequest END \n"); }
From source file:gov.nih.nci.caintegrator.web.SessionHelper.java
private static String getAnalysisViewerUrl(String analysisViewerType) { HttpServletRequest request = ServletActionContext.getRequest(); return getRequestBaseUrl(request) + "/" + WAR_CONTEXT_NAME + "/viewer/retrieveFile.jnlp?" + AnalysisViewerFileServlet.SESSION_PARAMETER + "=" + request.getRequestedSessionId() + "&" + AnalysisViewerFileServlet.VIEWERTYPE_PARAMETER + "=" + analysisViewerType + "&" + AnalysisViewerFileServlet.FILENAME_PARAMETER + "="; }
From source file:org.impalaframework.extension.mvc.util.RequestModelHelper.java
/** * //from w w w. ja v a 2 s .co m * @param logger * @param request */ public static void maybeDebugRequest(Log logger, HttpServletRequest request) { if (logger.isDebugEnabled()) { logger.debug("#####################################################################################"); logger.debug("---------------------------- Request details ---------------------------------------"); logger.debug("Request context path: " + request.getContextPath()); logger.debug("Request path info: " + request.getPathInfo()); logger.debug("Request path translated: " + request.getPathTranslated()); logger.debug("Request query string: " + request.getQueryString()); logger.debug("Request servlet path: " + request.getServletPath()); logger.debug("Request request URI: " + request.getRequestURI()); logger.debug("Request request URL: " + request.getRequestURL()); logger.debug("Request session ID: " + request.getRequestedSessionId()); logger.debug("------------------------------------------------ "); logger.debug("Parameters ------------------------------------- "); final Enumeration<String> parameterNames = request.getParameterNames(); Map<String, String> parameters = new TreeMap<String, String>(); while (parameterNames.hasMoreElements()) { String name = parameterNames.nextElement(); String value = request.getParameter(name); final String lowerCase = name.toLowerCase(); if (lowerCase.contains("password") || lowerCase.contains("cardnumber")) { value = "HIDDEN"; } parameters.put(name, value); } //now output final Set<String> parameterKeys = parameters.keySet(); for (String key : parameterKeys) { logger.debug(key + ": " + parameters.get(key)); } logger.debug("------------------------------------------------ "); Map<String, Object> attributes = new TreeMap<String, Object>(); logger.debug("Attributes ------------------------------------- "); final Enumeration<String> attributeNames = request.getAttributeNames(); while (attributeNames.hasMoreElements()) { String name = attributeNames.nextElement(); Object value = request.getAttribute(name); final String lowerCase = name.toLowerCase(); if (lowerCase.contains("password") || lowerCase.contains("cardnumber")) { value = "HIDDEN"; } attributes.put(name, value); } //now output final Set<String> keys = attributes.keySet(); for (String name : keys) { Object value = attributes.get(name); logger.debug(name + ": " + (value != null ? value.toString() : value)); } logger.debug("------------------------------------------------ "); logger.debug("#####################################################################################"); } else { if (logger.isInfoEnabled()) { logger.info( "#####################################################################################"); logger.info("Request query string: " + request.getQueryString()); logger.info("Request request URI: " + request.getRequestURI()); logger.info( "#####################################################################################"); } } }
From source file:gov.nih.nci.caintegrator.security.Cai2AuthenticationProcessingFilter.java
/** * {@inheritDoc}/*from ww w. j a v a 2s. com*/ */ @Override public Authentication attemptAuthentication(HttpServletRequest request) { // Based on AppScan failing because of a "Cross-Site Request Forgery" if (StringUtils.isBlank(request.getRequestedSessionId()) || !request.getRequestedSessionId().equals(request.getSession().getId())) { throw new AuthenticationServiceException("The session ID is not attached with this request."); } request.getSession().invalidate(); request.getSession(true); return super.attemptAuthentication(request); }
From source file:com.launchkey.example.springmvc.EventHandler.SessionDestroyedEventHandler.java
@Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { logout(request.getRequestedSessionId()); }
From source file:it.govpay.web.filters.SessionTimeoutFilter.java
private boolean isSessionInvalid(HttpServletRequest httpServletRequest) { boolean sessionInValid = (httpServletRequest.getRequestedSessionId() != null) && !httpServletRequest.isRequestedSessionIdValid(); return sessionInValid; }
From source file:gov.nih.nci.ncicb.cadsr.umlmodelbrowser.servlets.SessionFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, javax.servlet.ServletException { String expiredSessionJSP = filterConfig.getInitParameter("expiredSessionJSP"); HttpServletRequest httpservletrequest = (HttpServletRequest) request; HttpSession httpsession = httpservletrequest.getSession(false); if (httpsession == null && httpservletrequest.getRequestedSessionId() == null) { //This is a client accessing the first time. chain.doFilter(request, response); return;/*w ww . j a v a2s . c o m*/ } if (httpsession == null || httpservletrequest.getRequestedSessionId() == null) { ((HttpServletResponse) response).sendRedirect(httpservletrequest.getContextPath() + expiredSessionJSP); return; } else { String s = httpsession.getId(); if (s.equals(httpservletrequest.getRequestedSessionId())) { chain.doFilter(request, response); } else { ((HttpServletResponse) response) .sendRedirect(httpservletrequest.getContextPath() + expiredSessionJSP); return; } } }
From source file:be.fedict.eid.idp.webapp.SessionLoggingFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpSession httpSession = httpRequest.getSession(false); if (null != httpSession) { String sessionId = httpSession.getId(); boolean isNew = httpSession.isNew(); String clientSessionId = httpRequest.getRequestedSessionId(); LOG.debug("request URI: " + httpRequest.getRequestURI()); LOG.debug("session id: " + sessionId + "; is new: " + isNew); if (null == clientSessionId) { LOG.debug("no client session id received"); } else {/* w ww . j a va 2s. c o m*/ LOG.debug("client session id: " + clientSessionId); } } chain.doFilter(request, response); }
From source file:de.itsvs.cwtrpc.security.RpcSessionManagementFilter.java
protected boolean processUnauthenticatedRequest(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { if ((request.getRequestedSessionId() != null) && !request.isRequestedSessionIdValid()) { log.debug("Request does not contain a valid session ID"); getInvalidSessionRedirectStrategy().sendRedirect(request, response, getInvalidSessionUrl()); return false; }//from w w w . j a v a2 s.c o m return true; }
From source file:it.greenvulcano.gvesb.debug.DebuggerServlet.java
private void dump(HttpServletRequest request, StringBuffer log) throws IOException { String hN;/* w w w. j a va2s . c o m*/ log.append("-- DUMP HttpServletRequest START").append("\n"); log.append("Method : ").append(request.getMethod()).append("\n"); log.append("RequestedSessionId : ").append(request.getRequestedSessionId()).append("\n"); log.append("Scheme : ").append(request.getScheme()).append("\n"); log.append("IsSecure : ").append(request.isSecure()).append("\n"); log.append("Protocol : ").append(request.getProtocol()).append("\n"); log.append("ContextPath : ").append(request.getContextPath()).append("\n"); log.append("PathInfo : ").append(request.getPathInfo()).append("\n"); log.append("QueryString : ").append(request.getQueryString()).append("\n"); log.append("RequestURI : ").append(request.getRequestURI()).append("\n"); log.append("RequestURL : ").append(request.getRequestURL()).append("\n"); log.append("ContentType : ").append(request.getContentType()).append("\n"); log.append("ContentLength : ").append(request.getContentLength()).append("\n"); log.append("CharacterEncoding : ").append(request.getCharacterEncoding()).append("\n"); log.append("---- Headers START\n"); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { hN = headerNames.nextElement(); log.append("[" + hN + "]="); Enumeration<String> headers = request.getHeaders(hN); while (headers.hasMoreElements()) { log.append("[" + headers.nextElement() + "]"); } log.append("\n"); } log.append("---- Headers END\n"); log.append("---- Body START\n"); log.append(IOUtils.toString(request.getInputStream(), "UTF-8")).append("\n"); log.append("---- Body END\n"); log.append("-- DUMP HttpServletRequest END \n"); }