Refine search
private void configureSession(Context context) { long sessionTimeout = getSessionTimeoutInMinutes(); context.setSessionTimeout((int) sessionTimeout); Boolean httpOnly = getSession().getCookie().getHttpOnly(); if (httpOnly != null) { context.setUseHttpOnly(httpOnly); } if (getSession().isPersistent()) { Manager manager = context.getManager(); if (manager == null) { manager = new StandardManager(); context.setManager(manager); } configurePersistSession(manager); } else { context.addLifecycleListener(new DisablePersistSessionListener()); } }
@Override public Void run() throws Exception{ doUnload(); return null; }
public void clearStore() { File file = file(); if (file != null && file.exists()) { deleteFile(file); } } // END SJSAS 6359401
if (log.isDebugEnabled()) log.debug(sm.getString("standardManager.unloading.debug")); log.debug(sm.getString("standardManager.unloading.nosessions")); return; // nothing to do File file = file(); if (file == null) return;
protected synchronized void stopInternal() throws LifecycleException { if (log.isDebugEnabled()) { log.debug("Stopping"); setState(LifecycleState.STOPPING); unload(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString("standardManager.managerUnload"), t); Session sessions[] = findSessions(); for (int i = 0; i < sessions.length; i++) { Session session = sessions[i];
@Override public void unload() throws IOException { if (SecurityUtil.isPackageProtectionEnabled()) { try { AccessController.doPrivileged(new PrivilegedDoUnload()); } catch (PrivilegedActionException ex){ Exception exception = ex.getException(); if (exception instanceof IOException) { throw (IOException)exception; } if (log.isDebugEnabled()) { log.debug("Unreported exception in unLoad()", exception); } } } else { doUnload(); } }
if (log.isDebugEnabled()) { log.debug("Start: Loading persisted sessions"); File file = file(); if (file == null) { return; if (log.isDebugEnabled()) { log.debug(sm.getString("standardManager.loading", pathname)); try (FileInputStream fis = new FileInputStream(file.getAbsolutePath()); BufferedInputStream bis = new BufferedInputStream(fis)) { Context c = getContext(); loader = c.getLoader(); logger = c.getLogger(); getSessionAttributeValueClassNamePattern(), getWarnOnSessionAttributeFilterFailure())) { Integer count = (Integer) ois.readObject(); int n = count.intValue(); log.debug("Loading " + n + " persisted sessions"); for (int i = 0; i < n; i++) { StandardSession session = getNewSession(); session.readObjectData(ois); session.setManager(this);
/** * Start this component and implement the requirements * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ @Override protected synchronized void startInternal() throws LifecycleException { super.startInternal(); // Load unloaded sessions, if any try { load(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.error(sm.getString("standardManager.managerLoad"), t); } setState(LifecycleState.STARTING); }
if (log.isDebugEnabled()) log.debug(sm.getString("standardManager.unloading.debug")); log.debug(sm.getString("standardManager.unloading.nosessions")); return; // nothing to do File file = file(); if (file == null) { return;
@Override public void load() throws ClassNotFoundException, IOException { if (SecurityUtil.isPackageProtectionEnabled()){ try{ AccessController.doPrivileged( new PrivilegedDoLoad() ); } catch (PrivilegedActionException ex){ Exception exception = ex.getException(); if (exception instanceof ClassNotFoundException) { throw (ClassNotFoundException)exception; } else if (exception instanceof IOException) { throw (IOException)exception; } if (log.isDebugEnabled()) { log.debug("Unreported exception in load() ", exception); } } } else { doLoad(); } }
/** * Create a new StandardManager. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createStandardManager(String parent) throws Exception { // Create a new StandardManager instance StandardManager manager = new StandardManager(); // Add the new instance to its parent component ObjectName pname = new ObjectName(parent); ContainerBase containerBase = getParentContainerFromParent(pname); if (containerBase != null) { containerBase.setManager(manager); } ObjectName oname = manager.getObjectName(); if (oname != null) { return (oname.toString()); } else { return null; } }
unload(); } catch (Throwable t) { CatalinaLogger.SESSION_LOGGER.managerUnloadFailed(t); Session sessions[] = findSessions(); for (int i = 0; i < sessions.length; i++) { Session session = sessions[i]; destroy();
File file = file(); if (file == null) return; log.debug("Loading " + n + " persisted sessions"); for (int i = 0; i < n; i++) { StandardSession session = getNewSession(); session.readObjectData(ois); session.setManager(this);
init(); generateSessionId(); if (log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "Force random number initialization completed"); load(); } catch (Throwable t) { log.log(Level.SEVERE,
@Override public Void run() throws Exception{ doLoad(); return null; } }
unload(false, isShutdown); } catch (IOException e) { log.log(Level.SEVERE, LogFacade.LOADING_SESSIONS_EXCEPTION, e); Session sessions[] = findSessions(); if (sessions != null) { for (Session session : sessions) { resetRandom(); destroy();
/** * Prepare for the beginning of active use of the public methods of this * component. This method should be called after <code>configure()</code>, * and before any of the public methods of the component are utilized. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ public void start() throws LifecycleException { if( ! initialized ) init(); // Validate and update our current component state if (started) { return; } lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; // Load unloaded sessions, if any try { load(); } catch (Throwable t) { CatalinaLogger.SESSION_LOGGER.managerLoadFailed(t); } }
/** * @param context the context to configure * @throws IOException an IO Exception * @throws ServletException a Servlet Exception */ protected void configWebApp(final Context context) throws IOException, ServletException { final String libDir = getLibDir(); final String classesDir = getClassesDir(); configJarScanner(context); WebResourceRoot resources = new StandardRoot(context); context.setResources(resources); // Declare an alternative location for the "WEB-INF/lib" dir if (libDir != null && !libDir.isEmpty()) { resources.addPreResources(new DirResourceSet(resources, Constants.WEB_INF_LIB, libDir, "/")); } // Declare an alternative location for the "WEB-INF/classes" dir if (classesDir != null && !classesDir.isEmpty()) { resources.addPreResources(new DirResourceSet(resources, Constants.WEB_INF_CLASSES, classesDir, "/")); } // Stop persistent sessions StandardManager mgr = new StandardManager(); mgr.setPathname(null); context.setManager(mgr); // Delay for requets to stop processing in milliseconds ((StandardContext) context).setUnloadDelay(10000); }
@Override protected StandardSession getNewSession() { //return a converged session only if it is managing a sipcontext if(container instanceof SipContext) { return new ConvergedStandardSession(this); } else { return super.getNewSession(); } }
File file = file(); if(file == null || !isDirectoryValidFor(file.getAbsolutePath())) { return; try { fos = new FileOutputStream(file.getAbsolutePath()); writeSessions(fos, doExpire); if(log.isLoggable(Level.FINE)) { log.log(Level.FINE, "Unloading complete");