标签:
CometDServlet必须在web.xml中进行配置,如下:
<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.WebSocketTransport,
org.cometd.server.transport.JSONTransport,
org.cometd.server.transport.JSONPTransport
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<!--以下过滤器实现跨域资源共享规范,允许浏览器实现执行JavaScript跨域请求-->
<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>
更多内容参考:http://www.360doc.com/userhome.aspx?userid=8133713&cid=3#
标签:
原文地址:http://www.cnblogs.com/iliuyuet/p/4535807.html