Java 类org.apache.catalina.comet.CometProcessor 实例源码

项目:tomcat7    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:lazycat    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:lazycat    文件:SecurityUtil.java   
/**
 * 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);
}
项目:class-guard    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:apache-tomcat-7.0.57    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:apache-tomcat-7.0.57    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:WBSAirback    文件:CometConnectionManagerValve.java   
@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);
            }
        }
    }
}
项目:tomcat7    文件:SecurityUtil.java   
/**
 * 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);
}
项目:apache-tomcat-7.0.73-with-comment    文件:SecurityUtil.java   
/**
 * 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);
}