All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.vt.middleware.ldap.servlets.LogoutServlet Maven / Gradle / Ivy

/*
  $Id: LogoutServlet.java 1330 2010-05-23 22:10:53Z dfisher $

  Copyright (C) 2003-2010 Virginia Tech.
  All rights reserved.

  SEE LICENSE FOR MORE INFORMATION

  Author:  Middleware Services
  Email:   [email protected]
  Version: $Revision: 1330 $
  Updated: $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
package edu.vt.middleware.ldap.servlets;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * LogoutServet removes the session id attribute set by the 
 * LoginServlet. The following init params can be set for this servlet:
 * edu.vt.middleware.ldap.servlets.sessionId - to remove from the session
 *
 * 

The following http params can be sent to this servlet: url - to redirect * client to after logout

* * @author Middleware Services * @version $Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $ */ public final class LogoutServlet extends CommonServlet { /** serial version uid. */ private static final long serialVersionUID = -6521700995773675507L; /** * Initialize this servlet. * * @param config ServletConfig * * @throws ServletException if an error occurs */ public void init(final ServletConfig config) throws ServletException { super.init(config); } /** * Handle all requests sent to this servlet. * * @param request HttpServletRequest * @param response HttpServletResponse * * @throws ServletException if this request cannot be serviced * @throws IOException if a response cannot be sent */ public void service( final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String url = request.getParameter(ServletConstants.URL_PARAM); if (url == null) { url = ""; } if (this.logger.isDebugEnabled()) { this.logger.debug("Received url param = " + url); } this.sessionManager.logout(request.getSession(true)); response.sendRedirect(url); if (this.logger.isDebugEnabled()) { this.logger.debug("Redirected user to " + url); } } /** * Called by the servlet container to indicate to a servlet that the servlet * is being taken out of service. */ public void destroy() { super.destroy(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy