cometD와 Longpolling에서 Tomcat 작업을하는 데 문제가 있습니다.CometD와 Tomcat이 긴 폴링을 사용하지 않습니다.
투표는 최소 1 초 동안 있어야하지만 모든 요청은 ms 영역에 있습니다. 서버가 ms 시간 내에 응답하지 않습니다.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.CometdServlet</servlet-class>
<init-param>
<param-name>transports</param-name>
<param-value>org.cometd.websocket.server.JSONTransport</param-value>
</init-param>
<init-param>
<param-name>allowedTransports</param-name>
<param-value>org.cometd.server.transport.LongPollingTransport</param-value>
</init-param>
<init-param>
<param-name>services</param-name>
<param-value>com.xxxxx.StockPriceService</param-value>
</init-param>
<init-param>
<param-name>timeout</param-name>
<param-value>60000</param-value>
</init-param>
<init-param>
<param-name>logLevel</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>interval</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>long-polling.multiSessionInterval</param-name>
<param-value>2000</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>initializer</servlet-name>
<servlet-class>com.xxxxx.Initializer</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>continuation</filter-name>
<filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>continuation</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>
내 치어가
8ms
dojo.j...ssed.js (Zeile 11610)
POST http://localhost:8080/chatty/cometd/connect
200 OK
4ms
dojo.j...ssed.js (Zeile 11610)
POST http://localhost:8080/chatty/cometd/connect
200 OK
2ms
dojo.j...ssed.js (Zeile 11610)
POST http://localhost:8080/chatty/cometd/connect
내 web.xml의 : 이 받는다는 전쟁 - 플러그인 을 설치 여기
내가 방화범에있어 무엇인가,451,515, org.cometd.javascript cometd - 자바 스크립트 도장 org.mortbay.jetty 부두-받는다는 - 플러그인 /<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>bayeux-api</artifactId>
<version>${cometd-version}</version>
</dependency>
<dependency>
<groupId>org.cometd.javascript</groupId>
<artifactId>cometd-javascript-dojo</artifactId>
<version>${cometd-version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-server</artifactId>
<version>${cometd-version}</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-annotations</artifactId>
<version>${cometd-version}</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-client</artifactId>
<version>${cometd-version}</version>
</dependency>
<dependency>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-websocket-jetty</artifactId>
<version>${cometd-version}</version>
<exclusions>
<exclusion>
<groupId>org.cometd.java</groupId>
<artifactId>cometd-java-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-continuation</artifactId>
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-websocket</artifactId>
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty-version}</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
</dependency>
</dependencies>
longpoll 구성에 대해 뭔가 빠졌습니까?
누군가이 코드 기반으로 긴 폴링 예제를 만들 수 있습니다. https://github.com/cometd/cometd-tutorials/tree/master/client-hello – Androidewbie