Hello all,
I'm trying to extend the example :
https://github.com/jersey/jersey/tree/master/examples/helloworld-spring-webapp
with the sseFeature.
So MyApplication.java is like this:
public class MyApplication extends ResourceConfig {
public MyApplication() {
register(SseFeature.class);
register(RequestContextFilter.class);
packages("com.example");
my web.xml is unmodified
my sse resource is
@Component
@Path("broadcast")
public class MyBroadcasterSSE {
@Inject
SerialTest serialTest; //a class annoted @Component successfully scanned by spring.
@GET
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput listenToBroadcast() {
final EventOutput eventOutput = new EventOutput();
serialTest.broadcaster.add(eventOutput);
return eventOutput;
}
my pom.xml
org.springframework
spring-web
3.2.6.RELEASE
org.glassfish.jersey.ext
jersey-spring3
org.glassfish.jersey.containers
jersey-container-servlet
org.glassfish.jersey.media
jersey-media-moxy
org.glassfish.jersey.media
jersey-media-sse
...
and my error is as the SseFeature was not registered.
janv. 30, 2014 11:08:18 AM org.glassfish.jersey.servlet.internal.ResponseWriter suspend
Avertissement: Attempt to put servlet request into asynchronous mode has failed.
Please check your servlet configuration - all Servlet instances and Servlet filters
involved
in the request processing must explicitly declare support for asynchronous request
processing.
java.lang.IllegalStateException: !asyncSupported
at org.eclipse.jetty.server.Request.startAsync(Request.java:2042)
at
org.glassfish.jersey.servlet.async.AsyncContextDelegateProviderImpl$ExtensionImpl.suspend
(AsyncContextDelegateProviderImpl.java:87)
at
org.glassfish.jersey.servlet.internal.ResponseWriter.suspend(ResponseWriter.java:120)
Originally I've wrongly made a JIRA on it but after updating my code, it doesn't work.
any idea?
https://java.net/jira/browse/JERSEY-2366
thank you