Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  //
  //  ========================================================================
  //  Copyright (c) 1995-2012 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 java.util.Set;
 
 
 
 /* --------------------------------------------------------------------- */
Session Manager. The API required to manage sessions for a servlet context.
 
 
 /* ------------------------------------------------------------ */
 
 public interface SessionManager extends LifeCycle
 {
     /* ------------------------------------------------------------ */
    
Session cookie name. Defaults to JSESSIONID, but can be set with the org.eclipse.jetty.servlet.SessionCookie context init parameter.
 
     public final static String __SessionCookieProperty = "org.eclipse.jetty.servlet.SessionCookie";
     public final static String __DefaultSessionCookie = "JSESSIONID";
 
 
     /* ------------------------------------------------------------ */
    
Session id path parameter name. Defaults to jsessionid, but can be set with the org.eclipse.jetty.servlet.SessionIdPathParameterName context init parameter. If set to null or "none" no URL rewriting will be done.
 
     public final static String __SessionIdPathParameterNameProperty = "org.eclipse.jetty.servlet.SessionIdPathParameterName";
     public final static String __DefaultSessionIdPathParameterName = "jsessionid";
     public final static String __CheckRemoteSessionEncoding = "org.eclipse.jetty.servlet.CheckingRemoteSessionIdEncoding";
 
 
     /* ------------------------------------------------------------ */
    
Session Domain. If this property is set as a ServletContext InitParam, then it is used as the domain for session cookies. If it is not set, then no domain is specified for the session cookie.
 
     public final static String __SessionDomainProperty = "org.eclipse.jetty.servlet.SessionDomain";
     public final static String __DefaultSessionDomain = null;
 
 
     /* ------------------------------------------------------------ */
    
Session Path. If this property is set as a ServletContext InitParam, then it is used as the path for the session cookie. If it is not set, then the context path is used as the path for the cookie.
 
     public final static String __SessionPathProperty = "org.eclipse.jetty.servlet.SessionPath";
 
     /* ------------------------------------------------------------ */
    
Session Max Age. If this property is set as a ServletContext InitParam, then it is used as the max age for the session cookie. If it is not set, then a max age of -1 is used.
 
     public final static String __MaxAgeProperty = "org.eclipse.jetty.servlet.MaxAge";
 
     /* ------------------------------------------------------------ */
    
Returns the HttpSession with the given session id

Parameters:
id the session id
Returns:
the HttpSession with the corresponding id or null if no session with the given id exists
    public HttpSession getHttpSession(String id);
    /* ------------------------------------------------------------ */
    
Creates a new HttpSession.

Parameters:
request the HttpServletRequest containing the requested session id
Returns:
the new HttpSession
    /* ------------------------------------------------------------ */
    

Returns:
true if session cookies should be HTTP-only (Microsoft extension)
See also:
org.eclipse.jetty.http.HttpCookie.isHttpOnly()
    public boolean getHttpOnly();
    /* ------------------------------------------------------------ */
    

Returns:
the max period of inactivity, after which the session is invalidated, in seconds.
See also:
setMaxInactiveInterval(int)
    public int getMaxInactiveInterval();
    /* ------------------------------------------------------------ */
    
Sets the max period of inactivity, after which the session is invalidated, in seconds.

Parameters:
seconds the max inactivity period, in seconds.
See also:
getMaxInactiveInterval()
    public void setMaxInactiveInterval(int seconds);
    /* ------------------------------------------------------------ */
    
Sets the org.eclipse.jetty.server.session.SessionHandler.

Parameters:
handler the SessionHandler object
    public void setSessionHandler(SessionHandler handler);
    /* ------------------------------------------------------------ */
    
Adds an event listener for session-related events.

Parameters:
listener the session event listener to add Individual SessionManagers implementations may accept arbitrary listener types, but they are expected to at least handle HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener and HttpSessionListener.
See also:
removeEventListener(java.util.EventListener)
    public void addEventListener(EventListener listener);
    /* ------------------------------------------------------------ */
    
Removes an event listener for for session-related events.

Parameters:
listener the session event listener to remove
See also:
addEventListener(java.util.EventListener)
    public void removeEventListener(EventListener listener);
    /* ------------------------------------------------------------ */
    
Removes all event listeners for session-related events.

    public void clearEventListeners();
    /* ------------------------------------------------------------ */
    
Gets a Cookie for a session.

Parameters:
session the session to which the cookie should refer.
contextPath the context to which the cookie should be linked. The client will only send the cookie value when requesting resources under this path.
requestIsSecure whether the client is accessing the server over a secure protocol (i.e. HTTPS).
Returns:
if this SessionManager uses cookies, then this method will return a new cookie object that should be set on the client in order to link future HTTP requests with the session. If cookies are not in use, this method returns null.
    public HttpCookie getSessionCookie(HttpSession sessionString contextPathboolean requestIsSecure);
    /* ------------------------------------------------------------ */
    

Returns:
the cross context session id manager.
See also:
setSessionIdManager(org.eclipse.jetty.server.SessionIdManager)
    /* ------------------------------------------------------------ */
    

Deprecated:
use getSessionIdManager()
Returns:
the cross context session id manager.
    @Deprecated
    /* ------------------------------------------------------------ */
    
Sets the cross context session id manager

Parameters:
idManager the cross context session id manager.
See also:
getSessionIdManager()
    public void setSessionIdManager(SessionIdManager idManager);
    /* ------------------------------------------------------------ */
    

Parameters:
session the session to test for validity
Returns:
whether the given session is valid, that is, it has not been invalidated.
    public boolean isValid(HttpSession session);
    /* ------------------------------------------------------------ */
    

Parameters:
session the session object
Returns:
the unique id of the session within the cluster, extended with an optional node id.
See also:
getClusterId(javax.servlet.http.HttpSession)
    public String getNodeId(HttpSession session);
    /* ------------------------------------------------------------ */
    

Parameters:
session the session object
Returns:
the unique id of the session within the cluster (without a node id extension)
See also:
getNodeId(javax.servlet.http.HttpSession)
    public String getClusterId(HttpSession session);
    /* ------------------------------------------------------------ */
    
Called by the org.eclipse.jetty.server.session.SessionHandler when a session is first accessed by a request.

Parameters:
session the session object
secure whether the request is secure or not
Returns:
the session cookie. If not null, this cookie should be set on the response to either migrate the session or to refresh a session cookie that may expire.
See also:
complete(javax.servlet.http.HttpSession)
    public HttpCookie access(HttpSession sessionboolean secure);
    /* ------------------------------------------------------------ */
    
Called by the org.eclipse.jetty.server.session.SessionHandler when a session is last accessed by a request.

Parameters:
session the session object
See also:
access(javax.servlet.http.HttpSession,boolean)
    public void complete(HttpSession session);

    
Sets the session id URL path parameter name.

Parameters:
parameterName the URL path parameter name for session id URL rewriting (null or "none" for no rewriting).
See also:
getSessionIdPathParameterName()
getSessionIdPathParameterNamePrefix()
    public void setSessionIdPathParameterName(String parameterName);

    

Returns:
the URL path parameter name for session id URL rewriting, by default "jsessionid".
See also:
setSessionIdPathParameterName(java.lang.String)
    public String getSessionIdPathParameterName();

    

Returns:
a formatted version of getSessionIdPathParameterName(), by default ";" + sessionIdParameterName + "=", for easier lookup in URL strings.
See also:
getSessionIdPathParameterName()

Returns:
whether the session management is handled via cookies.
    public boolean isUsingCookies();
    
    

Returns:
whether the session management is handled via URLs.
    public boolean isUsingURLs();
    public void setSessionTrackingModes(Set<SessionTrackingModesessionTrackingModes);
    public SessionCookieConfig getSessionCookieConfig();
    
    

Returns:
True if absolute URLs are check for remoteness before being session encoded.
    public boolean isCheckingRemoteSessionIdEncoding();
    
    

Parameters:
remote True if absolute URLs are check for remoteness before being session encoded.
    public void setCheckingRemoteSessionIdEncoding(boolean remote);
New to GrepCode? Check out our FAQ X