*
* @exception IOException if an input/output error occurs
*/
+ @Override
public int getSize() throws IOException {
// Acquire the list of files in our storage directory
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void clear()
throws IOException {
*
* @exception IOException if an input/output error occurred
*/
+ @Override
public String[] keys() throws IOException {
// Acquire the list of files in our storage directory
* @exception ClassNotFoundException if a deserialization error occurs
* @exception IOException if an input/output error occurs
*/
+ @Override
public Session load(String id)
throws ClassNotFoundException, IOException {
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void remove(String id) throws IOException {
File file = file(id);
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void save(Session session) throws IOException {
// Open an output stream to the specified pathname, if any
import org.apache.catalina.Loader;
import org.apache.catalina.Session;
import org.apache.catalina.util.CustomObjectInputStream;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.tomcat.util.ExceptionUtils;
/**
*
* @exception IOException if an input/output error occurred
*/
+ @Override
public String[] keys() throws IOException {
ResultSet rst = null;
String keys[] = null;
*
* @exception IOException if an input/output error occurred
*/
+ @Override
public int getSize() throws IOException {
int size = 0;
ResultSet rst = null;
* @exception ClassNotFoundException if an error occurs
* @exception IOException if an input/output error occurred
*/
+ @Override
public Session load(String id)
throws ClassNotFoundException, IOException {
ResultSet rst = null;
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void remove(String id) throws IOException {
synchronized (this) {
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void clear() throws IOException {
synchronized (this) {
* @param session the session to be stored
* @exception IOException if an input/output error occurs
*/
+ @Override
public void save(Session session) throws IOException {
ObjectOutputStream oos = null;
ByteArrayOutputStream bos = null;
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
devRandomSource = s;
}
+ @Override
public DataInputStream run(){
try {
File f=new File( devRandomSource );
/**
* Return the Container with which this Manager is associated.
*/
+ @Override
public Container getContainer() {
return (this.container);
*
* @param container The newly associated Container
*/
+ @Override
public void setContainer(Container container) {
// De-register from the old Container (if any)
* Return the distributable flag for the sessions supported by
* this Manager.
*/
+ @Override
public boolean getDistributable() {
return (this.distributable);
*
* @param distributable The new distributable flag
*/
+ @Override
public void setDistributable(boolean distributable) {
boolean oldDistributable = this.distributable;
* the corresponding version number, in the format
* <code><description>/<version></code>.
*/
+ @Override
public String getInfo() {
return (info);
* Return the default maximum inactive interval (in seconds)
* for Sessions created by this Manager.
*/
+ @Override
public int getMaxInactiveInterval() {
return (this.maxInactiveInterval);
*
* @param interval The new default value
*/
+ @Override
public void setMaxInactiveInterval(int interval) {
int oldMaxInactiveInterval = this.maxInactiveInterval;
*
* @return The session id length
*/
+ @Override
public int getSessionIdLength() {
return (this.sessionIdLength);
*
* @param idLength The session id length
*/
+ @Override
public void setSessionIdLength(int idLength) {
int oldSessionIdLength = this.sessionIdLength;
*
* @return The count
*/
+ @Override
public int getRejectedSessions() {
return rejectedSessions;
}
*
* @return Number of sessions that have expired
*/
+ @Override
public long getExpiredSessions() {
return expiredSessions;
}
*
* @param expiredSessions Number of sessions that have expired
*/
+ @Override
public void setExpiredSessions(long expiredSessions) {
this.expiredSessions = expiredSessions;
}
/**
* Implements the Manager interface, direct call to processExpires
*/
+ @Override
public void backgroundProcess() {
count = (count + 1) % processExpiresFrequency;
if (count == 0)
*
* @param session Session to be added
*/
+ @Override
public void add(Session session) {
sessions.put(session.getIdInternal(), session);
*
* @param listener The listener to add
*/
+ @Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
* @exception IllegalStateException if a new session cannot be
* instantiated for any reason
*/
+ @Override
public Session createSession(String sessionId) {
if ((maxActiveSessions >= 0) &&
* The PersistentManager manager does not need to create session data
* because it reads it from the Store.
*/
+ @Override
public Session createEmptySession() {
return (getNewSession());
}
* @exception IOException if an input/output error occurs while
* processing this request
*/
+ @Override
public Session findSession(String id) throws IOException {
if (id == null)
* Return the set of active Sessions associated with this Manager.
* If this Manager has no active Sessions, a zero-length array is returned.
*/
+ @Override
public Session[] findSessions() {
return sessions.values().toArray(new Session[0]);
*
* @param session Session to be removed
*/
+ @Override
public void remove(Session session) {
sessions.remove(session.getIdInternal());
*
* @param listener The listener to remove
*/
+ @Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
*
* @param session The session to change the session ID for
*/
+ @Override
public void changeSessionId(Session session) {
session.setId(generateSessionId());
}
// -------------------------------------------------------- Package Methods
+ @Override
public void setSessionCounter(long sessionCounter) {
this.sessionCounter = sessionCounter;
}
*
* @return sessions created
*/
+ @Override
public long getSessionCounter() {
return sessionCounter;
}
*
* @return number of sessions active
*/
+ @Override
public int getActiveSessions() {
return sessions.size();
}
*
* @return The highest number of concurrent active sessions
*/
+ @Override
public int getMaxActive() {
return maxActive;
}
+ @Override
public void setMaxActive(int maxActive) {
synchronized (maxActiveUpdateLock) {
this.maxActive = maxActive;
* @return Longest time (in seconds) that an expired session had been
* alive.
*/
+ @Override
public int getSessionMaxAliveTime() {
return sessionMaxAliveTime;
}
* @param sessionMaxAliveTime Longest time (in seconds) that an expired
* session had been alive.
*/
+ @Override
public void setSessionMaxAliveTime(int sessionMaxAliveTime) {
this.sessionMaxAliveTime = sessionMaxAliveTime;
}
* @return Average time (in seconds) that expired sessions had been
* alive.
*/
+ @Override
public int getSessionAverageAliveTime() {
return sessionAverageAliveTime;
}
* @param sessionAverageAliveTime Average time (in seconds) that expired
* sessions had been alive.
*/
+ @Override
public void setSessionAverageAliveTime(int sessionAverageAliveTime) {
this.sessionAverageAliveTime = sessionAverageAliveTime;
}
* @param event
* The property change event that has occurred
*/
+ @Override
public void propertyChange(PropertyChangeEvent event) {
// Validate the source of this event
import org.apache.catalina.Session;
import org.apache.catalina.Store;
import org.apache.catalina.security.SecurityUtil;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
// NOOP
}
+ @Override
public Void run() throws Exception{
store.clear();
return null;
this.id = id;
}
+ @Override
public Void run() throws Exception{
store.remove(id);
return null;
this.id = id;
}
+ @Override
public Session run() throws Exception{
return store.load(id);
}
this.session = session;
}
+ @Override
public Void run() throws Exception{
store.save(session);
return null;
// NOOP
}
+ @Override
public String[] run() throws Exception{
return store.keys();
}
* class. In order to use it, a subclass must specifically call it,
* for example in the start() and/or processPersistenceChecks() methods.
*/
+ @Override
public void load() {
// Initialize our internal data structures
* class. In order to use it, a subclass must specifically call it,
* for example in the stop() and/or processPersistenceChecks() methods.
*/
+ @Override
public void unload() {
if (store == null)
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
import org.apache.catalina.Session;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.CustomObjectInputStream;
-import org.apache.catalina.util.LifecycleBase;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.ExceptionUtils;
// NOOP
}
+ @Override
public Void run() throws Exception{
doLoad();
return null;
// NOOP
}
+ @Override
public Void run() throws Exception{
doUnload();
return null;
* found during the reload
* @exception IOException if an input/output error occurs
*/
+ @Override
public void load() throws ClassNotFoundException, IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
*
* @exception IOException if an input/output error occurs
*/
+ @Override
public void unload() throws IOException {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
/**
* Start this component and implement the requirements
- * of {@link LifecycleBase#startInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* Stop this component and implement the requirements
- * of {@link LifecycleBase#stopInternal()}.
+ * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
/**
* The HTTP session context associated with this session.
*/
+ @Deprecated
protected static volatile HttpSessionContext sessionContext = null;
* Return the authentication type used to authenticate our cached
* Principal, if any.
*/
+ @Override
public String getAuthType() {
return (this.authType);
*
* @param authType The new cached authentication type
*/
+ @Override
public void setAuthType(String authType) {
String oldAuthType = this.authType;
*
* @param time The new creation time
*/
+ @Override
public void setCreationTime(long time) {
this.creationTime = time;
/**
* Return the session identifier for this session.
*/
+ @Override
public String getId() {
return (this.id);
/**
* Return the session identifier for this session.
*/
+ @Override
public String getIdInternal() {
return (this.id);
*
* @param id The new session identifier
*/
+ @Override
public void setId(String id) {
if ((this.id != null) && (manager != null))
* the corresponding version number, in the format
* <code><description>/<version></code>.
*/
+ @Override
public String getInfo() {
return (info);
* a value associated with the session, do not affect the access time.
* This one gets updated whenever a request starts.
*/
+ @Override
public long getThisAccessedTime() {
if (!isValidInternal()) {
* Return the last client access time without invalidation check
* @see #getThisAccessedTime()
*/
+ @Override
public long getThisAccessedTimeInternal() {
return (this.thisAccessedTime);
}
* a value associated with the session, do not affect the access time.
* This one gets updated whenever a request finishes.
*/
+ @Override
public long getLastAccessedTime() {
if (!isValidInternal()) {
* Return the last client access time without invalidation check
* @see #getLastAccessedTime()
*/
+ @Override
public long getLastAccessedTimeInternal() {
return (this.lastAccessedTime);
}
/**
* Return the Manager within which this Session is valid.
*/
+ @Override
public Manager getManager() {
return (this.manager);
*
* @param manager The new Manager
*/
+ @Override
public void setManager(Manager manager) {
this.manager = manager;
* before the servlet container will invalidate the session. A negative
* time indicates that the session should never time out.
*/
+ @Override
public int getMaxInactiveInterval() {
return (this.maxInactiveInterval);
*
* @param interval The new maximum interval
*/
+ @Override
public void setMaxInactiveInterval(int interval) {
this.maxInactiveInterval = interval;
*
* @param isNew The new value for the <code>isNew</code> flag
*/
+ @Override
public void setNew(boolean isNew) {
this.isNew = isNew;
* <code>Realm.authenticate()</code> calls on every request. If there
* is no current associated Principal, return <code>null</code>.
*/
+ @Override
public Principal getPrincipal() {
return (this.principal);
*
* @param principal The new Principal, or <code>null</code> if none
*/
+ @Override
public void setPrincipal(Principal principal) {
Principal oldPrincipal = this.principal;
* Return the <code>HttpSession</code> for which this object
* is the facade.
*/
+ @Override
public HttpSession getSession() {
if (facade == null){
final StandardSession fsession = this;
facade = AccessController.doPrivileged(
new PrivilegedAction<StandardSessionFacade>(){
+ @Override
public StandardSessionFacade run(){
return new StandardSessionFacade(fsession);
}
/**
* Return the <code>isValid</code> flag for this session.
*/
+ @Override
public boolean isValid() {
if (this.expiring) {
*
* @param isValid The new value for the <code>isValid</code> flag
*/
+ @Override
public void setValid(boolean isValid) {
this.isValid = isValid;
}
* should be called by the context when a request comes in for a particular
* session, even if the application does not reference it.
*/
+ @Override
public void access() {
this.thisAccessedTime = System.currentTimeMillis();
/**
* End the access.
*/
+ @Override
public void endAccess() {
isNew = false;
/**
* Add a session event listener to this component.
*/
+ @Override
public void addSessionListener(SessionListener listener) {
listeners.add(listener);
* Perform the internal processing required to invalidate this session,
* without triggering an exception if the session has already expired.
*/
+ @Override
public void expire() {
expire(true);
*
* @param name Name of the note to be returned
*/
+ @Override
public Object getNote(String name) {
return (notes.get(name));
* Return an Iterator containing the String names of all notes bindings
* that exist for this session.
*/
+ @Override
public Iterator<String> getNoteNames() {
return (notes.keySet().iterator());
* Release all object references, and initialize instance variables, in
* preparation for reuse of this object.
*/
+ @Override
public void recycle() {
// Reset the instance variables associated with this Session
*
* @param name Name of the note to be removed
*/
+ @Override
public void removeNote(String name) {
notes.remove(name);
/**
* Remove a session event listener from this component.
*/
+ @Override
public void removeSessionListener(SessionListener listener) {
listeners.remove(listener);
* @param name Name to which the object should be bound
* @param value Object to be bound to the specified name
*/
+ @Override
public void setNote(String name, Object value) {
notes.put(name, value);
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public long getCreationTime() {
if (!isValidInternal())
/**
* Return the ServletContext to which this session belongs.
*/
+ @Override
public ServletContext getServletContext() {
if (manager == null)
* replacement. It will be removed in a future version of the
* Java Servlet API.
*/
+ @Override
@Deprecated
public HttpSessionContext getSessionContext() {
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public Object getAttribute(String name) {
if (!isValidInternal())
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public Enumeration<String> getAttributeNames() {
if (!isValidInternal())
* @deprecated As of Version 2.2, this method is replaced by
* <code>getAttribute()</code>
*/
+ @Override
@Deprecated
public Object getValue(String name) {
* @deprecated As of Version 2.2, this method is replaced by
* <code>getAttributeNames()</code>
*/
+ @Override
@Deprecated
public String[] getValueNames() {
* @exception IllegalStateException if this method is called on
* an invalidated session
*/
+ @Override
public void invalidate() {
if (!isValidInternal())
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public boolean isNew() {
if (!isValidInternal())
* @deprecated As of Version 2.2, this method is replaced by
* <code>setAttribute()</code>
*/
+ @Override
@Deprecated
public void putValue(String name, Object value) {
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public void removeAttribute(String name) {
removeAttribute(name, true);
* @deprecated As of Version 2.2, this method is replaced by
* <code>removeAttribute()</code>
*/
+ @Override
@Deprecated
public void removeValue(String name) {
* @exception IllegalStateException if this method is called on an
* invalidated session
*/
+ @Override
public void setAttribute(String name, Object value) {
setAttribute(name,value,true);
}
this.cl = cl;
}
+ @Override
public Void run() {
Thread.currentThread().setContextClassLoader(cl);
return null;
* This method must return an empty <code>Enumeration</code>
* and will be removed in a future version of the API.
*/
+ @Override
@Deprecated
public Enumeration<String> getIds() {
* This method must return null and will be removed in a
* future version of the API.
*/
+ @Override
@Deprecated
public HttpSession getSession(String id) {
// ---------------------------------------------------- HttpSession Methods
+ @Override
public long getCreationTime() {
return session.getCreationTime();
}
+ @Override
public String getId() {
return session.getId();
}
+ @Override
public long getLastAccessedTime() {
return session.getLastAccessedTime();
}
+ @Override
public ServletContext getServletContext() {
// FIXME : Facade this object ?
return session.getServletContext();
}
+ @Override
public void setMaxInactiveInterval(int interval) {
session.setMaxInactiveInterval(interval);
}
+ @Override
public int getMaxInactiveInterval() {
return session.getMaxInactiveInterval();
}
/**
* @deprecated
*/
+ @Override
@Deprecated
public HttpSessionContext getSessionContext() {
return session.getSessionContext();
}
+ @Override
public Object getAttribute(String name) {
return session.getAttribute(name);
}
/**
* @deprecated
*/
+ @Override
@Deprecated
public Object getValue(String name) {
return session.getAttribute(name);
}
+ @Override
public Enumeration<String> getAttributeNames() {
return session.getAttributeNames();
}
/**
* @deprecated
*/
+ @Override
@Deprecated
public String[] getValueNames() {
return session.getValueNames();
}
+ @Override
public void setAttribute(String name, Object value) {
session.setAttribute(name, value);
}
/**
* @deprecated
*/
+ @Override
@Deprecated
public void putValue(String name, Object value) {
session.setAttribute(name, value);
}
+ @Override
public void removeAttribute(String name) {
session.removeAttribute(name);
}
/**
* @deprecated
*/
+ @Override
@Deprecated
public void removeValue(String name) {
session.removeAttribute(name);
}
+ @Override
public void invalidate() {
session.invalidate();
}
+ @Override
public boolean isNew() {
return session.isNew();
}
/**
* Return the info for this Store.
*/
+ @Override
public String getInfo() {
return(info);
}
*
* @param manager The newly associated Manager
*/
+ @Override
public void setManager(Manager manager) {
Manager oldManager = this.manager;
this.manager = manager;
/**
* Return the Manager with which the Store is associated.
*/
+ @Override
public Manager getManager() {
return(this.manager);
}
*
* @param listener a value of type 'PropertyChangeListener'
*/
+ @Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
support.addPropertyChangeListener(listener);
}
*
* @param listener The listener to remove
*/
+ @Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
}