@Override public void sessionDestroyed(HttpSessionEvent se) { // Close all Comet connections associated with this session Request[] reqs = (Request[]) se.getSession().getAttribute(cometRequestsAttribute); if (reqs != null) { for (int i = 0; i < reqs.length; i++) { Request req = reqs[i]; try { CometEventImpl event = req.getEvent(); event.setEventType(CometEvent.EventType.END); event.setEventSubType(CometEvent.EventSubType.SESSION_END); ((CometProcessor) req.getWrapper().getServlet()).event(event); event.close(); } catch (Exception e) { req.getWrapper().getParent().getLogger().warn(sm.getString( "cometConnectionManagerValve.listenerEvent"), e); } } } }
@Override public void sessionDestroyed(HttpSessionEvent se) { // Close all Comet connections associated with this session Request[] reqs = (Request[]) se.getSession().getAttribute(cometRequestsAttribute); if (reqs != null) { for (int i = 0; i < reqs.length; i++) { Request req = reqs[i]; try { CometEventImpl event = req.getEvent(); event.setEventType(CometEvent.EventType.END); event.setEventSubType(CometEvent.EventSubType.SESSION_END); ((CometProcessor) req.getWrapper().getServlet()).event(event); event.close(); } catch (Exception e) { req.getWrapper().getParent().getLogger() .warn(sm.getString("cometConnectionManagerValve.listenerEvent"), e); } } } }
/** * Perform work as a particular </code>Subject</code>. Here the work will be * granted to a <code>null</code> subject. * * @param methodName * the method to apply the security restriction * @param targetObject * the <code>Servlet</code> on which the method will be called. * @param targetParameterTypes * <code>Class</code> array used to instantiate a * <code>Method</code> object. * @param targetArguments * <code>Object</code> array contains the runtime parameters * instance. * @param principal * the <code>Principal</code> to which the security privilege * apply.. */ public static void doAsPrivilege(final String methodName, final Servlet targetObject, final Class<?>[] targetParameterTypes, final Object[] targetArguments, Principal principal) throws java.lang.Exception { // CometProcessor instances must not be cached as Servlet or // NoSuchMethodException will be thrown. Class<? extends Servlet> targetType = targetObject instanceof CometProcessor ? CometProcessor.class : Servlet.class; Method method = null; Method[] methodsCache = classCache.get(Servlet.class); if (methodsCache == null) { method = createMethodAndCacheIt(methodsCache, targetType, methodName, targetParameterTypes); } else { method = findMethod(methodsCache, methodName); if (method == null) { method = createMethodAndCacheIt(methodsCache, targetType, methodName, targetParameterTypes); } } execute(method, targetObject, targetArguments, principal); }
/** * Perform work as a particular </code>Subject</code>. Here the work * will be granted to a <code>null</code> subject. * * @param methodName the method to apply the security restriction * @param targetObject the <code>Servlet</code> on which the method will * be called. * @param targetParameterTypes <code>Class</code> array used to instantiate a * <code>Method</code> object. * @param targetArguments <code>Object</code> array contains the * runtime parameters instance. * @param principal the <code>Principal</code> to which the security * privilege apply.. */ public static void doAsPrivilege(final String methodName, final Servlet targetObject, final Class<?>[] targetParameterTypes, final Object[] targetArguments, Principal principal) throws java.lang.Exception{ // CometProcessor instances must not be cached as Servlet or // NoSuchMethodException will be thrown. Class<? extends Servlet> targetType = targetObject instanceof CometProcessor ? CometProcessor.class : Servlet.class; Method method = null; Method[] methodsCache = classCache.get(Servlet.class); if(methodsCache == null) { method = createMethodAndCacheIt(methodsCache, targetType, methodName, targetParameterTypes); } else { method = findMethod(methodsCache, methodName); if (method == null) { method = createMethodAndCacheIt(methodsCache, targetType, methodName, targetParameterTypes); } } execute(method, targetObject, targetArguments, principal); }