I *was* configured to use the cross-origin filter. But only for the Comet Servlet. Is that a problem? Originally I used the default init params.
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>allowCredentials</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>
I have also tried to add this filter to my SpringSecurity chain, I used the default settings in that case. I will need to write a FilterConfig class to provide init parameters. I probably need that anyway given I've started using SpringSecurity and, at some point, I will probably need to use Filters that don't support property configuration.
Item 2:
When I revert back to my old stuff I don't see the OPTIONS request go out in firebug or chrome. I'm lost on that front:-)
Item 3:
It seems that some of my issues may be related to maxConnections/interval. My app is predicated around multiple connections from the same browser. I can explain that if you need to know why. Basically I live in many iFrames that react in various visual ways to server state pushed to the iframes. Iframes come in because of a desktop architecture we use called OWF. Ozone Widget Framework.
I've seen this behavior before when I was first getting started with comet. Our init parameters were not being honored. As soon as we went over 2 connections comet switched over to call-back polling. But it didn't run away like it does now. Now it appears to use the interval (which I thought was for long polling) for the callback polls. Before it would poll every couple seconds. We brute forced it by setting configuration parameters programmatically to 20. The most recent code looks like so:
@Bean(initMethod = "start", destroyMethod = "stop")
public BayeuxServer bayeuxServer() {
BayeuxServerImpl bean = new BayeuxServerImpl();
bean.setOption(BayeuxServerImpl.LOG_LEVEL,
cometConfiguration.getLogLevel());
bean.setOption("maxSessionsPerBrowser",
cometConfiguration.getMaxSessionsPerBrowser());
bean.setOption("allowMultiSessionsNoBrowser",
cometConfiguration.isAllowMultiSessionsNoBrowser());
bean.setOption("metaConnectDeliverOnly",
cometConfiguration.isMetaConnectDeliverOnly());
bean.setOption("multiSessionInterval",
cometConfiguration.getMultiSessionInterval());
bean.setOption("timeout", cometConfiguration.getTimeout());
bean.setOption("ws.timeout", cometConfiguration.getWsTimeout());
bean.setOption("interval", cometConfiguration.getInterval());
bean.setOption("ws.interval", cometConfiguration.getWsInterval());
bean.setOption("maxInterval", cometConfiguration.getMaxInterval());
bean.setOption("ws.maxInterval", cometConfiguration.getWsMaxInterval());
bean.setOption("maxLazyTimeout", cometConfiguration.getMaxLazyTimeout());
bean.setOption("jsonDebug", cometConfiguration.isJsonDebug());
bean.setOption("long-polling.json.metaConnectDeliverOnly",
cometConfiguration.isLongPollingJsonMetaConnectDeliverOnly());
List<String> allowedTransports = new ArrayList<String>();
allowedTransports.add("long-polling");
allowedTransports.add("callback-polling");
bean.setAllowedTransports(allowedTransports);
/*
* add dequeue listener and populate with username.
*/
bean.addListener(new BayeuxServer.SessionListener() {
public void sessionAdded(ServerSession session) {
+ SecurityUtils.getUsername());
session.addListener(new SecurityDequeueListener(SecurityUtils
.getUsername()));
}
public void sessionRemoved(ServerSession session, boolean timedout) {
}
});
/*
* Used for debug
*/
bean.addExtension(new LoggingExtension());
/*
* It looks like Ordinal coded sets get converted to an Array of longs
* somewhere along the way. So I fix this in CometdRexPublisher for now.
*/
// bean.addExtension(new RexEventEncoderExtension());
return bean;
}
The resulting logs from this look like so:
10:02:50,483 INFO 15743436:132 - - allowMultiSessionsNoBrowser=true
10:02:50,483 INFO 15743436:132 - - interval=0
10:02:50,483 INFO 15743436:132 - - jsonDebug=false
10:02:50,484 INFO 15743436:132 - - logLevel=3
10:02:50,484 INFO 15743436:132 - - long-polling.json.metaConnectDeliverOnly=false
10:02:50,484 INFO 15743436:132 - - maxInterval=15000
10:02:50,484 INFO 15743436:132 - - maxLazyTimeout=5000
10:02:50,484 INFO 15743436:132 - - maxSessionsPerBrowser=20
10:02:50,485 INFO 15743436:132 - - metaConnectDeliverOnly=false
10:02:50,485 INFO 15743436:132 - - multiSessionInterval=1500
10:02:50,485 INFO 15743436:132 - - timeout=30000
10:02:50,485 INFO 15743436:132 - - ws.interval=2500
10:02:50,485 INFO 15743436:132 - - ws.maxInterval=15000
10:02:50,485 INFO 15743436:132 - - ws.timeout=15000
10:02:50,488 INFO 15743436:109 - - Added channel /meta
10:02:50,489 INFO 15743436:109 - - Added channel /meta/handshake
10:02:50,490 INFO 15743436:109 - - Added channel /meta/connect
10:02:50,490 INFO 15743436:109 - - Added channel /meta/subscribe
10:02:50,491 INFO 15743436:109 - - Added channel /meta/unsubscribe
10:02:50,491 INFO 15743436:109 - - Added channel /meta/disconnect
10:02:50,495 INFO 15743436:109 - - Allowed Transports: [long-polling, callback-polling]
Item 4:
Given that I've put in so much work into going from 2.4 to 2.6 I really want to stay on 2.6. But I can't get it to work as it did with 2.4 even in my development environment. I'm reverting back to a mid point to make sure I didn't introduce this issue with SpringSecurity without knowing.
Item 5:
I'm trying to push for Jetty.