org.apache.catalina.connector.Request.getEvent()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.apache.catalina.connector.Request.getEvent方法的一些代码示例,展示了Request.getEvent的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getEvent方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:getEvent

Request.getEvent介绍

[英]Get the event associated with the request.
[中]获取与请求关联的事件。

代码示例

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
}

代码示例来源:origin: codefollower/Tomcat-Research

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
  setComet(false);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
  setComet(false);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

public void cometClose() {
  coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
  setComet(false);
}

代码示例来源:origin: org.jboss.web/jbossweb

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 {
        req.getEvent().close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(MESSAGES.eventValveSessionListenerException(), e);
      }
    }
  }
}

代码示例来源:origin: jboss.web/jbossweb

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 {
        req.getEvent().close();
      } catch (Exception e) {
        req.getWrapper().getParent().getLogger().warn(sm.getString(
            "cometConnectionManagerValve.listenerEvent"), e);
      }
    }
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Close the input buffer.
 * 
 * @throws IOException An underlying IOException occurred
 */
public void close()
  throws IOException {
  if (request.getUpgradeHandler() != null && request.isEventMode()) {
    request.getEvent().close();
  } else {
    closed = true;
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

public void lifecycleEvent(LifecycleEvent event) {
  if (event.getType() == Lifecycle.BEFORE_STOP_EVENT) {
    // FIXME: in that case, it could be useful to wait until end events are processed. Mmmm.
    // The container is getting stopped, close all current connections 
    Iterator<Request> iterator = cometRequests.iterator();
    while (iterator.hasNext()) {
      Request request = iterator.next();
      // Remove the session tracking attribute as it isn't
      // serializable or required.
      HttpSession session = request.getSession(false);
      if (session != null) {
        try {
          session.removeAttribute(cometRequestsAttribute);
        } catch (IllegalStateException e) {
          // Ignore
        }
      }
      // Close the comet connection
      try {
        request.getEvent().close();
      } catch (Exception e) {
        container.getLogger().warn(MESSAGES.eventValveExceptionDuringEvent(), e);
      }
    }
    cometRequests.clear();
  }
}

代码示例来源:origin: jboss.web/jbossweb

public void lifecycleEvent(LifecycleEvent event) {
  if (event.getType() == Lifecycle.BEFORE_STOP_EVENT) {
    // FIXME: in that case, it could be useful to wait until end events are processed. Mmmm.
    // The container is getting stopped, close all current connections 
    Iterator<Request> iterator = cometRequests.iterator();
    while (iterator.hasNext()) {
      Request request = iterator.next();
      // Remove the session tracking attribute as it isn't
      // serializable or required.
      HttpSession session = request.getSession(false);
      if (session != null) {
        try {
          session.removeAttribute(cometRequestsAttribute);
        } catch (IllegalStateException e) {
          // Ignore
        }
      }
      // Close the comet connection
      try {
        request.getEvent().close();
      } catch (Exception e) {
        container.getLogger().warn(
            sm.getString("cometConnectionManagerValve.event"),
            e);
      }
    }
    cometRequests.clear();
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void lifecycleEvent(LifecycleEvent event) {
  if (Lifecycle.BEFORE_STOP_EVENT.equals(event.getType())) {
    // The container is getting stopped, close all current connections 
    Iterator<Request> iterator = cometRequests.iterator();
    while (iterator.hasNext()) {
      Request request = iterator.next();
      // Remove the session tracking attribute as it isn't
      // serializable or required.
      HttpSession session = request.getSession(false);
      if (session != null) {
        session.removeAttribute(cometRequestsAttribute);
      }
      // Close the comet connection
      try {
        CometEventImpl cometEvent = request.getEvent();
        cometEvent.setEventType(CometEvent.EventType.END);
        cometEvent.setEventSubType(
            CometEvent.EventSubType.WEBAPP_RELOAD);
        getNext().event(request, request.getResponse(), cometEvent);
        cometEvent.close();
      } catch (Exception e) {
        container.getLogger().warn(
            sm.getString("cometConnectionManagerValve.event"),
            e);
      }
    }
    cometRequests.clear();
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
public void lifecycleEvent(LifecycleEvent event) {
  if (Lifecycle.BEFORE_STOP_EVENT.equals(event.getType())) {
    // The container is getting stopped, close all current connections 
    Iterator<Request> iterator = cometRequests.iterator();
    while (iterator.hasNext()) {
      Request request = iterator.next();
      // Remove the session tracking attribute as it isn't
      // serializable or required.
      HttpSession session = request.getSession(false);
      if (session != null) {
        session.removeAttribute(cometRequestsAttribute);
      }
      // Close the comet connection
      try {
        CometEventImpl cometEvent = request.getEvent();
        cometEvent.setEventType(CometEvent.EventType.END);
        cometEvent.setEventSubType(
            CometEvent.EventSubType.WEBAPP_RELOAD);
        getNext().event(request, request.getResponse(), cometEvent);
        cometEvent.close();
      } catch (Exception e) {
        container.getLogger().warn(
            sm.getString("cometConnectionManagerValve.event"),
            e);
      }
    }
    cometRequests.clear();
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
public void lifecycleEvent(LifecycleEvent event) {
  if (Lifecycle.BEFORE_STOP_EVENT.equals(event.getType())) {
    // The container is getting stopped, close all current connections
    Iterator<Request> iterator = cometRequests.iterator();
    while (iterator.hasNext()) {
      Request request = iterator.next();
      // Remove the session tracking attribute as it isn't
      // serializable or required.
      HttpSession session = request.getSession(false);
      if (session != null) {
        session.removeAttribute(cometRequestsAttribute);
      }
      // Close the comet connection
      try {
        CometEventImpl cometEvent = request.getEvent();
        cometEvent.setEventType(CometEvent.EventType.END);
        cometEvent.setEventSubType(
            CometEvent.EventSubType.WEBAPP_RELOAD);
        getNext().event(request, request.getResponse(), cometEvent);
        cometEvent.close();
      } catch (Exception e) {
        container.getLogger().warn(
            sm.getString("cometConnectionManagerValve.event"),
            e);
      }
    }
    cometRequests.clear();
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@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);
      }
    }
  }
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@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);
      }
    }
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@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);
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@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);
      }
    }
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@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);
      }
    }
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public void sessionDestroyed(HttpSessionEvent se) {
  // Close all Comet connections associated with this session
  ConnectionList list = (ConnectionList) se.getSession().getAttribute(
      cometRequestsAttribute);
  Request[] reqs = null;
  if (list != null) {
    reqs = list.get();
  }
  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);
      }
    }
  }
}

相关文章

Request类方法