2 // ========================================================================
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.server;
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpSession;
24 import org.eclipse.jetty.util.component.LifeCycle;
26 /** Session ID Manager.
27 * Manages session IDs across multiple contexts.
29 public interface SessionIdManager extends LifeCycle
32 * @param id The session ID without any cluster node extension
33 * @return True if the session ID is in use by at least one context.
35 public boolean idInUse(String id);
38 * Add a session to the list of known sessions for a given ID.
39 * @param session The session
41 public void addSession(HttpSession session);
44 * Remove session from the list of known sessions for a given ID.
47 public void removeSession(HttpSession session);
50 * Call {@link HttpSession#invalidate()} on all known sessions for the given id.
51 * @param id The session ID without any cluster node extension
53 public void invalidateAll(String id);
58 * @return the new session id
60 public String newSessionId(HttpServletRequest request,long created);
64 public String getWorkerName();
67 /* ------------------------------------------------------------ */
68 /** Get a cluster ID from a node ID.
69 * Strip node identifier from a located session ID.
71 * @return the cluster id
73 public String getClusterId(String nodeId);
75 /* ------------------------------------------------------------ */
76 /** Get a node ID from a cluster ID and a request
77 * @param clusterId The ID of the session
78 * @param request The request that for the session (or null)
79 * @return The session ID qualified with the node ID.
81 public String getNodeId(String clusterId,HttpServletRequest request);
84 /* ------------------------------------------------------------ */
85 /** Change the existing session id.
91 public void renewSessionId(String oldClusterId, String oldNodeId, HttpServletRequest request);