Package org.jboss.servlet.http

Examples of org.jboss.servlet.http.HttpEvent


              log.warn("No active events to resume with");
              return;
            }

            Iterator<HttpEvent> iter = activeSessEvents.iterator();
            HttpEvent et;
            transmitMessages((et = iter.next()).getHttpServletResponse(), queue);
            iter.remove();
            et.close();
          }
          catch (Exception e) {
            e.printStackTrace();
          }
        }
View Full Code Here


              log.warn("No active events to resume with");
              return;
            }

            Iterator<HttpEvent> iter = activeSessEvents.iterator();
            HttpEvent et;
            transmitMessages((et = iter.next()).getHttpServletResponse(), queue);
            iter.remove();
            et.close();
          }
          catch (Exception e) {
            e.printStackTrace();
          }
        }
View Full Code Here

     */
    public void doFilterEvent(HttpEvent event)
        throws IOException, ServletException {

        if( Globals.IS_SECURITY_ENABLED ) {
            final HttpEvent ev = event;
            try {
                java.security.AccessController.doPrivileged(
                    new java.security.PrivilegedExceptionAction() {
                        public Object run()
                            throws ServletException, IOException {
View Full Code Here

                support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
                        filter, event);
                        */

                if( Globals.IS_SECURITY_ENABLED ) {
                    final HttpEvent ev = event;
                    Principal principal =
                        ev.getHttpServletRequest().getUserPrincipal();

                    Object[] args = new Object[]{ev, this};
                    SecurityUtil.doAsPrivilege
                        ("doFilterEvent", (Filter) filter, cometClassType, args, principal);

                    args = null;
                } 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) {
                /*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 HttpEvent ev = event;
                Principal principal =
                    ev.getHttpServletRequest().getUserPrincipal();
                Object[] args = new Object[]{ ev };
                SecurityUtil.doAsPrivilege("event",
                        servlet,
                        classTypeUsedInEvent,
                        args,
View Full Code Here

                            log.warn("No active events to resume with");
                            return;
                        }

                        Iterator<HttpEvent> iter = activeSessEvents.iterator();
                        HttpEvent et;
                        transmitMessages((et = iter.next()).getHttpServletResponse(), queue);
                        iter.remove();
                        et.close();
                    }
                    catch (Exception e) {
                        e.printStackTrace();
                    }
                }
View Full Code Here

     * @throws java.io.IOException
     * @throws javax.servlet.ServletException
     */
    public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {

        HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT);

        // Comet is not enabled.
        if (event == null) {
            logger.error("HttpEvent is null, JBoss APR Not Properly installed");
            throw unableToDetectComet;
        }

        if (logger.isTraceEnabled()) {
            logger.trace("Event Type {} for {}", event.getType(), req.getRequestURL().toString());
        }

        Action action = null;
        // For now, we are just interested in HttpEvent.REA
        AtmosphereResource r = req.resource();
        if (event.getType() == HttpEvent.EventType.BEGIN) {
            action = suspended(req, res);
            if (action.type() == Action.TYPE.SUSPEND) {
                // Do nothing except setting the times out
                try {
                    if (action.timeout() != -1) {
                        event.setTimeout((int) action.timeout());
                    } else {
                        event.setTimeout(Integer.MAX_VALUE);
                    }
                    req.setAttribute(SUSPENDED, true);
                } catch (UnsupportedOperationException ex) {
                    // Swallow s Tomcat APR isn't supporting time out
                    // TODO: Must implement the same functionality using a Scheduler
                }
            } else if (action.type() == Action.TYPE.RESUME) {
                event.close();
            } else {
                event.close();
            }
        } else if (event.getType() == HttpEvent.EventType.READ) {
            // Not implemented
            logger.debug("Receiving bytes, unable to process them.");
        } else if (event.getType() == HttpEvent.EventType.EOF
                || event.getType() == HttpEvent.EventType.ERROR
                || event.getType() == HttpEvent.EventType.END) {

            if (r != null && r.isResumed()) {
                AtmosphereResourceImpl.class.cast(req.resource()).cancel();
            } else if (req.getAttribute(SUSPENDED) != null && closeConnectionOnInputStream) {
                req.setAttribute(SUSPENDED, null);
                action = cancelled(req, res);
            } else {
                event.close();
            }
        } else if (event.getType() == HttpEvent.EventType.TIMEOUT) {
            action = timedout(req, res);
            event.close();
        }
        return action;
    }
View Full Code Here

    @Override
    public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {

        Action action = super.cancelled(req, res);
        if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) {
            HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT);
            if (event == null) {
                return action;
            }
            event.close();
        }
        return action;
    }
View Full Code Here

    }

    @Override
    public AsyncSupport complete(AtmosphereResourceImpl r) {
        try {
            HttpEvent event = (HttpEvent) r.getRequest(false).getAttribute(HTTP_EVENT);
            // Resume without closing the underlying suspended connection.
            if (event != null) {
                event.close();
            }
        } catch (IOException ex) {
            logger.debug("", ex);
        }
        return this;
View Full Code Here

     */
    public void doFilterEvent(HttpEvent event)
        throws IOException, ServletException {

        if( Globals.IS_SECURITY_ENABLED ) {
            final HttpEvent ev = event;
            try {
                java.security.AccessController.doPrivileged(
                    new java.security.PrivilegedExceptionAction() {
                        public Object run()
                            throws ServletException, IOException {
View Full Code Here

                support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
                        filter, event);
                        */

                if( Globals.IS_SECURITY_ENABLED ) {
                    final HttpEvent ev = event;
                    Principal principal =
                        ev.getHttpServletRequest().getUserPrincipal();

                    Object[] args = new Object[]{ev, this};
                    SecurityUtil.doAsPrivilege
                        ("doFilterEvent", (Filter) filter, cometClassType, args, principal);

                    args = null;
                } else
                    filter.doFilterEvent(event, this);
                }

                /*support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                        filter, event);*/
                pointer--;
            } catch (IOException e) {
                pointer--;
                /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
                throw e;
            } catch (ServletException e) {
                pointer--;
                /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
                throw e;
            } catch (RuntimeException e) {
                pointer--;
                /*
                if (filter != null)
                    support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
                            filter, event, e);
                            */
                throw e;
            } catch (Throwable e) {
                pointer--;
                /*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
        Servlet servlet = wrapper.getServlet();
        pointer++;
        try {
            /*
            support.fireInstanceEvent(InstanceEvent.BEFORE_SERVICE_EVENT,
                    servlet, request, response);
                    */
            if( Globals.IS_SECURITY_ENABLED ) {
                final HttpEvent ev = event;
                Principal principal =
                    ev.getHttpServletRequest().getUserPrincipal();
                Object[] args = new Object[]{ ev };
                SecurityUtil.doAsPrivilege("event",
                        servlet,
                        classTypeUsedInEvent,
                        args,
View Full Code Here

TOP

Related Classes of org.jboss.servlet.http.HttpEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.