Java Code Examples for org.apache.catalina.connector.Request#isComet()
The following examples show how to use
org.apache.catalina.connector.Request#isComet() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CometConnectionManagerValve.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Register requests for tracking, whenever needed. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ @Override public void invoke(Request request, Response response) throws IOException, ServletException { // Perform the request getNext().invoke(request, response); if (request.isComet() && !response.isClosed()) { // Start tracking this connection, since this is a // begin event, and Comet mode is on HttpSession session = request.getSession(true); // Track the connection for webapp reload cometRequests.add(request); // Track the connection for session expiration synchronized (session) { Request[] requests = (Request[]) session.getAttribute(cometRequestsAttribute); if (requests == null) { requests = new Request[1]; requests[0] = request; session.setAttribute(cometRequestsAttribute, requests); } else { Request[] newRequests = new Request[requests.length + 1]; for (int i = 0; i < requests.length; i++) { newRequests[i] = requests[i]; } newRequests[requests.length] = request; session.setAttribute(cometRequestsAttribute, newRequests); } } } }
Example 2
Source File: TestCometProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public void invoke(Request request, Response response) throws IOException, ServletException { CometEventImpl event = new CometEventImpl(request, response); getNext().invoke(request, response); if (request.isComet()) { Thread t = new AsyncCometCloseThread(event); t.start(); } }
Example 3
Source File: CometConnectionManagerValve.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Register requests for tracking, whenever needed. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ @Override public void invoke(Request request, Response response) throws IOException, ServletException { // Perform the request getNext().invoke(request, response); if (request.isComet() && !response.isClosed()) { // Start tracking this connection, since this is a // begin event, and Comet mode is on HttpSession session = request.getSession(true); // Track the connection for webapp reload cometRequests.add(request); // Track the connection for session expiration synchronized (session) { Request[] requests = (Request[]) session.getAttribute(cometRequestsAttribute); if (requests == null) { requests = new Request[1]; requests[0] = request; session.setAttribute(cometRequestsAttribute, requests); } else { Request[] newRequests = new Request[requests.length + 1]; for (int i = 0; i < requests.length; i++) { newRequests[i] = requests[i]; } newRequests[requests.length] = request; session.setAttribute(cometRequestsAttribute, newRequests); } } } }
Example 4
Source File: TestCometProcessor.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public void invoke(Request request, Response response) throws IOException, ServletException { CometEventImpl event = new CometEventImpl(request, response); getNext().invoke(request, response); if (request.isComet()) { Thread t = new AsyncCometCloseThread(event); t.start(); } }