| // |
| // ======================================================================== |
| // Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. |
| // ------------------------------------------------------------------------ |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // and Apache License v2.0 which accompanies this distribution. |
| // |
| // The Eclipse Public License is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // The Apache License v2.0 is available at |
| // http://www.opensource.org/licenses/apache2.0.php |
| // |
| // You may elect to redistribute this code under either of these licenses. |
| // ======================================================================== |
| // |
| |
| package org.eclipse.jetty.server; |
| |
| import javax.servlet.http.HttpServletRequest; |
| |
| import org.eclipse.jetty.server.session.Session; |
| import org.eclipse.jetty.util.component.LifeCycle; |
| |
| /** Session ID Manager. |
| * Manages session IDs across multiple contexts. |
| */ |
| public interface SessionIdManager extends LifeCycle |
| { |
| /** |
| * @param id The plain session ID (ie no workername extension) |
| * @return True if the session ID is in use by at least one context. |
| */ |
| public boolean isIdInUse(String id); |
| |
| |
| /** |
| * Notify the sessionid manager that a particular session id is in use |
| * @param the session whose id is being used |
| */ |
| public void useId (Session session); |
| |
| /** |
| * Remove id |
| * @param id the plain session id (no workername extension) of the session to remove |
| * @return true if the id was removed, false otherwise |
| */ |
| public boolean removeId (String id); |
| |
| /** |
| * Invalidate all sessions on all contexts that share the same id. |
| * |
| * @param id The session ID without any cluster node extension |
| */ |
| public void expireAll(String id); |
| |
| /** |
| * Create a new Session ID. |
| * |
| * @param request the request with the sesion |
| * @param created the timestamp for when the session was created |
| * @return the new session id |
| */ |
| public String newSessionId(HttpServletRequest request,long created); |
| |
| |
| |
| public String getWorkerName(); |
| |
| |
| /* ------------------------------------------------------------ */ |
| /** Get just the session id from an id that includes the worker name |
| * as a suffix. |
| * |
| * Strip node identifier from a located session ID. |
| * @param qualifiedId the session id including the worker name |
| * @return the cluster id |
| */ |
| public String getId(String qualifiedId); |
| |
| |
| |
| /* ------------------------------------------------------------ */ |
| /** Get an extended id for a session. An extended id contains |
| * the workername as a suffix. |
| * |
| * @param id The id of the session |
| * @param request The request that for the session (or null) |
| * @return The session id qualified with the worker name |
| */ |
| public String getExtendedId(String id,HttpServletRequest request); |
| |
| |
| /* ------------------------------------------------------------ */ |
| /** Change the existing session id. |
| * |
| * @param oldId the old plain session id |
| * @param oldExtendedId the old fully qualified id |
| * @param request the request containing the session |
| */ |
| public void renewSessionId(String oldId, String oldExtendedId, HttpServletRequest request); |
| |
| |
| } |