Search in sources :

Example 1 with CometEvent

use of org.apache.catalina.comet.CometEvent in project tomcat70 by apache.

the class ApplicationFilterChain method internalDoFilterEvent.

private void internalDoFilterEvent(CometEvent event) throws IOException, ServletException {
    // Call the next filter if there is one
    if (pos < n) {
        ApplicationFilterConfig filterConfig = filters[pos++];
        CometFilter filter = null;
        try {
            filter = (CometFilter) filterConfig.getFilter();
            if (Globals.IS_SECURITY_ENABLED) {
                final CometEvent ev = event;
                Principal principal = ev.getHttpServletRequest().getUserPrincipal();
                Object[] args = new Object[] { ev, this };
                SecurityUtil.doAsPrivilege("doFilterEvent", filter, cometClassType, args, principal);
            } else {
                filter.doFilterEvent(event, this);
            }
        /*support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                        filter, event);*/
        } catch (IOException e) {
            /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
            throw e;
        } catch (ServletException e) {
            /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
            throw e;
        } catch (RuntimeException e) {
            /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
            throw e;
        } catch (Throwable e) {
            e = ExceptionUtils.unwrapInvocationTargetException(e);
            ExceptionUtils.handleThrowable(e);
            /*if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);*/
            throw new ServletException(sm.getString("filterChain.filter"), e);
        }
        return;
    }
    // We fell off the end of the chain -- call the servlet instance
    try {
        /*
            support.fireInstanceEvent(InstanceEvent.BEFORE_SERVICE_EVENT,
                    servlet, request, response);
                    */
        if (Globals.IS_SECURITY_ENABLED) {
            final CometEvent ev = event;
            Principal principal = ev.getHttpServletRequest().getUserPrincipal();
            Object[] args = new Object[] { ev };
            SecurityUtil.doAsPrivilege("event", servlet, classTypeUsedInEvent, args, principal);
        } else {
            ((CometProcessor) servlet).event(event);
        }
    /*
            support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                    servlet, request, response);*/
    } catch (IOException e) {
        /*
            support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                    servlet, request, response, e);
                    */
        throw e;
    } catch (ServletException e) {
        /*
            support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                    servlet, request, response, e);
                    */
        throw e;
    } catch (RuntimeException e) {
        /*
            support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                    servlet, request, response, e);
                    */
        throw e;
    } catch (Throwable e) {
        ExceptionUtils.handleThrowable(e);
        /*
            support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
                    servlet, request, response, e);
                    */
        throw new ServletException(sm.getString("filterChain.servlet"), e);
    }
}
Also used : ServletException(javax.servlet.ServletException) CometProcessor(org.apache.catalina.comet.CometProcessor) CometFilter(org.apache.catalina.comet.CometFilter) CometEvent(org.apache.catalina.comet.CometEvent) IOException(java.io.IOException) Principal(java.security.Principal)

Aggregations

IOException (java.io.IOException)1 Principal (java.security.Principal)1 ServletException (javax.servlet.ServletException)1 CometEvent (org.apache.catalina.comet.CometEvent)1 CometFilter (org.apache.catalina.comet.CometFilter)1 CometProcessor (org.apache.catalina.comet.CometProcessor)1