How to configure custom AtmosphereResource in Atmosphere framework

496 views Asked by At

Unable to configure Atmosphere to use custom AtmosphereResource instead of AtmosphereResourceImpl. I have tried to use init-param in Servlet configuration as defined below but it is not working.

<init-param>
    <param-name>org.atmosphere.cpr.AtmosphereResource</param-name>
    <param-value>com.sample.MyAtmosphereResource</param-value>
</init-param>
1

There are 1 answers

0
Rasekaran On BEST ANSWER

Solution for this problem is already available in atmosphere. Since the API documentation is mostly focused on how do a sample application these kind of features are not discussed properly in their documentation.

Following link has some Atmosphere annotations which can do some awesome things. http://async-io.org/apidocs/index.html?org/atmosphere/config/service/package-summary.html

Answer for this question is, Create a factory by implementing AtmosphereResourceFactory which creates Custom AtmosphereResource objects and annotate the factory as @AtmosphereResourceFactoryService. Thats all. Now you can see that the custom AtmosphereResource resource is passed to AtmosphereHandler.