org.apache.catalina.Store Java Examples

The following examples show how to use org.apache.catalina.Store. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersistentManagerSF.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Store the specified PersistentManager properties.
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aManager
 *            PersistentManager whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aManager,
        StoreDescription parentDesc) throws Exception {
    if (aManager instanceof PersistentManager) {
        PersistentManager manager = (PersistentManager) aManager;

        // Store nested <Store> element
        Store store = manager.getStore();
        storeElement(aWriter, indent, store);

        // Store nested <SessionIdGenerator> element
        SessionIdGenerator sessionIdGenerator = manager.getSessionIdGenerator();
        if (sessionIdGenerator != null) {
            storeElement(aWriter, indent, sessionIdGenerator);
        }

    }
}
 
Example #2
Source File: SessionFlushValve.java    From session-managers with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the store used when flushing the session
 *
 * @return the store used when flushing the session
 */
public Store getStore() {
    return this.lockTemplate.withReadLock(new LockTemplate.LockedOperation<Store>() {

        @Override
        public Store invoke() {
            return SessionFlushValve.this.store;
        }

    });
}
 
Example #3
Source File: SessionFlushValve.java    From session-managers with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the store to use when flushing the session
 *
 * @param store the store to use when flushing the session
 */
public void setStore(final Store store) {
    this.lockTemplate.withWriteLock(new LockTemplate.LockedOperation<Void>() {

        @Override
        public Void invoke() {
            SessionFlushValve.this.store = store;
            return null;
        }

    });
}
 
Example #4
Source File: PersistentManagerBase.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * @return the Store object which manages persistent Session
 * storage for this Manager.
 */
@Override
public Store getStore() {
    return this.store;
}
 
Example #5
Source File: TestPersistentManager.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Test
public void testBug62175() throws Exception {
    final PersistentManager manager = new PersistentManager();
    final AtomicInteger sessionExpireCounter = new AtomicInteger();

    Store mockStore = EasyMock.createNiceMock(Store.class);
    EasyMock.expect(mockStore.load(EasyMock.anyString())).andAnswer(new IAnswer<Session>() {

        @Override
        public Session answer() throws Throwable {
            return timedOutSession(manager, sessionExpireCounter);
        }
    }).anyTimes();

    EasyMock.replay(mockStore);

    manager.setStore(mockStore);

    Host host = new TesterHost();

    final RequestCachingSessionListener requestCachingSessionListener = new RequestCachingSessionListener();

    final Context context = new TesterContext() {

        @Override
        public Object[] getApplicationLifecycleListeners() {
            return new Object[] { requestCachingSessionListener };
        }

        @Override
        public Manager getManager() {
            return manager;
        }
    };
    context.setParent(host);

    Request req = new Request() {
        @Override
        public Context getContext() {
            return context;
        }
    };
    req.setRequestedSessionId("invalidSession");
    HttpServletRequest request = new RequestFacade(req);
    requestCachingSessionListener.request = request;

    manager.setContext(context);

    manager.start();

    Assert.assertNull(request.getSession(false));
    Assert.assertEquals(1, sessionExpireCounter.get());

}
 
Example #6
Source File: DatastoreManager.java    From tomcat-runtime with Apache License 2.0 4 votes vote down vote up
public Store getStore() {
  return this.store;
}
 
Example #7
Source File: PersistentManagerBase.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Set the Store object which will manage persistent Session
 * storage for this Manager.
 *
 * @param store the associated Store
 */
public void setStore(Store store) {
    this.store = store;
    store.setManager(this);
}
 
Example #8
Source File: PersistentManagerBase.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Set the Store object which will manage persistent Session
 * storage for this Manager.
 *
 * @param store the associated Store
 */
public void setStore(Store store) {
    this.store = store;
    store.setManager(this);

}
 
Example #9
Source File: PersistentManagerBase.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * @return the Store object which manages persistent Session
 * storage for this Manager.
 */
public Store getStore() {

    return this.store;

}
 
Example #10
Source File: PersistentManagerBase.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Set the Store object which will manage persistent Session
 * storage for this Manager.
 *
 * @param store the associated Store
 */
public void setStore(Store store) {
    this.store = store;
    store.setManager(this);
}
 
Example #11
Source File: PersistentManagerBase.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * @return the Store object which manages persistent Session
 * storage for this Manager.
 */
public Store getStore() {
    return this.store;
}
 
Example #12
Source File: DatastoreManager.java    From tomcat-runtime with Apache License 2.0 2 votes vote down vote up
/**
 * The store will be injected by Tomcat on startup.
 *
 * <p>See distributed-sessions.xml for the configuration.</p>
 */
public void setStore(Store store) {
  this.store = store;
  store.setManager(this);
}