From e0cdc9fc90fc4a9be5ecba8910790906fd126e38 Mon Sep 17 00:00:00 2001 From: jfarcand Date: Thu, 9 Feb 2017 18:49:30 -0500 Subject: [PATCH] Baseline for Atmosphere 3.0.0 --- CHANGELOG.md | 38 +- .../jersey/src/main/assembly/distribution.xml | 40 - .../org/atmosphere/voidClass/VoidClass.java | 4 - assembly/pom.xml | 6 +- assembly/{cpr => runtime}/pom.xml | 0 .../src/main/assembly/distribution.xml | 0 .../org/atmosphere/voidClass/VoidClass.java | 0 assembly/websocketd/atmosphere.sh | 2 - assembly/websocketd/pom.xml | 125 --- .../atmosphere/annotation/Asynchronous.java | 78 -- .../org/atmosphere/annotation/Broadcast.java | 59 -- .../org/atmosphere/annotation/Cluster.java | 46 - .../org/atmosphere/annotation/Publish.java | 37 - .../org/atmosphere/annotation/Resume.java | 44 - .../org/atmosphere/annotation/Schedule.java | 52 - .../org/atmosphere/annotation/Subscribe.java | 66 -- .../org/atmosphere/annotation/Suspend.java | 104 -- .../container/EmbeddedWebSocketHandler.java | 161 --- .../GlassFishServ30WebSocketSupport.java | 198 ---- .../GlassFishServlet30WebSocketSupport.java | 90 -- .../container/GlassFishWebSocketHandler.java | 206 ---- .../container/GlassFishWebSocketSupport.java | 90 -- .../container/GlassFishv2CometSupport.java | 198 ---- .../container/Grizzly2CometSupport.java | 238 ----- .../container/Grizzly2WebSocketSupport.java | 189 ---- .../container/GrizzlyCometSupport.java | 204 ---- .../GrizzlyServlet30WebSocketSupport.java | 90 -- .../JBossAsyncSupportWithWebSocket.java | 136 --- .../container/JBossWebCometSupport.java | 200 ---- .../container/JBossWebSocketHandler.java | 104 -- .../container/Jetty7CometSupport.java | 163 --- .../Jetty9AsyncSupportWithWebSocket.java | 201 ---- .../container/Jetty9WebSocketHandler.java | 149 --- .../JettyAsyncSupportWithWebSocket.java | 81 -- .../container/JettyCometSupport.java | 133 --- ...ttyServlet30AsyncSupportWithWebSocket.java | 67 -- .../container/JettyWebSocketHandler.java | 119 --- .../container/JettyWebSocketUtil.java | 154 --- .../Tomcat7AsyncSupportWithWebSocket.java | 71 -- .../Tomcat7BIOSupportWithWebSocket.java | 75 -- .../container/Tomcat7CometSupport.java | 215 ---- .../Tomcat7Servlet30SupportWithWebSocket.java | 75 -- .../container/TomcatCometSupport.java | 200 ---- .../container/TomcatWebSocketHandler.java | 111 -- .../container/TomcatWebSocketUtil.java | 269 ----- .../WebLogicServlet30WithWebSocket.java | 34 - .../container/WeblogicWebSocketHandler.java | 170 --- .../container/version/Grizzly2WebSocket.java | 55 - .../container/version/GrizzlyWebSocket.java | 67 -- .../container/version/JBossWebSocket.java | 66 -- .../container/version/Jetty8WebSocket.java | 74 -- .../container/version/Jetty9WebSocket.java | 62 -- .../container/version/TomcatWebSocket.java | 106 -- .../container/version/WebLogicWebSocket.java | 62 -- .../cpr/DefaultAsyncSupportResolver.java | 336 ------ .../main/java/org/atmosphere/cpr/Meteor.java | 346 ------- .../org/atmosphere/cpr/MeteorServlet.java | 135 --- .../javax.servlet.ServletContainerInitializer | 3 - .../java/org/atmosphere/cpr/MeteorTest.java | 125 --- .../org.atmosphere.cpr.AtmosphereFramework | 2 - .../atmosphere/jersey/AtmosphereFilter.java | 976 ------------------ .../jersey/AtmosphereProviders.java | 87 -- .../AtmosphereResourceConfigurator.java | 44 - .../jersey/AtmosphereResourceInjector.java | 106 -- .../jersey/BaseInjectableProvider.java | 46 - .../org/atmosphere/jersey/Broadcastable.java | 99 -- .../jersey/BroadcasterFactoryInjector.java | 179 ---- .../jersey/BroadcasterInjector.java | 90 -- .../atmosphere/jersey/JerseyBroadcaster.java | 41 - .../atmosphere/jersey/SuspendResponse.java | 264 ----- .../jersey/util/JerseyBroadcasterUtil.java | 183 ---- .../jersey/util/JerseySimpleBroadcaster.java | 34 - .../services/jersey-server-components | 1 - .../java/org/atmosphere/jersey/BaseTest.java | 111 -- .../jersey/MappingResourceTest.java | 61 -- .../atmosphere/jersey/QueryStringTest.java | 55 - .../org/atmosphere/jersey/TestResource.java | 65 -- .../atmosphere/jersey/WriteTimeoutTest.java | 174 ---- .../src/test/resources/logback-test.xml | 17 - .../org/atmosphere/cpr/AtmosphereServlet.java | 331 ------ modules/pom.xml | 5 +- modules/runtime/pom.xml | 128 +++ .../atmosphere/annotation/AnnotationUtil.java | 16 +- .../AsyncSupportListenerServiceProcessor.java | 4 +- .../AsyncSupportServiceProcessor.java | 6 +- .../AtmosphereFrameworkServiceProcessor.java | 4 +- .../AtmosphereHandlerServiceProcessor.java | 6 +- ...AtmosphereInterceptorServiceProcessor.java | 6 +- ...sphereResourceFactoryServiceProcessor.java | 6 +- ...phereResourceListenerServiceProcessor.java | 6 +- .../AtmosphereServiceProcessor.java | 16 +- .../BroadcastFilterServiceProcessor.java | 4 +- ...dcasterCacheInspectorServiceProcessor.java | 2 +- ...oadcasterCacheListenererviceProcessor.java | 4 +- .../BroadcasterCacheServiceProcessor.java | 4 +- .../BroadcasterFactoryServiceProcessor.java | 4 +- .../BroadcasterListenerServiceProcessor.java | 6 +- .../BroadcasterServiceProcessor.java | 4 +- .../EndpointMapperServiceProcessor.java | 2 +- .../annotation/ManagedServiceProcessor.java | 10 +- .../annotation/MeteorServiceProcessor.java | 4 +- .../org/atmosphere/annotation/Processor.java | 8 +- .../UUIDProviderServiceProcessor.java | 2 +- .../WebSocketFactoryServiceProcessor.java | 2 +- .../WebSocketHandlerServiceProcessor.java | 8 +- .../WebSocketProcessorServiceProcessor.java | 2 +- .../WebSocketProtocolServiceProcessor.java | 2 +- .../cache/AbstractBroadcasterCache.java | 10 +- .../atmosphere/cache/BroadcastMessage.java | 2 +- .../cache/BroadcasterCacheInspector.java | 0 .../org/atmosphere/cache/CacheMessage.java | 4 +- .../cache/DefaultBroadcasterCache.java | 8 +- .../cache/SessionBroadcasterCache.java | 4 +- .../cache/UUIDBroadcasterCache.java | 12 +- .../client/TrackMessageSizeFilter.java | 12 +- .../client/TrackMessageSizeInterceptor.java | 30 +- .../config/ApplicationConfiguration.java | 0 .../config/AtmosphereAnnotation.java | 0 .../config/AtmosphereHandlerConfig.java | 0 .../config/AtmosphereHandlerProperty.java | 0 .../config/FrameworkConfiguration.java | 0 .../AtmosphereHandlerServiceInterceptor.java | 10 +- .../atmosphere/config/managed/Decoder.java | 0 .../atmosphere/config/managed/Encoder.java | 0 .../atmosphere/config/managed/Invoker.java | 0 .../managed/ManagedAtmosphereHandler.java | 24 +- .../managed/ManagedServiceInterceptor.java | 12 +- .../managed/MeteorServiceInterceptor.java | 8 +- .../config/managed/ServiceInterceptor.java | 20 +- .../config/managed/TypeResolver.java | 0 .../service/AsyncSupportListenerService.java | 2 +- .../config/service/AsyncSupportService.java | 2 +- .../AtmosphereFrameworkListenerService.java | 2 +- .../service/AtmosphereHandlerService.java | 34 +- .../service/AtmosphereInterceptorService.java | 6 +- .../AtmosphereResourceFactoryService.java | 2 +- .../AtmosphereResourceListenerService.java | 2 +- .../config/service/AtmosphereService.java | 38 +- .../BroadcasterCacheInspectorService.java | 0 .../BroadcasterCacheListenerService.java | 2 +- .../service/BroadcasterCacheService.java | 2 +- .../service/BroadcasterFactoryService.java | 2 +- .../service/BroadcasterFilterService.java | 2 +- .../service/BroadcasterListenerService.java | 2 +- .../config/service/BroadcasterService.java | 2 +- .../org/atmosphere/config/service/Delete.java | 0 .../atmosphere/config/service/DeliverTo.java | 0 .../atmosphere/config/service/Disconnect.java | 0 .../config/service/EndpointMapperService.java | 0 .../org/atmosphere/config/service/Get.java | 0 .../atmosphere/config/service/Heartbeat.java | 0 .../config/service/ManagedService.java | 28 +- .../atmosphere/config/service/Message.java | 2 +- .../config/service/MeteorService.java | 36 +- .../atmosphere/config/service/PathParam.java | 0 .../org/atmosphere/config/service/Post.java | 0 .../org/atmosphere/config/service/Put.java | 0 .../org/atmosphere/config/service/Ready.java | 0 .../org/atmosphere/config/service/Resume.java | 0 .../atmosphere/config/service/Singleton.java | 0 .../config/service/UUIDProviderService.java | 0 .../service/WebSocketFactoryService.java | 0 .../service/WebSocketHandlerService.java | 26 +- .../service/WebSocketProcessorService.java | 0 .../service/WebSocketProtocolService.java | 0 .../container/BlockingIOCometSupport.java | 94 +- .../container/JSR356AsyncSupport.java | 8 +- .../atmosphere/container/JSR356Endpoint.java | 12 +- .../container/NettyCometSupport.java | 20 +- .../container/Servlet30CometSupport.java | 25 +- .../container/version/JSR356WebSocket.java | 10 +- .../AbstractReflectorAtmosphereHandler.java | 30 +- .../atmosphere/handler/AnnotatedProxy.java | 8 +- .../handler/AtmosphereHandlerAdapter.java | 6 +- .../org/atmosphere/handler/OnMessage.java | 15 +- .../handler/ReflectorServletProcessor.java | 18 +- .../inject/AtmosphereConfigAware.java | 4 +- .../inject/AtmosphereConfigInjectable.java | 2 +- .../inject/AtmosphereFrameworkInjectable.java | 4 +- .../inject/AtmosphereProducers.java | 12 +- .../inject/AtmosphereRequestIntrospector.java | 4 +- .../AtmosphereResourceEventIntrospector.java | 4 +- .../AtmosphereResourceFactoryInjectable.java | 4 +- .../AtmosphereResourceIntrospector.java | 2 +- ...phereResourceSessionFactoryInjectable.java | 4 +- .../AtmosphereResponseIntrospector.java | 4 +- .../inject/BroadcasterFactoryInjectable.java | 4 +- .../inject/BroadcasterIntrospector.java | 4 +- .../org/atmosphere/inject/CDIProducer.java | 0 .../atmosphere/inject/InjectIntrospector.java | 2 +- .../inject/InjectIntrospectorAdapter.java | 4 +- .../org/atmosphere/inject/Injectable.java | 2 +- .../inject/InjectableObjectFactory.java | 20 +- .../atmosphere/inject/InjectionListener.java | 0 .../inject/MetaBroadcasterInjectable.java | 4 +- .../inject/PathParamIntrospector.java | 6 +- .../inject/PostConstructIntrospector.java | 0 .../inject/WebSocketFactoryInjectable.java | 2 +- .../inject/annotation/ApplicationScoped.java | 0 .../inject/annotation/RequestScoped.java | 0 .../interceptor/AllowInterceptor.java | 2 +- .../AndroidAtmosphereInterceptor.java | 18 +- ...tmosphereResourceLifecycleInterceptor.java | 36 +- .../AtmosphereResourceStateRecovery.java | 30 +- .../BroadcastOnPostAtmosphereInterceptor.java | 12 +- .../interceptor/CacheHeadersInterceptor.java | 22 +- .../interceptor/CorsInterceptor.java | 16 +- .../interceptor/HeartbeatInterceptor.java | 40 +- .../interceptor/IdleResourceInterceptor.java | 16 +- .../interceptor/InvokationOrder.java | 6 +- .../JSONPAtmosphereInterceptor.java | 20 +- .../interceptor/JavaScriptProtocol.java | 32 +- .../interceptor/NginxInterceptor.java | 7 +- .../OldBrowserPaddingInterceptor.java | 0 .../interceptor/OnDisconnectInterceptor.java | 16 +- .../PaddingAtmosphereInterceptor.java | 28 +- .../interceptor/SSEAtmosphereInterceptor.java | 30 +- .../SessionCreationInterceptor.java | 6 +- .../interceptor/ShiroInterceptor.java | 10 +- .../interceptor/SimpleRestInterceptor.java | 36 +- .../SuspendTrackerInterceptor.java | 20 +- .../TrackMessageSizeB64Interceptor.java | 26 +- .../WebSocketMessageSuspendInterceptor.java | 9 +- .../BroadcasterLifecyclePolicyHandler.java | 8 +- .../lifecycle/LifecycleHandler.java | 22 +- .../pool/BoundedApachePoolableProvider.java | 10 +- .../pool/PoolableBroadcasterFactory.java | 22 +- .../org/atmosphere/pool/PoolableProvider.java | 10 +- .../pool/UnboundedApachePoolableProvider.java | 6 +- .../java/org/atmosphere/runtime}/Action.java | 4 +- .../runtime}/AnnotationHandler.java | 2 +- .../runtime}/AnnotationProcessor.java | 2 +- ...onScanningServletContainerInitializer.java | 2 +- .../runtime}/ApplicationConfig.java | 360 +++---- .../runtime}/AsyncIOInterceptor.java | 2 +- .../runtime}/AsyncIOInterceptorAdapter.java | 2 +- .../atmosphere/runtime}/AsyncIOWriter.java | 2 +- .../runtime}/AsyncIOWriterAdapter.java | 2 +- .../org/atmosphere/runtime}/AsyncSupport.java | 20 +- .../runtime}/AsyncSupportListener.java | 2 +- .../runtime}/AsyncSupportListenerAdapter.java | 2 +- .../runtime}/AsyncSupportResolver.java | 2 +- .../runtime}/AsynchronousProcessor.java | 75 +- .../atmosphere/runtime}/AtmosphereConfig.java | 6 +- .../atmosphere/runtime}/AtmosphereFilter.java | 9 +- .../runtime}/AtmosphereFramework.java | 209 ++-- .../AtmosphereFrameworkInitializer.java | 6 +- .../runtime}/AtmosphereFrameworkListener.java | 12 +- .../AtmosphereFrameworkListenerAdapter.java | 4 +- .../runtime}/AtmosphereHandler.java | 4 +- .../runtime}/AtmosphereInterceptor.java | 2 +- .../AtmosphereInterceptorAdapter.java | 2 +- .../runtime}/AtmosphereInterceptorWriter.java | 2 +- .../runtime}/AtmosphereMappingException.java | 2 +- .../runtime}/AtmosphereObjectFactory.java | 2 +- .../runtime}/AtmosphereRequest.java | 2 +- .../runtime}/AtmosphereRequestImpl.java | 54 +- .../runtime}/AtmosphereResource.java | 20 +- .../runtime}/AtmosphereResourceEvent.java | 6 +- .../runtime}/AtmosphereResourceEventImpl.java | 2 +- .../AtmosphereResourceEventListener.java | 16 +- ...tmosphereResourceEventListenerAdapter.java | 2 +- .../runtime}/AtmosphereResourceFactory.java | 22 +- ...osphereResourceHeartbeatEventListener.java | 2 +- .../runtime}/AtmosphereResourceImpl.java | 33 +- .../runtime}/AtmosphereResourceListener.java | 6 +- .../AtmosphereResourceListenerAdapter.java | 2 +- .../runtime}/AtmosphereResourceSession.java | 2 +- .../AtmosphereResourceSessionFactory.java | 2 +- .../runtime}/AtmosphereResponse.java | 2 +- .../runtime}/AtmosphereResponseImpl.java | 29 +- .../runtime}/AtmosphereServlet.java | 20 +- .../runtime}/AtmosphereServletProcessor.java | 2 +- .../runtime}/AtmosphereSession.java | 2 +- .../atmosphere/runtime}/BroadcastFilter.java | 6 +- .../runtime}/BroadcastFilterAdapter.java | 2 +- .../runtime}/BroadcastFilterLifecycle.java | 2 +- .../org/atmosphere/runtime}/Broadcaster.java | 26 +- .../atmosphere/runtime}/BroadcasterCache.java | 20 +- .../runtime}/BroadcasterCacheListener.java | 4 +- .../runtime}/BroadcasterConfig.java | 14 +- .../runtime}/BroadcasterFactory.java | 20 +- .../runtime}/BroadcasterFuture.java | 2 +- .../runtime}/BroadcasterLifeCyclePolicy.java | 24 +- .../BroadcasterLifeCyclePolicyListener.java | 4 +- ...dcasterLifeCyclePolicyListenerAdapter.java | 2 +- .../runtime}/BroadcasterListener.java | 6 +- .../runtime}/BroadcasterListenerAdapter.java | 2 +- .../runtime}/ClusterBroadcastFilter.java | 2 +- .../atmosphere/runtime}/CompletionAware.java | 2 +- .../runtime}/ContainerInitializer.java | 34 +- .../runtime}/DefaultAnnotationProcessor.java | 4 +- .../runtime/DefaultAsyncSupportResolver.java | 179 ++++ .../DefaultAtmosphereResourceFactory.java | 16 +- .../DefaultAtmosphereResourceSession.java | 2 +- ...faultAtmosphereResourceSessionFactory.java | 2 +- .../runtime}/DefaultBroadcaster.java | 30 +- .../runtime}/DefaultBroadcasterFactory.java | 18 +- .../runtime}/DefaultMetaBroadcaster.java | 6 +- .../java/org/atmosphere/runtime}/Deliver.java | 2 +- .../atmosphere/runtime}/FrameworkConfig.java | 8 +- .../org/atmosphere/runtime}/HeaderConfig.java | 2 +- .../HeartbeatAtmosphereResourceEvent.java | 7 +- .../runtime}/KeepOpenStreamAware.java | 2 +- .../atmosphere/runtime}/MetaBroadcaster.java | 22 +- .../runtime}/PerRequestBroadcastFilter.java | 8 +- .../org/atmosphere/runtime}/Serializer.java | 2 +- .../atmosphere/runtime}/SessionSupport.java | 2 +- .../runtime}/SessionTimeoutRestorer.java | 2 +- .../runtime}/SessionTimeoutSupport.java | 2 +- .../org/atmosphere/runtime}/Universe.java | 26 +- .../runtime}/WebSocketProcessorFactory.java | 2 +- .../util/AbstractBroadcasterProxy.java | 18 +- .../util/AtmosphereConfigReader.java | 2 +- .../util/AtmosphereFilterChain.java | 0 .../atmosphere/util/ByteArrayAsyncWriter.java | 6 +- .../util/ChunkConcatReaderPool.java | 0 .../java/org/atmosphere/util/CookieUtil.java | 0 .../util/DefaultEndpointMapper.java | 8 +- .../atmosphere/util/DefaultUUIDProvider.java | 0 .../org/atmosphere/util/EndpointMapper.java | 5 +- .../util/ExcludeSessionBroadcaster.java | 12 +- .../org/atmosphere/util/ExecutorsFactory.java | 6 +- .../org/atmosphere/util/FakeHttpSession.java | 0 .../org/atmosphere/util/FilterConfigImpl.java | 0 .../org/atmosphere/util/ForkJoinPool.java | 2 +- .../java/org/atmosphere/util/IOUtils.java | 34 +- .../atmosphere/util/IntrospectionUtils.java | 0 .../atmosphere/util/QueryStringDecoder.java | 0 .../atmosphere/util/ReaderInputStream.java | 0 .../util/ServletContextFactory.java | 0 .../atmosphere/util/ServletProxyFactory.java | 0 .../atmosphere/util/SimpleBroadcaster.java | 20 +- .../atmosphere/util/StringEscapeUtils.java | 0 .../util/StringFilterAggregator.java | 4 +- .../atmosphere/util/ThreadLocalInvoker.java | 0 .../org/atmosphere/util/UUIDProvider.java | 0 .../main/java/org/atmosphere/util/Utils.java | 38 +- .../java/org/atmosphere/util/Version.java | 0 .../util/VoidAnnotationProcessor.java | 6 +- .../atmosphere/util/VoidExecutorService.java | 0 .../atmosphere/util/VoidServletConfig.java | 0 .../org/atmosphere/util/WebDotXmlReader.java | 4 +- .../org/atmosphere/util/XSSHtmlFilter.java | 2 +- .../atmosphere/util/analytics/FocusPoint.java | 0 ...oogleAnalytics_v1_URLBuildingStrategy.java | 0 .../util/analytics/HTTPGetMethod.java | 0 .../analytics/JGoogleAnalyticsTracker.java | 0 .../util/analytics/ModuleDetection.java | 0 .../util/analytics/URLBuildingStrategy.java | 0 .../util/annotation/AnnotationDetector.java | 40 - .../util/annotation/ClassFileBuffer.java | 0 .../util/annotation/ClassFileIterator.java | 0 .../util/annotation/FileIterator.java | 0 .../util/annotation/InputStreamIterator.java | 0 .../util/annotation/ZipFileIterator.java | 0 .../org/atmosphere/util/uri/UriComponent.java | 0 .../org/atmosphere/util/uri/UriPattern.java | 0 .../org/atmosphere/util/uri/UriTemplate.java | 0 .../util/uri/UriTemplateParser.java | 0 .../org/atmosphere/util/version.properties | 0 .../websocket/DefaultWebSocketFactory.java | 6 +- .../websocket/DefaultWebSocketProcessor.java | 54 +- .../org/atmosphere/websocket/WebSocket.java | 26 +- .../websocket/WebSocketEventListener.java | 2 +- .../WebSocketEventListenerAdapter.java | 2 +- .../websocket/WebSocketFactory.java | 2 +- .../websocket/WebSocketHandler.java | 0 .../websocket/WebSocketHandlerAdapter.java | 0 .../websocket/WebSocketHandshakeFilter.java | 6 +- .../websocket/WebSocketPingPongListener.java | 0 .../websocket/WebSocketProcessor.java | 10 +- .../websocket/WebSocketProcessorAdapter.java | 6 +- .../websocket/WebSocketProtocol.java | 15 +- .../websocket/WebSocketProtocolStream.java | 15 +- .../websocket/WebSocketStreamingHandler.java | 0 .../WebSocketStreamingHandlerAdapter.java | 0 .../websocket/protocol/EchoProtocol.java | 7 +- .../websocket/protocol/ProtocolUtil.java | 8 +- .../protocol/SimpleHttpProtocol.java | 16 +- .../protocol/StreamingHttpProtocol.java | 16 +- .../javax.servlet.ServletContainerInitializer | 3 + .../org.atmosphere.inject.CDIProducer | 0 .../services/org.atmosphere.inject.Injectable | 0 .../resources/atmosphere-web.xml.template | 2 +- .../src/main/resources/atmosphere.xml | 52 +- .../main/resources/atmosphere.xml.template | 0 .../src/main/resources/context.xml | 0 .../annotation/EncoderDecoderTest.java | 26 +- .../ManagedAtmosphereHandlerTest.java | 52 +- .../cache/ManagedAtmosphereHandlerTest.java | 18 +- .../custom/CustomAnnotationTest.java | 20 +- .../atmosphere/annotation/path/PathTest.java | 30 +- .../scanning/AnnotationScanningTest.java | 20 +- .../version/JSR356WebSocketTest.java | 2 +- .../SSEAtmosphereInterceptorTest.java | 29 +- .../SimpleRestInterceptorTest.java | 6 +- .../runtime}/AsyncIOInterceptorTest.java | 8 +- .../runtime}/AtmosphereFrameworkTest.java | 56 +- .../runtime}/AtmosphereHandlerTest.java | 6 +- .../runtime}/AtmosphereInterceptorTest.java | 2 +- .../AtmosphereInterceptorWriterTest.java | 6 +- .../runtime}/AtmosphereRequestTest.java | 2 +- .../AtmosphereResourceFactoryTest.java | 2 +- .../AtmosphereResourceListenerTest.java | 2 +- .../AtmosphereResourceStateRecoveryTest.java | 2 +- .../runtime}/AtmosphereResourceTest.java | 17 +- .../runtime}/AtmosphereSessionTest.java | 2 +- .../runtime}/BroadcastFilterTest.java | 14 +- .../runtime}/BroadcasterCacheTest.java | 6 +- .../BroadcasterLifecyclePolicyTest.java | 2 +- .../runtime}/BroadcasterListenerTest.java | 2 +- .../atmosphere/runtime}/BroadcasterTest.java | 38 +- .../runtime}/ConcurrentBroadcasterTest.java | 10 +- .../org/atmosphere/runtime}/CookieTest.java | 2 +- .../DefaultAsyncSupportResolverTest.java | 30 +- ...tAtmosphereResourceSessionFactoryTest.java | 2 +- .../DefaultBroadcasterFactoryTest.java | 4 +- .../runtime}/DefaultBroadcasterTest.java | 8 +- .../ExcludeSessionBroadcasterTest.java | 6 +- .../runtime}/MetaBroadcasterTest.java | 4 +- .../PoolableBroadcasterFactoryTest.java | 2 +- .../atmosphere/runtime}/QueryStringTest.java | 3 +- .../org/atmosphere/runtime}/ServiceTest.java | 2 +- .../org/atmosphere/runtime}/SessionTest.java | 4 +- .../TrackMessageSizeInterceptorTest.java | 2 +- .../runtime}/UUIDBroadcasterCacheTest.java | 6 +- .../atmosphere/runtime}/UrlMappingTest.java | 2 +- .../runtime}/WebSocketFactoryTest.java | 2 +- .../runtime}/WebSocketHandlerTest.java | 4 +- .../runtime}/WebSocketProcessorTest.java | 6 +- .../WebSocketStreamingHandlerTest.java | 4 +- .../atmosphere/runtime}/WriteTimeoutTest.java | 11 +- .../util/ChunkConcatReaderPoolTest.java | 0 .../org/atmosphere/util/CookieUtilTest.java | 0 .../java/org/atmosphere/util/IOUtilsTest.java | 0 .../atmosphere/websocket/WebSocketTest.java | 8 +- .../org.atmosphere.cpr.AtmosphereFramework | 2 + .../src/test/resources/logback-test.xml | 0 pom.xml | 95 +- 440 files changed, 2002 insertions(+), 11491 deletions(-) delete mode 100644 assembly/jersey/src/main/assembly/distribution.xml delete mode 100644 assembly/jersey/src/main/java/org/atmosphere/voidClass/VoidClass.java rename assembly/{cpr => runtime}/pom.xml (100%) rename assembly/{cpr => runtime}/src/main/assembly/distribution.xml (100%) rename assembly/{cpr => runtime}/src/main/java/org/atmosphere/voidClass/VoidClass.java (100%) delete mode 100755 assembly/websocketd/atmosphere.sh delete mode 100644 assembly/websocketd/pom.xml delete mode 100644 modules/annotations/src/main/java/org/atmosphere/annotation/Asynchronous.java delete mode 100755 modules/annotations/src/main/java/org/atmosphere/annotation/Broadcast.java delete mode 100755 modules/annotations/src/main/java/org/atmosphere/annotation/Cluster.java delete mode 100644 modules/annotations/src/main/java/org/atmosphere/annotation/Publish.java delete mode 100755 modules/annotations/src/main/java/org/atmosphere/annotation/Resume.java delete mode 100755 modules/annotations/src/main/java/org/atmosphere/annotation/Schedule.java delete mode 100644 modules/annotations/src/main/java/org/atmosphere/annotation/Subscribe.java delete mode 100755 modules/annotations/src/main/java/org/atmosphere/annotation/Suspend.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/EmbeddedWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GlassFishServ30WebSocketSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GlassFishServlet30WebSocketSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GlassFishv2CometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Grizzly2CometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Grizzly2WebSocketSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GrizzlyCometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/GrizzlyServlet30WebSocketSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JBossAsyncSupportWithWebSocket.java delete mode 100755 modules/cpr/src/main/java/org/atmosphere/container/JBossWebCometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JBossWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Jetty7CometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Jetty9AsyncSupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Jetty9WebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JettyAsyncSupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JettyCometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JettyServlet30AsyncSupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketUtil.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Tomcat7AsyncSupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Tomcat7BIOSupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/Tomcat7Servlet30SupportWithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/TomcatCometSupport.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketUtil.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/WebLogicServlet30WithWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/WeblogicWebSocketHandler.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/Grizzly2WebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/GrizzlyWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/JBossWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/Jetty8WebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/Jetty9WebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/TomcatWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/container/version/WebLogicWebSocket.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAsyncSupportResolver.java delete mode 100755 modules/cpr/src/main/java/org/atmosphere/cpr/Meteor.java delete mode 100644 modules/cpr/src/main/java/org/atmosphere/cpr/MeteorServlet.java delete mode 100644 modules/cpr/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer delete mode 100644 modules/cpr/src/test/java/org/atmosphere/cpr/MeteorTest.java delete mode 100644 modules/cpr/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework delete mode 100755 modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereFilter.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereProviders.java delete mode 100755 modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceConfigurator.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceInjector.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/BaseInjectableProvider.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/Broadcastable.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterFactoryInjector.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterInjector.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/JerseyBroadcaster.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/SuspendResponse.java delete mode 100644 modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseyBroadcasterUtil.java delete mode 100755 modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseySimpleBroadcaster.java delete mode 100644 modules/jersey/src/main/resources/META-INF/services/jersey-server-components delete mode 100644 modules/jersey/src/test/java/org/atmosphere/jersey/BaseTest.java delete mode 100644 modules/jersey/src/test/java/org/atmosphere/jersey/MappingResourceTest.java delete mode 100644 modules/jersey/src/test/java/org/atmosphere/jersey/QueryStringTest.java delete mode 100644 modules/jersey/src/test/java/org/atmosphere/jersey/TestResource.java delete mode 100644 modules/jersey/src/test/java/org/atmosphere/jersey/WriteTimeoutTest.java delete mode 100755 modules/jersey/src/test/resources/logback-test.xml delete mode 100644 modules/native/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java create mode 100644 modules/runtime/pom.xml rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AnnotationUtil.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java (89%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java (90%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/Processor.java (74%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/BroadcastMessage.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/BroadcasterCacheInspector.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/CacheMessage.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java (88%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/ApplicationConfiguration.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/AtmosphereAnnotation.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/AtmosphereHandlerConfig.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/AtmosphereHandlerProperty.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/FrameworkConfiguration.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/Decoder.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/Encoder.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/Invoker.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java (84%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/managed/TypeResolver.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AsyncSupportService.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java (68%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java (79%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/AtmosphereService.java (70%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterCacheInspectorService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/BroadcasterService.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Delete.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/DeliverTo.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Disconnect.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/EndpointMapperService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Get.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Heartbeat.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/ManagedService.java (77%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Message.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/MeteorService.java (65%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/PathParam.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Post.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Put.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Ready.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Resume.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/Singleton.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/UUIDProviderService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/WebSocketFactoryService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java (72%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/WebSocketProcessorService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/config/service/WebSocketProtocolService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java (57%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/JSR356Endpoint.java (97%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/NettyCometSupport.java (83%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/Servlet30CometSupport.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/handler/AnnotatedProxy.java (80%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java (89%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/handler/OnMessage.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereProducers.java (85%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java (97%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/CDIProducer.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/InjectIntrospector.java (97%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/Injectable.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/InjectionListener.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/PathParamIntrospector.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/PostConstructIntrospector.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/annotation/ApplicationScoped.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/inject/annotation/RequestScoped.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java (77%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java (85%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java (83%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java (88%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/InvokationOrder.java (82%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java (89%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java (89%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java (88%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/OldBrowserPaddingInterceptor.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java (96%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java (79%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java (82%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java (82%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java (90%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java (89%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java (85%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/pool/PoolableProvider.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/Action.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AnnotationHandler.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AnnotationProcessor.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AnnotationScanningServletContainerInitializer.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/ApplicationConfig.java (70%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncIOInterceptor.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncIOInterceptorAdapter.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncIOWriter.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncIOWriterAdapter.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncSupport.java (72%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncSupportListener.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncSupportListenerAdapter.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsyncSupportResolver.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AsynchronousProcessor.java (91%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereConfig.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereFilter.java (90%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereFramework.java (94%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereFrameworkInitializer.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereFrameworkListener.java (76%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereFrameworkListenerAdapter.java (90%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereHandler.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereInterceptor.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereInterceptorAdapter.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereInterceptorWriter.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereMappingException.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereObjectFactory.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereRequest.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereRequestImpl.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResource.java (92%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceEvent.java (95%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceEventImpl.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceEventListener.java (80%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceEventListenerAdapter.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceFactory.java (90%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceHeartbeatEventListener.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceImpl.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceListener.java (82%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceListenerAdapter.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceSession.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResourceSessionFactory.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResponse.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereResponseImpl.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereServlet.java (94%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereServletProcessor.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/AtmosphereSession.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcastFilter.java (93%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcastFilterAdapter.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcastFilterLifecycle.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/Broadcaster.java (91%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterCache.java (88%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterCacheListener.java (91%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterConfig.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterFactory.java (87%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterFuture.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterLifeCyclePolicy.java (79%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterLifeCyclePolicyListener.java (86%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterLifeCyclePolicyListenerAdapter.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterListener.java (94%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/BroadcasterListenerAdapter.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/ClusterBroadcastFilter.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/CompletionAware.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/ContainerInitializer.java (73%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultAnnotationProcessor.java (99%) create mode 100644 modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAsyncSupportResolver.java rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultAtmosphereResourceFactory.java (95%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultAtmosphereResourceSession.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultAtmosphereResourceSessionFactory.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultBroadcaster.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultBroadcasterFactory.java (93%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/DefaultMetaBroadcaster.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/Deliver.java (99%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/FrameworkConfig.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/HeaderConfig.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/HeartbeatAtmosphereResourceEvent.java (78%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/KeepOpenStreamAware.java (96%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/MetaBroadcaster.java (90%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/PerRequestBroadcastFilter.java (83%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/Serializer.java (97%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/SessionSupport.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/SessionTimeoutRestorer.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/SessionTimeoutSupport.java (98%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/Universe.java (80%) rename modules/{cpr/src/main/java/org/atmosphere/cpr => runtime/src/main/java/org/atmosphere/runtime}/WebSocketProcessorFactory.java (99%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java (90%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java (99%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/AtmosphereFilterChain.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ChunkConcatReaderPool.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/CookieUtil.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/DefaultUUIDProvider.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/EndpointMapper.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ExecutorsFactory.java (98%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/FakeHttpSession.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/FilterConfigImpl.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ForkJoinPool.java (98%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/IOUtils.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/IntrospectionUtils.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/QueryStringDecoder.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ReaderInputStream.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ServletContextFactory.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ServletProxyFactory.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/SimpleBroadcaster.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/StringEscapeUtils.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/StringFilterAggregator.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/ThreadLocalInvoker.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/UUIDProvider.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/Utils.java (91%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/Version.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java (87%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/VoidExecutorService.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/VoidServletConfig.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/WebDotXmlReader.java (98%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/XSSHtmlFilter.java (98%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/FocusPoint.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/GoogleAnalytics_v1_URLBuildingStrategy.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/HTTPGetMethod.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/JGoogleAnalyticsTracker.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/ModuleDetection.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/analytics/URLBuildingStrategy.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/ClassFileBuffer.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/ClassFileIterator.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/FileIterator.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/InputStreamIterator.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/annotation/ZipFileIterator.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/uri/UriComponent.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/uri/UriPattern.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/uri/UriTemplate.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/uri/UriTemplateParser.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/util/version.properties (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java (86%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocket.java (94%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java (97%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java (97%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketFactory.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketHandler.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketHandlerAdapter.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketPingPongListener.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java (95%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java (93%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java (81%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java (77%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandler.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandlerAdapter.java (100%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java (90%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java (92%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java (90%) rename modules/{cpr => runtime}/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java (89%) create mode 100644 modules/runtime/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer rename modules/{cpr => runtime}/src/main/resources/META-INF/services/org.atmosphere.inject.CDIProducer (100%) rename modules/{cpr => runtime}/src/main/resources/META-INF/services/org.atmosphere.inject.Injectable (100%) rename modules/{cpr => runtime}/src/main/resources/atmosphere-web.xml.template (94%) rename modules/{cpr => runtime}/src/main/resources/atmosphere.xml (73%) rename modules/{cpr => runtime}/src/main/resources/atmosphere.xml.template (100%) rename modules/{cpr => runtime}/src/main/resources/context.xml (100%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java (93%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java (94%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java (88%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java (90%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/path/PathTest.java (95%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java (86%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java (99%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java (86%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AsyncIOInterceptorTest.java (95%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereFrameworkTest.java (75%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereHandlerTest.java (97%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereInterceptorTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereInterceptorWriterTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereRequestTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereResourceFactoryTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereResourceListenerTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereResourceStateRecoveryTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereResourceTest.java (97%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/AtmosphereSessionTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/BroadcastFilterTest.java (97%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/BroadcasterCacheTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/BroadcasterLifecyclePolicyTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/BroadcasterListenerTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/BroadcasterTest.java (96%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/ConcurrentBroadcasterTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/CookieTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/DefaultAsyncSupportResolverTest.java (80%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/DefaultAtmosphereResourceSessionFactoryTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/DefaultBroadcasterFactoryTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/DefaultBroadcasterTest.java (96%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/ExcludeSessionBroadcasterTest.java (95%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/MetaBroadcasterTest.java (96%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/PoolableBroadcasterFactoryTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/QueryStringTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/ServiceTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/SessionTest.java (97%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/TrackMessageSizeInterceptorTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/UUIDBroadcasterCacheTest.java (97%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/UrlMappingTest.java (99%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/WebSocketFactoryTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/WebSocketHandlerTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/WebSocketProcessorTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/WebSocketStreamingHandlerTest.java (98%) rename modules/{cpr/src/test/java/org/atmosphere/cpr => runtime/src/test/java/org/atmosphere/runtime}/WriteTimeoutTest.java (92%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/util/ChunkConcatReaderPoolTest.java (100%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/util/CookieUtilTest.java (100%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/util/IOUtilsTest.java (100%) rename modules/{cpr => runtime}/src/test/java/org/atmosphere/websocket/WebSocketTest.java (96%) create mode 100644 modules/runtime/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework rename modules/{cpr => runtime}/src/test/resources/logback-test.xml (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c53aa8e3ee..31b5751c36c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,7 +157,7 @@ **Closed issues:** -- Set the org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads to -1 to fully use its power [\#2036](https://github.com/Atmosphere/atmosphere/issues/2036) +- Set the org.atmosphere.runtime.broadcaster.maxAsyncWriteThreads to -1 to fully use its power [\#2036](https://github.com/Atmosphere/atmosphere/issues/2036) - test [\#2035](https://github.com/Atmosphere/atmosphere/issues/2035) - IllegalStateException exception for the session Check [\#2034](https://github.com/Atmosphere/atmosphere/issues/2034) @@ -262,7 +262,7 @@ - \[META-INF/services\] broken for WebSocketProcessor and WebSocketProtocol [\#1986](https://github.com/Atmosphere/atmosphere/issues/1986) - Atmosphere 2.3.1: NPE on JSR356Endpoint close event [\#1983](https://github.com/Atmosphere/atmosphere/issues/1983) - Using IE9, NoSuchMethodError displayed in log file. [\#1982](https://github.com/Atmosphere/atmosphere/issues/1982) -- Invalid lookup class org.atmosphere.plugin.hazelcast.HazelcastBroadcaster. Cached class is: org.atmosphere.cpr.DefaultBroadcaster [\#1981](https://github.com/Atmosphere/atmosphere/issues/1981) +- Invalid lookup class org.atmosphere.plugin.hazelcast.HazelcastBroadcaster. Cached class is: org.atmosphere.runtime.DefaultBroadcaster [\#1981](https://github.com/Atmosphere/atmosphere/issues/1981) - org.atmosphere:atmosphere-runtime-native Maven Central sources jars do not contain source for all classes in binary jars [\#1979](https://github.com/Atmosphere/atmosphere/issues/1979) - java.lang.IllegalStateException: No SessionManager in Atmosphere-2.3.1 with some jetty [\#1978](https://github.com/Atmosphere/atmosphere/issues/1978) - \[Regression\] PostConstruct called twice [\#1976](https://github.com/Atmosphere/atmosphere/issues/1976) @@ -408,7 +408,7 @@ - Atmosphere in Dropwizard: Unable to use Dropwizard-Testing [\#1868](https://github.com/Atmosphere/atmosphere/issues/1868) - \[DefaultBroadcaster\] \[Tomcat\] Improve error handling [\#1866](https://github.com/Atmosphere/atmosphere/issues/1866) - \[Netty\] Possible deadlock [\#1865](https://github.com/Atmosphere/atmosphere/issues/1865) -- \[Native\] AtmosphereServlet must behave exactly the same way as org.atmosphere.cpr.AtmosphereServlet [\#1864](https://github.com/Atmosphere/atmosphere/issues/1864) +- \[Native\] AtmosphereServlet must behave exactly the same way as org.atmosphere.runtime.AtmosphereServlet [\#1864](https://github.com/Atmosphere/atmosphere/issues/1864) - Is synchronous XHR really needed by Atmosphere? [\#1863](https://github.com/Atmosphere/atmosphere/issues/1863) - Allow onTransportFailure handler to abort reconnect attempt [\#1862](https://github.com/Atmosphere/atmosphere/issues/1862) - Network issues should not cause permanent downgrade to long polling [\#1861](https://github.com/Atmosphere/atmosphere/issues/1861) @@ -650,7 +650,7 @@ - \[OnDisconnectInterceptor\] Allow invoking listener's onDisconnect from the closing message [\#1700](https://github.com/Atmosphere/atmosphere/issues/1700) - onClientTimeout [\#1699](https://github.com/Atmosphere/atmosphere/issues/1699) - Atmosphere Chat application not working in IE9 -- Long Polling [\#1694](https://github.com/Atmosphere/atmosphere/issues/1694) -- SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead [\#1691](https://github.com/Atmosphere/atmosphere/issues/1691) +- SessionSupport error. Make sure you define org.atmosphere.runtime.SessionSupport as a listener in web.xml instead [\#1691](https://github.com/Atmosphere/atmosphere/issues/1691) - Jetty9WebSocketHandler\#onWebSocketError causing NPE [\#1690](https://github.com/Atmosphere/atmosphere/issues/1690) - ManagedAtmosphereHandler methods for resume and timeout [\#1682](https://github.com/Atmosphere/atmosphere/issues/1682) - Broadcaster Lifecycle logic must be moved inside an BroadcasterListener [\#1667](https://github.com/Atmosphere/atmosphere/issues/1667) @@ -748,7 +748,7 @@ - AtmosphereService wildfly + restEasy getting 400 [\#1635](https://github.com/Atmosphere/atmosphere/issues/1635) - Never trust underlying websocket implementation when closing [\#1633](https://github.com/Atmosphere/atmosphere/issues/1633) - Maven Parent [\#1632](https://github.com/Atmosphere/atmosphere/issues/1632) -- SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead [\#1629](https://github.com/Atmosphere/atmosphere/issues/1629) +- SessionSupport error. Make sure you define org.atmosphere.runtime.SessionSupport as a listener in web.xml instead [\#1629](https://github.com/Atmosphere/atmosphere/issues/1629) - \[websocket\] When broadcasting binary data it throws ClassCastException [\#1628](https://github.com/Atmosphere/atmosphere/issues/1628) - GWT polling transport not supported [\#1627](https://github.com/Atmosphere/atmosphere/issues/1627) - onReady doesn't get called anymore when SuspendTrackerInterceptor is installed. [\#1626](https://github.com/Atmosphere/atmosphere/issues/1626) @@ -817,7 +817,7 @@ **Implemented enhancements:** -- Add META/services/org.atmosphere.cpr.AtmosphereFramework support [\#1573](https://github.com/Atmosphere/atmosphere/issues/1573) +- Add META/services/org.atmosphere.runtime.AtmosphereFramework support [\#1573](https://github.com/Atmosphere/atmosphere/issues/1573) **Closed issues:** @@ -1176,7 +1176,7 @@ - \[Graddle\] Fallback to manual annotation scanning [\#1327](https://github.com/Atmosphere/atmosphere/issues/1327) - @ManagedService object confusion [\#1326](https://github.com/Atmosphere/atmosphere/issues/1326) - \[websocket\] If server times out the websocket, padding must be sent back [\#1325](https://github.com/Atmosphere/atmosphere/issues/1325) -- \[dropWizard\] Enable all classes scanning causes null pointer exception in org.atmosphere.cpr.AtmosphereFramework.setDefaultBroadcasterClassName\(\) [\#1324](https://github.com/Atmosphere/atmosphere/issues/1324) +- \[dropWizard\] Enable all classes scanning causes null pointer exception in org.atmosphere.runtime.AtmosphereFramework.setDefaultBroadcasterClassName\(\) [\#1324](https://github.com/Atmosphere/atmosphere/issues/1324) - AtmosphereResponse.addCookie\(\) issue. [\#1322](https://github.com/Atmosphere/atmosphere/issues/1322) - AtmosphereFramework.configureQueryStringAsRequest fails parsing queryString "=&X-atmo-protocol=true" at async timeout [\#1321](https://github.com/Atmosphere/atmosphere/issues/1321) - Message lost when broadcasting to an empty Set\ [\#1318](https://github.com/Atmosphere/atmosphere/issues/1318) @@ -1301,7 +1301,7 @@ **Closed issues:** - DefaultBroadcaster.removeAtmosphereResource\(\) doesn't remove [\#1272](https://github.com/Atmosphere/atmosphere/issues/1272) -- Atmosphere 2.0.0.RC3: NullPointerException at org.atmosphere.cpr.SessionSupport.sessionDestroyed\(SessionSupport.java:44\) [\#1268](https://github.com/Atmosphere/atmosphere/issues/1268) +- Atmosphere 2.0.0.RC3: NullPointerException at org.atmosphere.runtime.SessionSupport.sessionDestroyed\(SessionSupport.java:44\) [\#1268](https://github.com/Atmosphere/atmosphere/issues/1268) - Tomcat/Spring should not create "phantom" HTTP request upon web app startup [\#1267](https://github.com/Atmosphere/atmosphere/issues/1267) - Annotation scanning is broken in JBoss 6.1.x [\#1266](https://github.com/Atmosphere/atmosphere/issues/1266) - Deadlock detected in Atmosphere Scheduler-2 [\#1265](https://github.com/Atmosphere/atmosphere/issues/1265) @@ -1336,7 +1336,7 @@ - Atmosphere Rest-Chat not deploying to jboss 5.1.0 [\#995](https://github.com/Atmosphere/atmosphere/issues/995) - \[test\] re-enable tests before 1.1.0 release [\#980](https://github.com/Atmosphere/atmosphere/issues/980) - \[Internet Explorer\] Tracking cookie not deleted with shared = true [\#968](https://github.com/Atmosphere/atmosphere/issues/968) -- org.atmosphere.cpr.defaultContextType [\#929](https://github.com/Atmosphere/atmosphere/issues/929) +- org.atmosphere.runtime.defaultContextType [\#929](https://github.com/Atmosphere/atmosphere/issues/929) ## [atmosphere-project-1.0.16](https://github.com/Atmosphere/atmosphere/tree/atmosphere-project-1.0.16) (2013-08-28) [Full Changelog](https://github.com/Atmosphere/atmosphere/compare/atmosphere-project-2.0.0.RC3...atmosphere-project-1.0.16) @@ -1357,7 +1357,7 @@ - onOpen is not called when connected using long polling [\#1230](https://github.com/Atmosphere/atmosphere/issues/1230) - \[Weblogic 12c\] AnnotationDetector Not Able to Load and Scan Handler Classes In .war Deployment [\#1229](https://github.com/Atmosphere/atmosphere/issues/1229) - Invalidating spring security session in tomcat 7 [\#1226](https://github.com/Atmosphere/atmosphere/issues/1226) -- Any URI with "\_" in first path segment will throw: org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /\_... [\#1225](https://github.com/Atmosphere/atmosphere/issues/1225) +- Any URI with "\_" in first path segment will throw: org.atmosphere.runtime.AtmosphereMappingException: No AtmosphereHandler maps request for /\_... [\#1225](https://github.com/Atmosphere/atmosphere/issues/1225) - Websocket Error when using IE8 or IE9 [\#1224](https://github.com/Atmosphere/atmosphere/issues/1224) - ERROR cpr.AtmosphereFramework - AtmosphereFramework exception java.lang.IllegalStateException: Not supported. [\#1218](https://github.com/Atmosphere/atmosphere/issues/1218) - Improve JavaDoc [\#1217](https://github.com/Atmosphere/atmosphere/issues/1217) @@ -1398,7 +1398,7 @@ - ERROR cpr.AtmosphereFramework - AtmosphereFramework exception java.lang.IllegalStateException: Not supported. [\#1205](https://github.com/Atmosphere/atmosphere/issues/1205) - java.nio.charset.MalformedInputException when broadcasting to IE8 [\#1203](https://github.com/Atmosphere/atmosphere/issues/1203) - ERROR handler.ReflectorServletProcessor - onRequest\(\) javax.servlet.ServletException [\#1202](https://github.com/Atmosphere/atmosphere/issues/1202) -- Enabling org.atmosphere.cpr.sessionSupport throws java.io.NotSerializableException [\#1201](https://github.com/Atmosphere/atmosphere/issues/1201) +- Enabling org.atmosphere.runtime.sessionSupport throws java.io.NotSerializableException [\#1201](https://github.com/Atmosphere/atmosphere/issues/1201) - get headers from server [\#1197](https://github.com/Atmosphere/atmosphere/issues/1197) - Is there a way to share the application context with atmosphere servlet? [\#1195](https://github.com/Atmosphere/atmosphere/issues/1195) - Atmosphere v2.0.0.RC1 -TrackMessageSizeFilter Issue [\#1192](https://github.com/Atmosphere/atmosphere/issues/1192) @@ -1615,7 +1615,7 @@ - \[Jetty 9/mvn jetty-run issue\] Atmosphere 1.1.0.RC1 throws ClassNotFoundException: org.eclipse.jetty.continuation.ContinuationListener on Jetty 9.0.0.v20130308 [\#978](https://github.com/Atmosphere/atmosphere/issues/978) - Error: WebSocket is closed before the connection is established. [\#977](https://github.com/Atmosphere/atmosphere/issues/977) - \[logger\] Possible java.util.ConcurrentModificationException [\#975](https://github.com/Atmosphere/atmosphere/issues/975) -- if org.atmosphere.cpr.Broadcaster.supportOutOfOrderBroadcast set 'true', atmosphere don't broadcast. [\#974](https://github.com/Atmosphere/atmosphere/issues/974) +- if org.atmosphere.runtime.Broadcaster.supportOutOfOrderBroadcast set 'true', atmosphere don't broadcast. [\#974](https://github.com/Atmosphere/atmosphere/issues/974) - \[websocket\] DefaultWebSocketProcessor must suspend the resource before invoking onOpen [\#973](https://github.com/Atmosphere/atmosphere/issues/973) - High CPU usage in Firefox browser \(19.0.2\) running WebSocket \(1.0.11\) in jetty 8 server [\#964](https://github.com/Atmosphere/atmosphere/issues/964) - Firefox Offline Mode Reconnect Issues [\#962](https://github.com/Atmosphere/atmosphere/issues/962) @@ -1727,7 +1727,7 @@ - \[atmosphere.js\] WebSocket reconnect using the wrong timeout [\#893](https://github.com/Atmosphere/atmosphere/issues/893) - wss downgrades to comet [\#892](https://github.com/Atmosphere/atmosphere/issues/892) - Tilde character ~ in path causes error [\#891](https://github.com/Atmosphere/atmosphere/issues/891) -- testEmptyBroadcastMethod\(org.atmosphere.cpr.BroadcasterTest\) FAILED [\#886](https://github.com/Atmosphere/atmosphere/issues/886) +- testEmptyBroadcastMethod\(org.atmosphere.runtime.BroadcasterTest\) FAILED [\#886](https://github.com/Atmosphere/atmosphere/issues/886) - Should serializers close or flush their OutputStream? [\#884](https://github.com/Atmosphere/atmosphere/issues/884) - Recover from an IOException when a message is found from the cache [\#883](https://github.com/Atmosphere/atmosphere/issues/883) - Enforce same origin policy in TomcatWebSocketUtil [\#880](https://github.com/Atmosphere/atmosphere/issues/880) @@ -1780,7 +1780,7 @@ - \[glassfish\] Cancelling the connection with streaming. [\#862](https://github.com/Atmosphere/atmosphere/issues/862) - Tomcat, Servlet 3: The request associated with the AsyncContext has already completed processing. [\#858](https://github.com/Atmosphere/atmosphere/issues/858) - jquery.atmosphere.js does not support websockets with binary frames [\#855](https://github.com/Atmosphere/atmosphere/issues/855) -- Broken Pipe even with org.atmosphere.cpr.CometSupport.maxInactiveActivity if server broadcast events in intervalls \< maxInactiveActivity [\#854](https://github.com/Atmosphere/atmosphere/issues/854) +- Broken Pipe even with org.atmosphere.runtime.CometSupport.maxInactiveActivity if server broadcast events in intervalls \< maxInactiveActivity [\#854](https://github.com/Atmosphere/atmosphere/issues/854) - Cache messages as soon as we know an AtmosphereResource has been resumed [\#853](https://github.com/Atmosphere/atmosphere/issues/853) - \[BroadcasterCache\] Ensure the cache is delivered in the order it was populated [\#852](https://github.com/Atmosphere/atmosphere/issues/852) - Messages are delivered not in order they get broadcasted [\#851](https://github.com/Atmosphere/atmosphere/issues/851) @@ -1797,7 +1797,7 @@ - dispatchUrl unused by websocket push [\#835](https://github.com/Atmosphere/atmosphere/issues/835) - \[http\] Gives a chance to the connection to be established before calling the callback [\#833](https://github.com/Atmosphere/atmosphere/issues/833) - \[websocket\] Push the uuid and the server timestamp as the first message so it get set [\#831](https://github.com/Atmosphere/atmosphere/issues/831) -- \[websocket\] When used with the org.atmosphere.cpr.CometSupport.maxInactiveActivity mechanism, must reset the timestamp [\#830](https://github.com/Atmosphere/atmosphere/issues/830) +- \[websocket\] When used with the org.atmosphere.runtime.CometSupport.maxInactiveActivity mechanism, must reset the timestamp [\#830](https://github.com/Atmosphere/atmosphere/issues/830) - \[GlassFish\] Wrong WebSocket error code on browser close [\#828](https://github.com/Atmosphere/atmosphere/issues/828) - DefaultBroadcaster is caching it's object instead of the message [\#825](https://github.com/Atmosphere/atmosphere/issues/825) - Port BroadcasterCache's PerRequest filter code to 1.1.x [\#824](https://github.com/Atmosphere/atmosphere/issues/824) @@ -1914,7 +1914,7 @@ - \[atmosphere.js\] Deprecate maxRequest, add maxReconnectOnClose [\#759](https://github.com/Atmosphere/atmosphere/issues/759) - WebSocketProtocol and Handler must first be loaded using the Thread's classloader [\#758](https://github.com/Atmosphere/atmosphere/issues/758) -- \[websocket\]\[tomcat\] org.atmosphere.cpr.AtmosphereRequest.getRemoteAddr\(\) returns empty string [\#757](https://github.com/Atmosphere/atmosphere/issues/757) +- \[websocket\]\[tomcat\] org.atmosphere.runtime.AtmosphereRequest.getRemoteAddr\(\) returns empty string [\#757](https://github.com/Atmosphere/atmosphere/issues/757) - \[GlassFish\] resource.getRequest\(\).getPathInfo\(\) issue [\#755](https://github.com/Atmosphere/atmosphere/issues/755) - \[Glassfish and PrimeFaces Push\] No BroadcasterCache configured. [\#754](https://github.com/Atmosphere/atmosphere/issues/754) - Websocket connection doesnt close with firefox [\#753](https://github.com/Atmosphere/atmosphere/issues/753) @@ -1934,7 +1934,7 @@ - Atmosphere.js reports 1.0.3 in 1.0.4 [\#733](https://github.com/Atmosphere/atmosphere/issues/733) - Implement getAuth and setAuth in RedisFilter. [\#732](https://github.com/Atmosphere/atmosphere/issues/732) - \[runtime\] - push performance issue [\#730](https://github.com/Atmosphere/atmosphere/issues/730) -- Setting org.atmosphere.cpr.broadcasterLifeCyclePolicy in atmosphere.xml doesn't work [\#728](https://github.com/Atmosphere/atmosphere/issues/728) +- Setting org.atmosphere.runtime.broadcasterLifeCyclePolicy in atmosphere.xml doesn't work [\#728](https://github.com/Atmosphere/atmosphere/issues/728) - 0.a.c.AtmosphereRequest.getLocale\(\) returns null on Tomcat7 whereas on Jetty8 or JBoss7 it returns non-null Locale. [\#727](https://github.com/Atmosphere/atmosphere/issues/727) - \[streaming\] reconnect issue when maxStreamingLength is reached [\#726](https://github.com/Atmosphere/atmosphere/issues/726) - \[performance\] Make WebSocketProcessor a singleton [\#725](https://github.com/Atmosphere/atmosphere/issues/725) @@ -2076,7 +2076,7 @@ - \[atmosphere.js\] XDomainRequest logic doesn't support all request's properties [\#637](https://github.com/Atmosphere/atmosphere/issues/637) - \[IE 8\] With enableXDR, IE 8 reconnect forever. [\#634](https://github.com/Atmosphere/atmosphere/issues/634) - @MeteorService breaks Meteor [\#632](https://github.com/Atmosphere/atmosphere/issues/632) -- org.atmosphere.cpr.Meteor, cache Memory Leak [\#631](https://github.com/Atmosphere/atmosphere/issues/631) +- org.atmosphere.runtime.Meteor, cache Memory Leak [\#631](https://github.com/Atmosphere/atmosphere/issues/631) - Several AsyncIOWriterAdapter methods default to infinite loops, not no-ops [\#627](https://github.com/Atmosphere/atmosphere/issues/627) - \[jQuery\] streaming, opera breaks on junk split + FIX [\#625](https://github.com/Atmosphere/atmosphere/issues/625) - Atmosphere response setHeader adds header value instead of replacing it [\#624](https://github.com/Atmosphere/atmosphere/issues/624) @@ -2106,7 +2106,7 @@ - Session timeout restorer can get overwritten and the original timeout value is lost [\#592](https://github.com/Atmosphere/atmosphere/issues/592) - Unsubscribe in window.unload instead of window.beforeunload [\#591](https://github.com/Atmosphere/atmosphere/issues/591) - Message delimiter is added several times if message payload exceeds 8192 when using jersey [\#590](https://github.com/Atmosphere/atmosphere/issues/590) -- \[runtime\] org.atmosphere.cpr.recycleAtmosphereRequestResponse not properly implemented [\#584](https://github.com/Atmosphere/atmosphere/issues/584) +- \[runtime\] org.atmosphere.runtime.recycleAtmosphereRequestResponse not properly implemented [\#584](https://github.com/Atmosphere/atmosphere/issues/584) - TomcatWebSocketHandler handle onBinaryMessage as whole ByteBuffer [\#582](https://github.com/Atmosphere/atmosphere/issues/582) - Grizzly2WebSocketSupport: pathInfo in HttpServletRequestImpl null [\#581](https://github.com/Atmosphere/atmosphere/issues/581) - Session timeout not restored on serialized sessions [\#555](https://github.com/Atmosphere/atmosphere/issues/555) diff --git a/assembly/jersey/src/main/assembly/distribution.xml b/assembly/jersey/src/main/assembly/distribution.xml deleted file mode 100644 index 6f962ac7bf9..00000000000 --- a/assembly/jersey/src/main/assembly/distribution.xml +++ /dev/null @@ -1,40 +0,0 @@ - - distribution - ${artifactId} - false - - zip - - - - runtime - lib/ - - * - - - - - - src/main/resources - webapps/ - - - src/main/conf - - *.xml - - conf - - - src/main/scripts - - *.* - - bin - - - diff --git a/assembly/jersey/src/main/java/org/atmosphere/voidClass/VoidClass.java b/assembly/jersey/src/main/java/org/atmosphere/voidClass/VoidClass.java deleted file mode 100644 index b537d7f673e..00000000000 --- a/assembly/jersey/src/main/java/org/atmosphere/voidClass/VoidClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.atmosphere.voidClass; - -public class VoidClass { -} diff --git a/assembly/pom.xml b/assembly/pom.xml index 8fc8f511946..d2f616f2b8b 100755 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -15,10 +15,6 @@ https://github.com/Atmosphere/atmosphere - cpr - jersey - + runtime diff --git a/assembly/cpr/pom.xml b/assembly/runtime/pom.xml similarity index 100% rename from assembly/cpr/pom.xml rename to assembly/runtime/pom.xml diff --git a/assembly/cpr/src/main/assembly/distribution.xml b/assembly/runtime/src/main/assembly/distribution.xml similarity index 100% rename from assembly/cpr/src/main/assembly/distribution.xml rename to assembly/runtime/src/main/assembly/distribution.xml diff --git a/assembly/cpr/src/main/java/org/atmosphere/voidClass/VoidClass.java b/assembly/runtime/src/main/java/org/atmosphere/voidClass/VoidClass.java similarity index 100% rename from assembly/cpr/src/main/java/org/atmosphere/voidClass/VoidClass.java rename to assembly/runtime/src/main/java/org/atmosphere/voidClass/VoidClass.java diff --git a/assembly/websocketd/atmosphere.sh b/assembly/websocketd/atmosphere.sh deleted file mode 100755 index b998ebac15a..00000000000 --- a/assembly/websocketd/atmosphere.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -java -jar target/atmosphere-websocketd-2.1.0-SNAPSHOT-server.jar diff --git a/assembly/websocketd/pom.xml b/assembly/websocketd/pom.xml deleted file mode 100644 index b83ac87540c..00000000000 --- a/assembly/websocketd/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - org.atmosphere - atmosphere-project - 2.1.0-SNAPSHOT - ../../pom.xml - - 4.0.0 - org.atmosphere - atmosphere-websocketd - atmosphere-websocketd - 2.1.0-SNAPSHOT - jar - - - org.atmosphere - atmosphere-runtime - ${project.version} - - - - - - - - - - - - - org.apache.geronimo.specs - geronimo-servlet_3.0_spec - 1.0 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.4 - true - - - $(replace;$(project.version);-SNAPSHOT;.$(tstamp;yyyyMMdd-HHmm)) - - Atmosphere - org.atmosphere.*;scope=compile|runtime - - * - - - org.atmosphere.*;version="$(replace;$(project.version);-SNAPSHOT;"")" - - - - - - osgi-bundle - package - - bundle - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.1.2 - - - attach-sources - verify - - jar-no-fork - aggregate - - - - - - org.apache.maven.plugins - maven-shade-plugin - 1.2.1 - - - package - - shade - - - true - server - - - - - org.atmosphere.container.EmbeddedWebSocketHandler - - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.1.1 - - - - java - - - - - org.atmosphere.container.EmbeddedWebSocketHandler - - - - - - diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Asynchronous.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Asynchronous.java deleted file mode 100644 index b039f84830d..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Asynchronous.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.annotation; - -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.HeaderConfig; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Suspend the response and use the Broadcaster associated with {@link org.atmosphere.cpr.HeaderConfig#X_ATMOSPHERE_TRACKING_ID} - * to publish the result. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Asynchronous { - - /** - * Wait for {@link org.atmosphere.cpr.AtmosphereResource} before executing the {@link org.atmosphere.cpr.Broadcaster#awaitAndBroadcast(Object, long, java.util.concurrent.TimeUnit)}. - * @return true if the broadcast operation must wait before executing. - */ - boolean waitForResource() default true; - - /** - * Add {@link org.atmosphere.cpr.BroadcastFilter} to the broadcast operation. - */ - public Class[] broadcastFilter() default {}; - - /** - * The header value used to create a {@link org.atmosphere.cpr.Broadcaster} that will be used to broadcast the - * asynchronous execution. - * @return The header value used to create a {@link org.atmosphere.cpr.Broadcaster} - */ - String header() default HeaderConfig.X_ATMOSPHERE_TRACKING_ID; - - /** - * The time a connection will be suspended if no broadcast happens. Same as {@link org.atmosphere.annotation.Suspend#period()} - * @return The time a connection will be suspended if no broadcast happens. - */ - int period() default 5 * 60 * 1000; - - /** - * Add {@link AtmosphereResourceEventListener} to the broadcast operation. - */ - public Class[] eventListeners() default {}; - - /** - * Write the returned entity back to the calling connection. Default is false. - * @return true if the entity needs to be written back to the calling connection. - */ - public boolean writeEntity() default true; - /** - * If the @Produces annotation is missing, this value will be used instead. - * @return the default content-type used if the @Produces annotation is missing. - */ - public String contentType() default ""; -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Broadcast.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Broadcast.java deleted file mode 100755 index f30f71f07da..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Broadcast.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.annotation; - -import org.atmosphere.cpr.BroadcastFilter; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Broadcast to all suspended response the value of the method annotated with this annotation. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Broadcast { - - public String value() default "/*"; - - /** - * Add {@link BroadcastFilter}s to the broadcast operation. - */ - public Class[] filters() default {}; - - /** - * Resume all suspended response on the first broadcast operation. - */ - public boolean resumeOnBroadcast() default false; - - /** - * Should the broadcast be delayed? A value of 0 means - * the broadcast be delayed until a normal broadcast operation - * happens. Any other value will be evaluated as seconds - */ - public int delay() default -1; - - /** - * Write the returned entity back to the calling connection. Default is false. - * @return true if the entity needs to be written back to the calling connection. - */ - public boolean writeEntity() default true; -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Cluster.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Cluster.java deleted file mode 100755 index ae24bac8add..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Cluster.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - - -package org.atmosphere.annotation; - - -import org.atmosphere.cpr.Broadcaster; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Defines an annotation that can be used to add clustering support - * when a {@link Broadcaster} is used. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.TYPE, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Cluster { - /** - * The Cluster's name - */ - String name() default "Atmosphere"; - - Class[] value() - default {org.atmosphere.cpr.ClusterBroadcastFilter.class}; -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Publish.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Publish.java deleted file mode 100644 index c0482112f1f..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Publish.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * When a method is annotated with this annotation, the returned value of the method will be broadcasted to the passed - * value, e.g the associated {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} will be invoked. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Publish { - - String value(); - -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Resume.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Resume.java deleted file mode 100755 index d26494f78a5..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Resume.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - - -package org.atmosphere.annotation; - - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Resume a suspended response. A suspended response is the result of annotating any method - * using the {@link Suspend}. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Resume { - - /** - * Resume after the first event caused by annotating a method with {@link Broadcast} - * - * @return - */ - int value() default 1; // long polling -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Schedule.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Schedule.java deleted file mode 100755 index 70a0328f225..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Schedule.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Schedule periodic broadcast operations to the set of suspended response. - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Schedule { - - /** - * The period for broadcast (in second). - * - * @return - */ - public int period() default 60; - - /** - * The period before starting the broadcast (in second). - * - * @return - */ - public int waitFor() default 0; - - /** - * Resume all suspended response on the first broadcast operation. - */ - public boolean resumeOnBroadcast() default false; - -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Subscribe.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Subscribe.java deleted file mode 100644 index bc900da2220..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Subscribe.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.annotation; - - -import org.atmosphere.cpr.AtmosphereResourceEventListener; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Subscribe to the "value", or topic. This annotation will create a {@link org.atmosphere.cpr.Broadcaster} with the - * value as ID, and suspend the underlying connection. This annotation does the same as {@link Suspend}, but create - * the Broadcaster automatically from the value. - *

- * That annotation doesn't allow configuring the {@link org.atmosphere.annotation.Suspend#outputComments()} value. The - * default value is set to false. If you want to support http-streaming, make sure your client set the {@link org.atmosphere.cpr.HeaderConfig#X_ATMOSPHERE_TRANSPORT} - * header to "streaming". - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Subscribe { - - /** - * The value that will be used to create or lookup a {@link org.atmosphere.cpr.Broadcaster} - * - * @return The value that will be used to create or lookup a {@link org.atmosphere.cpr.Broadcaster} - */ - String value(); - - /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} to the broadcast operation. - */ - public Class[] listeners() default {}; - - /** - * Write the returned entity back to the calling connection. Default is false. - * @return true if the entity needs to be written back to the calling connection. - */ - public boolean writeEntity() default true; - - /** - * The timeout in millseconds before the connection is resumed. Default is 30 seconds - * @return The timeout before the connection is resumed. Default is 30 seconds - */ - int timeout() default 30000; -} diff --git a/modules/annotations/src/main/java/org/atmosphere/annotation/Suspend.java b/modules/annotations/src/main/java/org/atmosphere/annotation/Suspend.java deleted file mode 100755 index 099ce2be8d4..00000000000 --- a/modules/annotations/src/main/java/org/atmosphere/annotation/Suspend.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - - -package org.atmosphere.annotation; - -import org.atmosphere.cpr.AtmosphereResourceEventListener; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.util.concurrent.TimeUnit; - -/** - * Suspend the underlying response. Once suspended, a response might be allowed - * to consume {@link Broadcast} events, depending on the scope ([@link Suspend#SCOPE}). - * By default, a suspended response is suspended able to consume - * any broadcasted events executed inside the same application (SCOPE.APPLICATION). - * The period can also be per suspended response (SCOPE.REQUEST) or available to other - * application (SCOPE.VM). - * - * @author Jeanfrancois Arcand - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Suspend { - - /** - * How long a response stay suspended in {@link #timeUnit}, default is -1 - * - * @return - */ - int period() default -1; - - /** - * @return - */ - TimeUnit timeUnit() default TimeUnit.MILLISECONDS; - - enum SCOPE { - REQUEST, APPLICATION, VM - } - - /** - * The Scope of the {@link org.atmosphere.cpr.Broadcaster} that will be created once the - * response gets suspended. One final word on Broadcaster: by default, - * a Broadcaster will broadcast using - * all resources/classes on which the response has been suspended. - * This behavior is configurable and you can configure it setting the appropriate scope

- * - * @return The Scope of the {@link org.atmosphere.cpr.Broadcaster} that will be created once the - * response gets suspended. - */ - SCOPE scope() default SCOPE.APPLICATION; - - /** - * By default, output some comments when suspending the connection. - * Deprecated. No longer required - */ - @Deprecated - boolean outputComments() default true; - - /** - * Resume all suspended response on the first broadcast operation. - */ - public boolean resumeOnBroadcast() default false; - - /** - * Add {@link AtmosphereResourceEventListener} to track internal events. - */ - public Class[] listeners() default {}; - - /** - * Write the returned entity back to the calling connection. Default is false. - * @return true if the entity needs to be written back to the calling connection. - */ - public boolean writeEntity() default true; - - /** - * If the @Produces annotation is missing, this value will be used instead. - * @return the default content-type used if the @Produces annotation is missing. - */ - public String contentType() default ""; -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/EmbeddedWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/EmbeddedWebSocketHandler.java deleted file mode 100644 index d257c9e8491..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/EmbeddedWebSocketHandler.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; -import org.atmosphere.util.IOUtils; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.concurrent.ConcurrentHashMap; - -/** - * websocketd support. - * - * @author Jeanfrancois Arcand - */ -public class EmbeddedWebSocketHandler { - private static final Logger logger = LoggerFactory.getLogger(EmbeddedWebSocketHandler.class); - - private final AtmosphereFramework framework; - private boolean on; - private WebSocketProcessor processor; - private final ConcurrentHashMap webSockets = new ConcurrentHashMap(); - private String requestURI = "/"; - - public EmbeddedWebSocketHandler(AtmosphereFramework framework) { - this.framework = framework; - framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig()) { - public boolean supportWebSocket() { - return true; - } - }).getAtmosphereConfig().startupHook(new AtmosphereConfig.StartupHook() { - @Override - public void started(AtmosphereFramework framework) { - if (framework.getAtmosphereConfig().handlers().isEmpty()) { - framework.addAtmosphereHandler("/*", ECHO_ATMOSPHEREHANDLER); - } - } - }); - } - - public EmbeddedWebSocketHandler on() { - if (!on) { - on = true; - framework.init(); - processor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(framework); - } - logger.info("EmbeddedWebSocketHandler started"); - return this; - } - - public EmbeddedWebSocketHandler off() { - if (on) framework.destroy(); - return this; - } - - - public EmbeddedWebSocketHandler serve(InputStream inputStream) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); - String a = ""; - - while (!(a.equals("===quit"))) { - a = br.readLine(); - logger.info("Received WebSocket Message {}", a); - processor.invokeWebSocketProtocol(webSocket(inputStream), a); - } - return this; - } - - private WebSocket webSocket(InputStream inputStream) throws IOException { - WebSocket webSocket = webSockets.get(inputStream); - if (webSocket == null) { - webSocket = new ArrayBaseWebSocket(); - webSockets.put(inputStream, webSocket); - AtmosphereRequest request = AtmosphereRequestImpl.newInstance() - .header("Connection", "Upgrade") - .header("Upgrade", "websocket") - .pathInfo(requestURI); - try { - processor.open(webSocket, request, AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), request, webSocket)); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - return webSocket; - } - - public EmbeddedWebSocketHandler requestURI(String requestURI) { - this.requestURI = requestURI; - return this; - } - - private final class ArrayBaseWebSocket extends WebSocket { - - public ArrayBaseWebSocket() { - super(framework.getAtmosphereConfig()); - } - - @Override - public boolean isOpen() { - return true; - } - - @Override - public WebSocket write(String s) throws IOException { - System.out.println(s); - return this; - } - - @Override - public WebSocket write(byte[] b, int offset, int length) throws IOException { - System.out.println(new String(b, offset, length)); - return this; - } - - @Override - public void close() { - } - } - - public static void main(String... args) throws IOException { - new EmbeddedWebSocketHandler(new AtmosphereFramework()).on().serve(System.in); - } - - public static AtmosphereHandler ECHO_ATMOSPHEREHANDLER = new AbstractReflectorAtmosphereHandler() { - @Override - public void onRequest(AtmosphereResource resource) throws IOException { - String body = IOUtils.readEntirelyAsString(resource).toString(); - if (!body.isEmpty()) { - resource.getBroadcaster().broadcast(body); - } - } - }; -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServ30WebSocketSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServ30WebSocketSupport.java deleted file mode 100644 index 5d0c94828f3..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServ30WebSocketSupport.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.Grizzly2WebSocket; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.util.IOUtils; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocketProcessor; -import org.glassfish.grizzly.websockets.DataFrame; -import org.glassfish.grizzly.websockets.DefaultWebSocket; -import org.glassfish.grizzly.websockets.WebSocket; -import org.glassfish.grizzly.websockets.WebSocketApplication; -import org.glassfish.grizzly.websockets.WebSocketEngine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import java.io.IOException; - -public class GlassFishServ30WebSocketSupport extends Servlet30CometSupport { - - private static final Logger LOGGER = LoggerFactory.getLogger(GlassFishServ30WebSocketSupport.class); - - private Grizzly2WebSocketApplication application; - - - // ------------------------------------------------------------ Constructors - - public GlassFishServ30WebSocketSupport(AtmosphereConfig config) { - super(config); - application = new Grizzly2WebSocketApplication(config); - WebSocketEngine.getEngine().register(config.getServletContext().getContextPath(), - IOUtils.guestRawServletPath(config), application); - } - - public GlassFishServ30WebSocketSupport(AtmosphereConfig config, ServletContext sc) { - super(config); - application = new Grizzly2WebSocketApplication(config); - WebSocketEngine.getEngine().register(sc.getContextPath(), - IOUtils.guestRawServletPath(config), application); - } - - - // -------------------------------------- Methods from AsynchronousProcessor - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - if (Utils.webSocketEnabled(req)) { - return suspended(req, res); - } else { - return super.service(req, res); - } - } - - /** - * Return the container's name. - */ - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } - - @Override - public void shutdown() { - super.shutdown(); - WebSocketEngine.getEngine().unregister(application); - super.shutdown(); - } - - // ---------------------------------------------------------- Nested Classes - - - private static final class Grizzly2WebSocketApplication extends WebSocketApplication { - - private AtmosphereConfig config; - private final WebSocketProcessor webSocketProcessor; - - // -------------------------------------------------------- Constructors - - - public Grizzly2WebSocketApplication(AtmosphereConfig config) { - this.config = config; - this.webSocketProcessor = WebSocketProcessorFactory.getDefault() - .getWebSocketProcessor(config.framework()); - } - - - // --------------------------- Methods from Grizzly2WebSocketApplication - - @Override - protected void handshake(org.glassfish.grizzly.websockets.HandShake handshake) throws org.glassfish.grizzly.websockets.HandshakeException{ - if (!webSocketProcessor.handshake(null)) { - throw new org.glassfish.grizzly.websockets.HandshakeException("WebSocket not accepted"); - } - } - - @Override - public void onClose(WebSocket socket, DataFrame frame) { - super.onClose(socket, frame); - LOGGER.trace("onClose {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.close(webSocket, 1000); - } - } - - @Override - public void onConnect(WebSocket socket) { - super.onConnect(socket); - LOGGER.trace("onConnect {} ", socket); - - if (!DefaultWebSocket.class.isAssignableFrom(socket.getClass())) { - throw new IllegalStateException(); - } - - DefaultWebSocket g2WebSocket = DefaultWebSocket.class.cast(socket); - try { - - AtmosphereRequest r = AtmosphereRequestImpl.wrap(g2WebSocket.getUpgradeRequest()); - org.atmosphere.websocket.WebSocket webSocket = new Grizzly2WebSocket(g2WebSocket, config); - g2WebSocket.getUpgradeRequest().setAttribute("grizzly.webSocket", webSocket); - webSocketProcessor.open(webSocket, r, AtmosphereResponseImpl.newInstance(config, r, webSocket)); - } catch (Exception e) { - LOGGER.warn("failed to connect to web socket", e); - } - } - - @Override - public void onMessage(WebSocket socket, String text) { - super.onMessage(socket, text); - LOGGER.trace("onMessage(String) {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.invokeWebSocketProtocol(webSocket, text); - } - } - - @Override - public void onMessage(WebSocket socket, byte[] bytes) { - super.onMessage(socket, bytes); - LOGGER.trace("onMessage(byte[]) {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.invokeWebSocketProtocol(webSocket, bytes, 0, bytes.length); - } - } - - @Override - public void onPing(WebSocket socket, byte[] bytes) { - LOGGER.trace("onPing {} ", socket); - } - - @Override - public void onPong(WebSocket socket, byte[] bytes) { - LOGGER.trace("onPong {} ", socket); - } - - @Override - public void onFragment(WebSocket socket, String fragment, boolean last) { - LOGGER.trace("onFragment(String) {} ", socket); - } - - @Override - public void onFragment(WebSocket socket, byte[] fragment, boolean last) { - LOGGER.trace("onFragment(byte) {} ", socket); - } - - } // END Grizzly2WebSocketApplication -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServlet30WebSocketSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServlet30WebSocketSupport.java deleted file mode 100644 index 797e56b8e6c..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishServlet30WebSocketSupport.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.grizzly.websockets.WebSocketEngine; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Websocket Portable Runtime implementation on top of GlassFish 3.0.1 and up. - * - * @author Jeanfrancois Arcand - */ -public class GlassFishServlet30WebSocketSupport extends Servlet30CometSupport { - - private static final Logger logger = LoggerFactory.getLogger(GlassFishServlet30WebSocketSupport.class); - private GlassFishWebSocketHandler glassfishWebSocketHandler; - - public GlassFishServlet30WebSocketSupport(AtmosphereConfig config) { - super(config); - } - - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - glassfishWebSocketHandler = new GlassFishWebSocketHandler(config); - WebSocketEngine.getEngine().register(glassfishWebSocketHandler); - } - - @Override - public void shutdown() { - super.shutdown(); - WebSocketEngine.getEngine().unregister(glassfishWebSocketHandler); - super.shutdown(); - } - - @Override - public Action service(AtmosphereRequest request, AtmosphereResponse response) - throws IOException, ServletException { - - if (!Utils.webSocketEnabled(request)) { - return super.service(request, response); - } else { - boolean webSocketNotSupported = request.getAttribute(WebSocket.WEBSOCKET_SUSPEND) == null; - - if (webSocketNotSupported) { - WebSocket.notSupported(request, response); - return Action.CANCELLED; - } - - return suspended(request, response); - } - } - - /** - * Return the container's name. - */ - @Override - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketHandler.java deleted file mode 100644 index 4e5b7beb8b8..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketHandler.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.grizzly.tcp.Request; -import com.sun.grizzly.websockets.DataFrame; -import com.sun.grizzly.websockets.DefaultWebSocket; -import com.sun.grizzly.websockets.ProtocolHandler; -import com.sun.grizzly.websockets.ServerNetworkHandler; -import com.sun.grizzly.websockets.WebSocket; -import com.sun.grizzly.websockets.WebSocketApplication; -import com.sun.grizzly.websockets.WebSocketListener; -import org.atmosphere.container.version.GrizzlyWebSocket; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.util.DefaultEndpointMapper; -import org.atmosphere.util.EndpointMapper; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRegistration; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Glassfish 3.2.x WebSocket support. - */ -public class GlassFishWebSocketHandler extends WebSocketApplication { - private static final Logger logger = LoggerFactory.getLogger(GlassFishWebSocketSupport.class); - - private final AtmosphereConfig config; - private final HashMap paths = new HashMap(); - private final WebSocketProcessor webSocketProcessor; - // This is so bad, but Glassfish clear the attribute of the webSocket request - private final ConcurrentHashMap - wMap = new ConcurrentHashMap(); - private final EndpointMapper mapper = new DefaultEndpointMapper(); - - public GlassFishWebSocketHandler(AtmosphereConfig config) { - this.config = config; - - paths(config.getServletContext()); - webSocketProcessor = WebSocketProcessorFactory.getDefault() - .getWebSocketProcessor(config.framework()); - } - - @Override - public WebSocket createWebSocket(ProtocolHandler protocolHandler, final WebSocketListener... listeners) { - ServerNetworkHandler handler = (ServerNetworkHandler)protocolHandler.getNetworkHandler(); - HttpServletRequest req = null; - try { - req = handler.getRequest(); - } catch (IOException ex) { - } - if (!webSocketProcessor.handshake(req)) { - protocolHandler.close(0x00, ""); - throw new IllegalStateException(); - } - return super.createWebSocket(protocolHandler,listeners); - } - - void paths(ServletContext sc) { - try { - Map m = config.getServletContext().getServletRegistrations(); - - ServletRegistration sr = m.get(config.getServletConfig().getServletName()); - - if (sr != null) { - for (String mapping : sr.getMappings()) { - if (mapping.contains("*")) { - mapping = mapping.replace("*", AtmosphereFramework.MAPPING_REGEX); - } - - if (mapping.endsWith("/")) { - mapping = mapping + AtmosphereFramework.MAPPING_REGEX; - } - paths.put(mapping, Boolean.TRUE); - } - } - } catch (Exception ex) { - logger.error("{}", ex); - } - } - - @Override - public void onConnect(WebSocket w) { - super.onConnect(w); - - org.atmosphere.websocket.WebSocket webSocket = new GrizzlyWebSocket(w, config); - - //logger.debug("onOpen"); - if (!DefaultWebSocket.class.isAssignableFrom(w.getClass())) { - throw new IllegalStateException(); - } - - DefaultWebSocket dws = DefaultWebSocket.class.cast(w); - wMap.put(w,webSocket); - - try { - - AtmosphereRequest r = AtmosphereRequestImpl.wrap(dws.getRequest()); - AtmosphereResponse response = AtmosphereResponseImpl.newInstance(config, r, webSocket); - config.framework().configureRequestResponse(r, response); - try { - // Stupid Stupid Stupid - if (r.getPathInfo() == null) { - String uri = r.getRequestURI(); - String pathInfo = uri.substring(uri.indexOf(r.getServletPath()) + r.getServletPath().length()); - r.pathInfo(pathInfo); - } - } catch (Exception e) { - // Whatever exception occurs skip it - logger.trace("", e); - } - webSocketProcessor.open(webSocket, r, response); - } catch (Exception e) { - logger.warn("failed to connect to web socket", e); - } - } - - @Override - public boolean isApplicationRequest(Request request) { - String path = request.requestURI().toString(); - - // remove contextpath from start of request, which may not happen if webapp is set as the default-web-module - String contextPath = config.getServletContext().getContextPath(); - if (path.startsWith(contextPath)) { - path = path.substring(contextPath.length()); - } - - Boolean b = mapper.map(path, paths); - return b == null? false: b; - } - - @Override - public void onClose(WebSocket w, DataFrame df) { - super.onClose(w, df); - logger.trace("onClose {} ", w); - if (webSocketProcessor != null) { - webSocketProcessor.close(wMap.remove(w), 1005); - } - } - - @Override - public void onMessage(WebSocket w, String text) { - logger.trace("onMessage {} ", w); - if (webSocketProcessor != null) { - webSocketProcessor.invokeWebSocketProtocol(w(w), text); - } - } - - @Override - public void onMessage(WebSocket w, byte[] bytes) { - logger.trace("onMessage (bytes) {} ", w); - if (webSocketProcessor != null) { - webSocketProcessor.invokeWebSocketProtocol(w(w), bytes, 0, bytes.length); - } - } - - @Override - public void onPing(WebSocket w, byte[] bytes) { - logger.trace("onPing (bytes) {} ", w); - } - - @Override - public void onPong(WebSocket w, byte[] bytes) { - logger.trace("onPong (bytes) {} ", w); - } - - @Override - public void onFragment(WebSocket w, byte[] bytes, boolean last) { - logger.trace("onFragment (bytes) {} ", w); - } - - @Override - public void onFragment(WebSocket w, String text, boolean last) { - logger.trace("onFragment (string) {} ", w); - } - - org.atmosphere.websocket.WebSocket w(WebSocket w) { - return wMap.get(w); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketSupport.java deleted file mode 100644 index 070ea48907a..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishWebSocketSupport.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.grizzly.websockets.WebSocketEngine; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Websocket Portable Runtime implementation on top of GlassFish 3.0.1 and up. - * - * @author Jeanfrancois Arcand - */ -public class GlassFishWebSocketSupport extends GrizzlyCometSupport { - - private static final Logger logger = LoggerFactory.getLogger(GlassFishWebSocketSupport.class); - private GlassFishWebSocketHandler glassfishWebSocketHandler; - - public GlassFishWebSocketSupport(AtmosphereConfig config) { - super(config); - } - - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - glassfishWebSocketHandler = new GlassFishWebSocketHandler(config); - WebSocketEngine.getEngine().register(glassfishWebSocketHandler); - } - - @Override - public void shutdown() { - super.shutdown(); - WebSocketEngine.getEngine().unregister(glassfishWebSocketHandler); - super.shutdown(); - } - - @Override - public Action service(AtmosphereRequest request, AtmosphereResponse response) - throws IOException, ServletException { - - if (!Utils.webSocketEnabled(request)) { - return super.service(request, response); - } else { - boolean webSocketNotSupported = request.getAttribute(WebSocket.WEBSOCKET_SUSPEND) == null; - - if (webSocketNotSupported) { - WebSocket.notSupported(request, response); - return Action.CANCELLED; - } - - return suspended(request, response); - } - } - - /** - * Return the container's name. - */ - @Override - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishv2CometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GlassFishv2CometSupport.java deleted file mode 100644 index 1f2abf17dbb..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GlassFishv2CometSupport.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.enterprise.web.connector.grizzly.comet.CometContext; -import com.sun.enterprise.web.connector.grizzly.comet.CometEngine; -import com.sun.enterprise.web.connector.grizzly.comet.CometEvent; -import com.sun.enterprise.web.connector.grizzly.comet.CometHandler; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import java.io.IOException; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Grizzly API included with GlassFish v2. - * - * @author Jeanfrancois Arcand - */ -public class GlassFishv2CometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(GlassFishv2CometSupport.class); - - private static final String ATMOSPHERE = "/atmosphere"; - - private String atmosphereCtx = ""; - - public GlassFishv2CometSupport(AtmosphereConfig config) { - super(config); - } - - /** - * Init Grizzly's {@link CometContext} that will be used to suspend and - * resume the response. - * - * @param sc the {@link ServletContext} - * @throws javax.servlet.ServletException - */ - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - atmosphereCtx = sc.getServletContext().getContextPath() + ATMOSPHERE; - - CometEngine cometEngine = CometEngine.getEngine(); - CometContext context = cometEngine.register(atmosphereCtx); - context.setExpirationDelay(-1); - logger.debug("Created CometContext for atmosphere context: {}", atmosphereCtx); - } - - /** - * {@inheritDoc} - */ - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - Action action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - suspend(ctx, action, req, res); - } else if (action.type() == Action.TYPE.RESUME) { - resume(req, ctx); - } - return action; - } - - /** - * Suspend the response - * - * @param ctx - * @param action - * @param req - * @param res - */ - private void suspend(CometContext ctx, Action action, AtmosphereRequest req, AtmosphereResponse res) { - VoidCometHandler c = new VoidCometHandler(req, res); - ctx.setExpirationDelay(action.timeout()); - ctx.addCometHandler(c); - ctx.addAttribute("Time", System.currentTimeMillis()); - req.setAttribute(ATMOSPHERE, c.hashCode()); - } - - /** - * Resume the underlying response. - * - * @param req an {@link AtmosphereRequest} - * @param ctx a {@link CometContext} - */ - private void resume(AtmosphereRequest req, CometContext ctx) { - - if (req.getAttribute(ATMOSPHERE) == null) { - return; - } - - CometHandler handler = ctx.getCometHandler((Integer) req.getAttribute(ATMOSPHERE)); - req.removeAttribute(ATMOSPHERE); - if (handler != null) { - ctx.resumeCometHandler(handler); - } - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - complete(r); - } - } - - public AsyncSupport complete(AtmosphereResourceImpl r) { - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - resume(r.getRequest(false), ctx); - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - resume(req, CometEngine.getEngine().getCometContext(atmosphereCtx)); - } - return action; - } - - /** - * Void {@link CometHandler}, which delegate the processing of the - * {@link AtmosphereResponse} to an {@link AtmosphereResource}. - */ - private class VoidCometHandler implements CometHandler { - - private final AtmosphereRequest req; - private final AtmosphereResponse res; - - private VoidCometHandler(AtmosphereRequest req, AtmosphereResponse res) { - this.req = req; - this.res = res; - } - - @Override - public void attach(Object o) { - } - - @Override - public void onEvent(CometEvent ce) throws IOException { - } - - @Override - public void onInitialize(CometEvent ce) throws IOException { - } - - @Override - public void onTerminate(CometEvent ce) throws IOException { - } - - @Override - public synchronized void onInterrupt(CometEvent ce) throws IOException { - long timeStamp = (Long) ce.getCometContext().getAttribute("Time"); - try { - if (ce.getCometContext().getExpirationDelay() > 0 - && (System.currentTimeMillis() - timeStamp) >= ce.getCometContext().getExpirationDelay()) { - timedout(req, res); - } else { - cancelled(req, res); - } - } catch (ServletException ex) { - logger.warn("onInterrupt(): encountered exception", ex); - } - } - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2CometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2CometSupport.java deleted file mode 100644 index 0871e90eb07..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2CometSupport.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.glassfish.grizzly.comet.CometContext; -import org.glassfish.grizzly.comet.CometEngine; -import org.glassfish.grizzly.comet.CometEvent; -import org.glassfish.grizzly.comet.CometHandler; -import org.glassfish.grizzly.http.server.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.List; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Grizzly 1.5 and up. - * - * @author Jeanfrancois Arcand - */ -public class Grizzly2CometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(Grizzly2CometSupport.class); - - private static final String ATMOSPHERE = "/atmosphere"; - - private String atmosphereCtx = ""; - - public Grizzly2CometSupport(AtmosphereConfig config) { - super(config); - } - - /** - * Init Grizzly's {@link org.glassfish.grizzly.comet.CometContext} that will be used to suspend and - * resume the response. - * - * @param sc the {@link javax.servlet.ServletContext} - * @throws javax.servlet.ServletException - */ - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - - atmosphereCtx = sc.getServletContext().getContextPath() + ATMOSPHERE; - - CometEngine cometEngine = CometEngine.getEngine(); - CometContext context = cometEngine.register(atmosphereCtx); - context.setExpirationDelay(-1); - logger.debug("Created CometContext for atmosphere context: {}", atmosphereCtx); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - Action action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - suspend(ctx, action, req, res); - } else if (action.type() == Action.TYPE.RESUME) { - resume(req, ctx); - } - return action; - } - - /** - * Suspend the response - * - * @param ctx - * @param action - * @param req - * @param res - */ - private void suspend(CometContext ctx, Action action, AtmosphereRequest req, AtmosphereResponse res) { - VoidCometHandler c = new VoidCometHandler(req, res); - ctx.setExpirationDelay(action.timeout()); - ctx.addCometHandler(c); - req.setAttribute(ATMOSPHERE, c.hashCode()); - ctx.addAttribute("Time", System.currentTimeMillis()); - } - - /** - * Resume the underlying response, - * - * @param req an {@link AtmosphereRequest} - * @param ctx a {@link org.glassfish.grizzly.comet.CometContext} - */ - private void resume(AtmosphereRequest req, CometContext ctx) { - - if (req.getAttribute(ATMOSPHERE) == null) { - return; - } - - CometHandler handler = getCometHandler(ctx, (Integer) req.getAttribute(ATMOSPHERE)); - req.removeAttribute(ATMOSPHERE); - if (handler != null) { - try { - ctx.resumeCometHandler(handler); - } catch (IOException e) { - logger.error("Error resuming CometHandler", e); - } - } - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - complete(r); - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - resume(r.getRequest(false), ctx); - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - resume(req, CometEngine.getEngine().getCometContext(atmosphereCtx)); - } - return action; - } - - private static CometHandler getCometHandler(CometContext context, - int handlerId) { - List handlers = context.getCometHandlers(); - for (CometHandler handler : handlers) { - if (handler.hashCode() == handlerId) { - return handler; - } - } - return null; - } - - /** - * Void {@link org.glassfish.grizzly.comet.CometHandler}, which delegate the processing of the - * {@link AtmosphereRequest} to an {@link org.atmosphere.cpr.AtmosphereResourceImpl}. - */ - private class VoidCometHandler implements CometHandler { - - AtmosphereRequest req; - AtmosphereResponse res; - private Response grizzlyResponse; - CometContext cometContext; - - public VoidCometHandler(AtmosphereRequest req, AtmosphereResponse res) { - this.req = req; - this.res = res; - } - - /** - * {@inheritDoc} - */ - public void attach(Object o) { - } - - @Override - public void onEvent(CometEvent ce) throws IOException { - } - - @Override - public void onInitialize(CometEvent ce) throws IOException { - } - - @Override - public void onTerminate(CometEvent ce) throws IOException { - } - - @Override - public synchronized void onInterrupt(CometEvent ce) throws IOException { - long timeStamp = (Long) ce.getCometContext().getAttribute("Time"); - try { - if (ce.getCometContext().getExpirationDelay() > 0 - && (System.currentTimeMillis() - timeStamp) >= ce.getCometContext().getExpirationDelay()) { - timedout(req, res); - grizzlyResponse.finish(); - } else { - cancelled(req, res); - } - } catch (ServletException ex) { - logger.warn("onInterrupt() encountered exception", ex); - } - } - - @Override - public Response getResponse() { - return grizzlyResponse; - } - - @Override - public void setResponse(Response response) { - grizzlyResponse = response; - } - - @Override - public CometContext getCometContext() { - return cometContext; - } - - @Override - public void setCometContext(CometContext cometContext) { - this.cometContext = cometContext; - } - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2WebSocketSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2WebSocketSupport.java deleted file mode 100644 index d93b0e9c310..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Grizzly2WebSocketSupport.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.Grizzly2WebSocket; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.util.IOUtils; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocketProcessor; -import org.glassfish.grizzly.websockets.DataFrame; -import org.glassfish.grizzly.websockets.DefaultWebSocket; -import org.glassfish.grizzly.websockets.WebSocket; -import org.glassfish.grizzly.websockets.WebSocketApplication; -import org.glassfish.grizzly.websockets.WebSocketEngine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; - -public class Grizzly2WebSocketSupport extends Grizzly2CometSupport { - - private static final Logger LOGGER = LoggerFactory.getLogger(Grizzly2WebSocketSupport.class); - - private Grizzly2WebSocketApplication application; - - - // ------------------------------------------------------------ Constructors - - public Grizzly2WebSocketSupport(AtmosphereConfig config) { - super(config); - application = new Grizzly2WebSocketApplication(config); - WebSocketEngine.getEngine().register(config.getServletContext().getContextPath(), IOUtils.guestRawServletPath(config), application); - } - - - // -------------------------------------- Methods from AsynchronousProcessor - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - if (Utils.webSocketEnabled(req)) { - return suspended(req, res); - } else { - return super.service(req, res); - } - } - - /** - * Return the container's name. - */ - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } - - @Override - public void shutdown() { - super.shutdown(); - WebSocketEngine.getEngine().unregister(application); - super.shutdown(); - } - - // ---------------------------------------------------------- Nested Classes - - - private static final class Grizzly2WebSocketApplication extends WebSocketApplication { - - private AtmosphereConfig config; - private final WebSocketProcessor webSocketProcessor; - - // -------------------------------------------------------- Constructors - - - public Grizzly2WebSocketApplication(AtmosphereConfig config) { - this.config = config; - this.webSocketProcessor = WebSocketProcessorFactory.getDefault() - .getWebSocketProcessor(config.framework()); - } - - - // --------------------------- Methods from Grizzly2WebSocketApplication - - @Override - protected void handshake(org.glassfish.grizzly.websockets.HandShake handshake) throws org.glassfish.grizzly.websockets.HandshakeException{ - if (!webSocketProcessor.handshake(null)) { - throw new org.glassfish.grizzly.websockets.HandshakeException("WebSocket not accepted"); - } - } - - @Override - public void onClose(WebSocket socket, DataFrame frame) { - super.onClose(socket, frame); - LOGGER.trace("onClose {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.close(webSocket, 1000); - } - } - - @Override - public void onConnect(WebSocket socket) { - super.onConnect(socket); - LOGGER.trace("onConnect {} ", socket); - - if (!DefaultWebSocket.class.isAssignableFrom(socket.getClass())) { - throw new IllegalStateException(); - } - - DefaultWebSocket g2WebSocket = DefaultWebSocket.class.cast(socket); - try { - - AtmosphereRequest r = AtmosphereRequestImpl.wrap(g2WebSocket.getUpgradeRequest()); - org.atmosphere.websocket.WebSocket webSocket = new Grizzly2WebSocket(g2WebSocket, config); - g2WebSocket.getUpgradeRequest().setAttribute("grizzly.webSocket", webSocket); - webSocketProcessor.open(webSocket, r, AtmosphereResponseImpl.newInstance(config, r, webSocket)); - } catch (Exception e) { - LOGGER.warn("failed to connect to web socket", e); - } - } - - @Override - public void onMessage(WebSocket socket, String text) { - super.onMessage(socket, text); - LOGGER.trace("onMessage(String) {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.invokeWebSocketProtocol(webSocket, text); - } - } - - @Override - public void onMessage(WebSocket socket, byte[] bytes) { - super.onMessage(socket, bytes); - LOGGER.trace("onMessage(byte[]) {} ", socket); - DefaultWebSocket g2w = DefaultWebSocket.class.cast(socket); - org.atmosphere.websocket.WebSocket webSocket = (org.atmosphere.websocket.WebSocket) g2w.getUpgradeRequest().getAttribute("grizzly.webSocket"); - if (webSocket != null) { - webSocketProcessor.invokeWebSocketProtocol(webSocket, bytes, 0, bytes.length); - } - } - - @Override - public void onPing(WebSocket socket, byte[] bytes) { - LOGGER.trace("onPing {} ", socket); - } - - @Override - public void onPong(WebSocket socket, byte[] bytes) { - LOGGER.trace("onPong {} ", socket); - } - - @Override - public void onFragment(WebSocket socket, String fragment, boolean last) { - LOGGER.trace("onFragment(String) {} ", socket); - } - - @Override - public void onFragment(WebSocket socket, byte[] fragment, boolean last) { - LOGGER.trace("onFragment(byte) {} ", socket); - } - - } // END Grizzly2WebSocketApplication -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyCometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyCometSupport.java deleted file mode 100644 index f744e112e31..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyCometSupport.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.grizzly.comet.CometContext; -import com.sun.grizzly.comet.CometEngine; -import com.sun.grizzly.comet.CometEvent; -import com.sun.grizzly.comet.CometHandler; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import java.io.IOException; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Grizzly 1.5 and up. - * - * @author Jeanfrancois Arcand - */ -public class GrizzlyCometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(GrizzlyCometSupport.class); - - private static final String ATMOSPHERE = "/atmosphere"; - - private String atmosphereCtx = ""; - - public GrizzlyCometSupport(AtmosphereConfig config) { - super(config); - } - - /** - * Init Grizzly's {@link CometContext} that will be used to suspend and resume the response. - * - * @param sc the {@link ServletContext} - * @throws javax.servlet.ServletException - */ - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - - atmosphereCtx = sc.getServletContext().getContextPath() + ATMOSPHERE; - - CometEngine cometEngine = CometEngine.getEngine(); - CometContext context = cometEngine.register(atmosphereCtx); - context.setExpirationDelay(-1); - logger.debug("Created CometContext for atmosphere context: {}", atmosphereCtx); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - Action action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - suspend(ctx, action, req, res); - } else if (action.type() == Action.TYPE.RESUME) { - resume(req, ctx); - } - return action; - } - - /** - * Suspend the response - * - * @param ctx - * @param action - * @param req - * @param res - */ - private void suspend(CometContext ctx, Action action, AtmosphereRequest req, AtmosphereResponse res) { - VoidCometHandler c = new VoidCometHandler(req, res); - ctx.setExpirationDelay(action.timeout()); - ctx.addCometHandler(c); - req.setAttribute(ATMOSPHERE, c.hashCode()); - ctx.addAttribute("Time", System.currentTimeMillis()); - } - - /** - * Resume the underlying response. - * - * @param req an {@link AtmosphereRequest} - * @param ctx a {@link CometContext} - */ - private void resume(AtmosphereRequest req, CometContext ctx) { - - if (req.getAttribute(ATMOSPHERE) == null) { - return; - } - - CometHandler handler = ctx.getCometHandler((Integer) req.getAttribute(ATMOSPHERE)); - req.removeAttribute(ATMOSPHERE); - - if (req.resource() != null) { - try { - AtmosphereResourceImpl.class.cast(req.resource()).cancel(); - } catch (IOException e) { - logger.trace("", e); - } - } - - if (handler != null) { - ctx.resumeCometHandler(handler); - } - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - complete(r); - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx); - resume(r.getRequest(false), ctx); - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - resume(req, CometEngine.getEngine().getCometContext(atmosphereCtx)); - } - return action; - } - - /** - * Void {@link CometHandler}, which delegate the processing of the - * {@link AtmosphereRequest} to an {@link org.atmosphere.cpr.AtmosphereResourceImpl}. - */ - private class VoidCometHandler implements CometHandler { - - AtmosphereRequest req; - AtmosphereResponse res; - - public VoidCometHandler(AtmosphereRequest req, AtmosphereResponse res) { - this.req = req; - this.res = res; - } - - @Override - public void attach(Object o) { - } - - @Override - public void onEvent(CometEvent ce) throws IOException { - } - - @Override - public void onInitialize(CometEvent ce) throws IOException { - } - - @Override - public void onTerminate(CometEvent ce) throws IOException { - } - - @Override - public synchronized void onInterrupt(CometEvent ce) throws IOException { - long timeStamp = (Long) ce.getCometContext().getAttribute("Time"); - try { - if (ce.getCometContext().getExpirationDelay() > 0 - && (System.currentTimeMillis() - timeStamp) >= ce.getCometContext().getExpirationDelay()) { - timedout(req, res); - } else { - cancelled(req, res); - } - } catch (ServletException ex) { - logger.warn("onInterrupt() encountered exception", ex); - } - } - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyServlet30WebSocketSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyServlet30WebSocketSupport.java deleted file mode 100644 index 12d565ed6cd..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/GrizzlyServlet30WebSocketSupport.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import com.sun.grizzly.websockets.WebSocketEngine; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Websocket Portable Runtime implementation on top of GlassFish 3.0.1 and up. - * - * @author Jeanfrancois Arcand - */ -public class GrizzlyServlet30WebSocketSupport extends Servlet30CometSupport { - - private static final Logger logger = LoggerFactory.getLogger(GrizzlyServlet30WebSocketSupport.class); - private GlassFishWebSocketHandler glassfishWebSocketHandler; - - public GrizzlyServlet30WebSocketSupport(AtmosphereConfig config) { - super(config); - } - - @Override - public void init(ServletConfig sc) throws ServletException { - super.init(sc); - glassfishWebSocketHandler = new GlassFishWebSocketHandler(config); - WebSocketEngine.getEngine().register(glassfishWebSocketHandler); - } - - @Override - public void shutdown() { - super.shutdown(); - WebSocketEngine.getEngine().unregister(glassfishWebSocketHandler); - super.shutdown(); - } - - @Override - public Action service(AtmosphereRequest request, AtmosphereResponse response) - throws IOException, ServletException { - - if (!Utils.webSocketEnabled(request)) { - return super.service(request, response); - } else { - boolean webSocketNotSupported = request.getAttribute(WebSocket.WEBSOCKET_SUSPEND) == null; - - if (webSocketNotSupported) { - WebSocket.notSupported(request, response); - return Action.CANCELLED; - } - - return suspended(request, response); - } - } - - /** - * Return the container's name. - */ - @Override - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JBossAsyncSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/JBossAsyncSupportWithWebSocket.java deleted file mode 100644 index 75b1ca9dfb5..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JBossAsyncSupportWithWebSocket.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import java.io.IOException; -import java.util.Enumeration; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.HeaderConfig; -import org.atmosphere.websocket.WebSocket; -import org.jboss.servlet.http.HttpEvent; -import org.jboss.servlet.http.HttpEventServlet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_VERSION; - -/** - * JBoss's WebSocket support. This code has been adapted from - * {@link org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket} and - * {@link org.atmosphere.container.TomcatWebSocketUtil} - */ -public class JBossAsyncSupportWithWebSocket extends JBossWebCometSupport { - - private static final Logger logger = LoggerFactory.getLogger(JBossAsyncSupportWithWebSocket.class); - - private final HttpEventServlet websocketHandler; - - public JBossAsyncSupportWithWebSocket(AtmosphereConfig config) { - super(config); - - this.websocketHandler = newWebSocketHandler(config); - } - - private HttpEventServlet newWebSocketHandler(AtmosphereConfig config) { - try { - return new JBossWebSocketHandler(config); - } catch (Exception e) { - logger.error("Cannot instantiate JBossWebSocketHandler. Websocket events will not be handled.", e); - } - - return null; - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - - boolean allowWebSocketWithoutHeaders = req.getHeader(HeaderConfig.X_ATMO_WEBSOCKET_PROXY) != null ? true : false; - if (!allowWebSocketWithoutHeaders) { - if (!headerContainsToken(req, "Upgrade", "websocket")) { - return doService(req, res); - } - - if (!headerContainsToken(req, "Connection", "upgrade")) { - return doService(req, res); - } - - if (!headerContainsToken(req, WEBSOCKET_VERSION, "13")) { - WebSocket.notSupported(req, res); - return new Action(Action.TYPE.CANCELLED); - } - } - - try { - Action action = suspended(req, res); - if (action.type() == Action.TYPE.RESUME) { - req.setAttribute(WebSocket.WEBSOCKET_RESUME, true); - } - return action; - } catch (Exception ex) { - logger.error("", ex); - } - return Action.CANCELLED; - - } - - public Action doService(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return super.service(req, res); - } - - @Override - public boolean supportWebSocket() { - return true; - } - - /** - * @param httpEvent - * @throws javax.servlet.ServletException - * @throws java.io.IOException - */ - public void dispatch(HttpEvent httpEvent) throws IOException, ServletException { - if (websocketHandler != null) { - websocketHandler.event(httpEvent); - } - } - - /* - * This only works for tokens. Quoted strings need more sophisticated - * parsing. - */ - private static boolean headerContainsToken(HttpServletRequest req, - String headerName, String target) { - Enumeration headers = req.getHeaders(headerName); - while (headers.hasMoreElements()) { - String header = headers.nextElement(); - String[] tokens = header.split(","); - for (String token : tokens) { - if (target.equalsIgnoreCase(token.trim())) { - return true; - } - } - } - return false; - } - -} - diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JBossWebCometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/JBossWebCometSupport.java deleted file mode 100755 index fbf81f08a17..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JBossWebCometSupport.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.util.ExecutorsFactory; -import org.jboss.servlet.http.HttpEvent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Tomcat AIO. - * - * @author Jeanfrancois Arcand - */ -public class JBossWebCometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(JBossWebCometSupport.class); - - public static final String HTTP_EVENT = "HttpEvent"; - private final static String SUSPENDED = JBossWebCometSupport.class.getName() + ".suspended"; - - private static final IllegalStateException unableToDetectComet = new IllegalStateException(unableToDetectComet()); - private final Boolean closeConnectionOnInputStream; - - public JBossWebCometSupport(AtmosphereConfig config) { - super(config); - Object b = config.getInitParameter(ApplicationConfig.TOMCAT_CLOSE_STREAM); - closeConnectionOnInputStream = b == null ? true : Boolean.parseBoolean(b.toString()); - try { - Class.forName(HttpEvent.class.getName()); - } catch (Throwable e) { - throw new IllegalStateException(unableToDetectComet()); - } - } - - /** - * Invoked by the Tomcat AIO when a Comet request gets detected. - * - * @param req the {@link AtmosphereRequest} - * @param res the {@link AtmosphereResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - - HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT); - - // Comet is not enabled. - if (event == null) { - logger.error("HttpEvent is null, JBoss APR Not Properly installed"); - throw unableToDetectComet; - } - - if (logger.isTraceEnabled()) { - logger.trace("Event Type {} for {}", event.getType(), req.getRequestURL().toString()); - } - - Action action = null; - // For now, we are just interested in HttpEvent.REA - AtmosphereResource r = req.resource(); - if (event.getType() == HttpEvent.EventType.BEGIN) { - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - // Do nothing except setting the times out - try { - if (action.timeout() != -1) { - event.setTimeout((int) action.timeout()); - } else { - event.setTimeout(Integer.MAX_VALUE); - } - req.setAttribute(SUSPENDED, true); - } catch (UnsupportedOperationException ex) { - // Swallow s Tomcat APR isn't supporting time out - // TODO: Must implement the same functionality using a Scheduler - } - } else if (action.type() == Action.TYPE.RESUME) { - close(event); - } else { - close(event); - } - } else if (event.getType() == HttpEvent.EventType.READ) { - // Not implemented - logger.debug("Receiving bytes, unable to process them."); - } else if (event.getType() == HttpEvent.EventType.EOF - || event.getType() == HttpEvent.EventType.ERROR - || event.getType() == HttpEvent.EventType.END) { - - if (r != null && r.isResumed()) { - AtmosphereResourceImpl.class.cast(req.resource()).cancel(); - } else if (req.getAttribute(SUSPENDED) != null && closeConnectionOnInputStream) { - req.setAttribute(SUSPENDED, null); - action = cancelled(req, res); - } else { - close(event); - } - } else if (event.getType() == HttpEvent.EventType.TIMEOUT) { - action = timedout(req, res); - close(event); - } - return action; - } - - private void close(HttpEvent event) { - try { - event.close(); - } catch (Exception ex) { - logger.trace("event.close", ex); - } - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT); - if (event == null) { - return action; - } - close(event); - } - return action; - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - HttpEvent event = (HttpEvent) r.getRequest(false).getAttribute(HTTP_EVENT); - if (event != null && !r.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) { - close(event); - } - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - final HttpEvent event = (HttpEvent) r.getRequest(false).getAttribute(HTTP_EVENT); - // Prevent Deadlock - // https://github.com/Atmosphere/atmosphere/issues/1782 - if (event != null) { - if (!r.isResumed()) { - ExecutorsFactory.getScheduler(config).schedule(new Runnable() { - @Override - public void run() { - close(event); - } - }, 500, TimeUnit.MILLISECONDS); - } else { - close(event); - } - } - return this; - } - - /** - * Tomcat was unable to detect Atmosphere's CometProcessor implementation. - * - * @return an error message describing how to fix the issue. - */ - private static String unableToDetectComet() { - StringBuilder sb = new StringBuilder(); - sb.append("JBoss failed to detect this is a Comet application because the APR Connector is not enabled. "); - sb.append("\nMake sure atmosphere-compat-jboss.jar is not under your WEB-INF/lib and "); - sb.append("You must use the atmosphere-native-runtime dependency in order to use native Comet Support"); - sb.append("\nthere is no context.xml under WEB-INF"); - return sb.toString(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JBossWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/JBossWebSocketHandler.java deleted file mode 100644 index a64f52dbadf..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JBossWebSocketHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2017 Péter Miklós - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.JBossWebSocket; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; -import org.atmosphere.jboss.as.websockets.WebSocket; -import org.atmosphere.jboss.as.websockets.servlet.WebSocketServlet; -import org.atmosphere.jboss.websockets.Frame; -import org.atmosphere.jboss.websockets.frame.BinaryFrame; -import org.atmosphere.jboss.websockets.frame.CloseFrame; -import org.atmosphere.jboss.websockets.frame.TextFrame; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; - -/** - * Dispatches JBoss websocket events to Atmosphere's {@link org.atmosphere.websocket.WebSocketProcessor}. - * This websocket handler is based Mike Brock's websockets implementation. - * - * @author Péter Miklós - * @see https://github.com/mikebrock/jboss-websockets - */ -public class JBossWebSocketHandler extends WebSocketServlet { - - private static final long serialVersionUID = 1L; - - private static final Logger logger = LoggerFactory.getLogger(JBossWebSocketHandler.class); - - private static final String JBOSS_WEB_SOCKET_PROCESSOR = "jboss.webSocketProcessor"; - private final AtmosphereConfig config; - private final WebSocketProcessor webSocketProcessor; - private org.atmosphere.websocket.WebSocket webSocket; - - public JBossWebSocketHandler(AtmosphereConfig config) { - this.config = config; - this.webSocketProcessor = WebSocketProcessorFactory.getDefault() - .getWebSocketProcessor(config.framework()); - } - - @Override - protected void onSocketOpened(WebSocket socket) throws IOException { - logger.trace("WebSocket.onSocketOpened."); - - if (!webSocketProcessor.handshake(socket.getServletRequest())) { - socket.closeSocket(); - throw new IOException(); - } - - AtmosphereRequest r = AtmosphereRequestImpl.wrap(socket.getServletRequest()); - webSocket = new JBossWebSocket(socket, config); - webSocketProcessor.open(webSocket, r, AtmosphereResponseImpl.newInstance(config, r, webSocket)); - } - - @Override - protected void onSocketClosed(WebSocket socket) throws IOException { - logger.trace("WebSocket.onSocketClosed."); - webSocketProcessor.close(webSocket, 1005); - } - - @Override - protected void onReceivedFrame(WebSocket socket) throws IOException { - Frame frame = socket.readFrame(); - - if (webSocketProcessor != null) { - if (frame instanceof TextFrame) { - logger.trace("WebSocket.onReceivedFrame (TextFrame)"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, ((TextFrame) frame).getText()); - } else if (frame instanceof BinaryFrame) { - logger.trace("WebSocket.onReceivedFrame (BinaryFrame)"); - BinaryFrame binaryFrame = (BinaryFrame) frame; - webSocketProcessor.invokeWebSocketProtocol(webSocket, binaryFrame.getByteArray(), 0, - binaryFrame.getByteArray().length); - } else if (frame instanceof CloseFrame) { - // TODO shall we call this here? - logger.trace("WebSocket.onReceivedFrame (CloseFrame)"); - webSocketProcessor.close(webSocket, 1005); - } else { - logger.trace("WebSocket.onReceivedFrame skipping: " + frame); - } - } else { - logger.trace("WebSocket.onReceivedFrame but no atmosphere processor in request, skipping: {}", frame); - } - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Jetty7CometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/Jetty7CometSupport.java deleted file mode 100644 index c3844e3f529..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Jetty7CometSupport.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.FrameworkConfig; -import org.eclipse.jetty.continuation.Continuation; -import org.eclipse.jetty.continuation.ContinuationListener; -import org.eclipse.jetty.continuation.ContinuationSupport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import java.io.IOException; - -/** - * Comet Portable Runtime implementation on top of Jetty's Continuation. - * - * @author Jeanfrancois Arcand - */ -public class Jetty7CometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(Jetty7CometSupport.class); - - public Jetty7CometSupport(AtmosphereConfig config) { - super(config); - } - - @Override - public Action service(final AtmosphereRequest req, final AtmosphereResponse res) throws IOException, ServletException { - Action action = null; - - Continuation c = (Continuation) req.getAttribute(Continuation.class.getName()); - - if (c == null || c.isInitial()) { - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND && req.getAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION) == null) { - c = getContinuation(req); - req.setAttribute(Continuation.class.getName(), c); - - if (action.timeout() != -1) { - c.setTimeout(action.timeout()); - } else { - // Jetty 7 does something really weird if you set it to - // Long.MAX_VALUE, which is to resume automatically. - c.setTimeout(Integer.MAX_VALUE); - } - - c.setAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE, req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE)); - c.addContinuationListener(new ContinuationListener() { - - @Override - public void onComplete(Continuation continuation) { - AtmosphereResourceImpl r = (AtmosphereResourceImpl) req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); - if (r != null) { - try { - r.cancel(); - } catch (IOException e) { - } - } - } - - @Override - public void onTimeout(Continuation continuation) { - AtmosphereResourceImpl r = (AtmosphereResourceImpl) req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); - if (r != null) { - try { - timedout(r.getRequest(), r.getResponse()); - } catch (Throwable t) { - logger.error("", t); - } - } else { - logger.trace("AtmosphereResource was null"); - } - try { - continuation.complete(); - } catch (Throwable t) { - } - } - }); - - if (req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE) != null) { - c.suspend(res); - } - } else if (action.type() == Action.TYPE.RESUME) { - // If resume occurs during a suspend operation, stop processing. - Boolean resumeOnBroadcast = (Boolean) req.getAttribute(ApplicationConfig.RESUME_ON_BROADCAST); - if (resumeOnBroadcast != null && resumeOnBroadcast) { - return action; - } - - c = (Continuation) req.getAttribute(Continuation.class.getName()); - if (c != null) { - if (c.isSuspended()) { - try { - c.complete(); - } catch (IllegalStateException ex) { - logger.trace("Continuation.complete()", ex); - } finally { - resumed(req, res); - } - } - } - } - } - return action; - } - - protected Continuation getContinuation(AtmosphereRequest req) { - return ContinuationSupport.getContinuation(req); - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - complete(r); - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - ServletRequest request = r.getRequest(false); - while (request != null) { - Continuation c = (Continuation) request.getAttribute(Continuation.class.getName()); - if (c != null) { - try { - if (c.isSuspended()) { - c.complete(); - } - } catch (IllegalStateException ex) { - logger.trace("c.complete()", ex); - } finally { - r.getRequest(false).setAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION, true); - } - request.removeAttribute(Continuation.class.getName()); - return this; - } else { - return this; - } - } - return this; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Jetty9AsyncSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/Jetty9AsyncSupportWithWebSocket.java deleted file mode 100644 index 032481d05db..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Jetty9AsyncSupportWithWebSocket.java +++ /dev/null @@ -1,201 +0,0 @@ -/* -* Copyright 2017 Async-IO.org -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not -* use this file except in compliance with the License. You may obtain a copy of -* the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations under -* the License. -*/ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.eclipse.jetty.websocket.api.UpgradeRequest; -import org.eclipse.jetty.websocket.api.UpgradeResponse; -import org.eclipse.jetty.websocket.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.server.ServletWebSocketRequest; -import org.eclipse.jetty.websocket.server.WebSocketServerFactory; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse; -import org.eclipse.jetty.websocket.servlet.WebSocketCreator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.lang.reflect.Method; - -/** - * Jetty 9 WebSocket support. - * - * @author Jeanfrancois Arcand - */ -public class Jetty9AsyncSupportWithWebSocket extends Servlet30CometSupport { - private static final Logger logger = LoggerFactory.getLogger(Jetty9AsyncSupportWithWebSocket.class); - private final WebSocketServerFactory webSocketFactory; - - public Jetty9AsyncSupportWithWebSocket(final AtmosphereConfig config) { - super(config); - - String bs = config.getInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE); - WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER); - if (bs != null) { - policy.setInputBufferSize(Integer.parseInt(bs)); - } - - String max = config.getInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME); - if (max != null) { - policy.setIdleTimeout(Integer.parseInt(max)); - } - - try { - // Crazy Jetty API Incompatibility - String serverInfo = config.getServletConfig().getServletContext().getServerInfo(); - boolean isJetty91Plus = false; - if (serverInfo != null) { - int version = Integer.valueOf(serverInfo.split("/")[1].substring(0, 3).replace(".", "")); - isJetty91Plus = version > 90; - } - - max = config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE); - if (max != null) { - //policy.setMaxMessageSize(Integer.parseInt(max)); - Method m; - if (isJetty91Plus) { - m = policy.getClass().getMethod("setMaxTextMessageSize", new Class[]{int.class}); - } else { - m = policy.getClass().getMethod("setMaxMessageSize", new Class[]{long.class}); - } - m.invoke(policy, Integer.parseInt(max)); - } - - max = config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE); - if (max != null) { - //policy.setMaxMessageSize(Integer.parseInt(max)); - Method m; - if (isJetty91Plus) { - m = policy.getClass().getMethod("setMaxBinaryMessageSize", new Class[]{int.class}); - } else { - m = policy.getClass().getMethod("setMaxMessageSize", new Class[]{long.class}); - } - m.invoke(policy, Integer.parseInt(max)); - } - } catch (Exception ex) { - logger.warn("", ex); - } - - final WebSocketProcessor webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - - webSocketFactory = new WebSocketServerFactory(policy) { - @Override - public boolean acceptWebSocket(final HttpServletRequest request, final HttpServletResponse response) throws IOException { - setCreator(new WebSocketCreator() { - - // @Override 9.0.x - public Object createWebSocket(UpgradeRequest upgradeRequest, UpgradeResponse upgradeResponse) { - - ServletWebSocketRequest r = ServletWebSocketRequest.class.cast(upgradeRequest); - r.getExtensions().clear(); - - if (!webSocketProcessor.handshake(request)) { - try { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "WebSocket requests rejected."); - } catch (IOException e) { - logger.trace("", e); - } - return null; - } - - return new Jetty9WebSocketHandler(request, config.framework(), webSocketProcessor); - } - - // @Override 9.1.x - public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { - req.getExtensions().clear(); - - if (!webSocketProcessor.handshake(request)) { - try { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "WebSocket requests rejected."); - } catch (IOException e) { - logger.trace("", e); - } - return null; - } - return new Jetty9WebSocketHandler(request, config.framework(), webSocketProcessor); - } - }); - - return super.acceptWebSocket(request, response); - } - }; - - try { - webSocketFactory.start(); - } catch (Exception e) { - logger.error("", e); - } - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = null; - Boolean b = (Boolean) req.getAttribute(WebSocket.WEBSOCKET_INITIATED); - if (b == null) b = Boolean.FALSE; - - if (!Utils.webSocketEnabled(req) && req.getAttribute(WebSocket.WEBSOCKET_ACCEPT_DONE) == null) { - if (req.resource() != null && req.resource().transport() == AtmosphereResource.TRANSPORT.WEBSOCKET) { - WebSocket.notSupported(req, res); - return Action.CANCELLED; - } else { - return super.service(req, res); - } - } else { - if (webSocketFactory != null && !b) { - req.setAttribute(WebSocket.WEBSOCKET_INITIATED, true); - webSocketFactory.acceptWebSocket(req, res); - req.setAttribute(WebSocket.WEBSOCKET_ACCEPT_DONE, true); - return new Action(); - } - - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - } else if (action.type() == Action.TYPE.RESUME) { - req.setAttribute(WebSocket.WEBSOCKET_RESUME, true); - } - } - - return action == null ? super.service(req, res) : action; - } - - /** - * Return the container's name. - */ - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Jetty9WebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/Jetty9WebSocketHandler.java deleted file mode 100644 index 753ad239602..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Jetty9WebSocketHandler.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2017 Sebastien Dionne - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.Jetty9WebSocket; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.eclipse.jetty.websocket.api.Session; -import org.eclipse.jetty.websocket.api.WebSocketListener; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Field; - -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; - -public class Jetty9WebSocketHandler implements WebSocketListener { - - private static final Logger logger = LoggerFactory.getLogger(Jetty9WebSocketHandler.class); - - private AtmosphereRequest request; - private final AtmosphereFramework framework; - private final WebSocketProcessor webSocketProcessor; - private WebSocket webSocket; - private static final boolean jetty93Up; - - static { - Exception ex = null; - try { - Class.forName("org.eclipse.jetty.websocket.api.WebSocketFrameListener"); - } catch (ClassNotFoundException e) { - ex = e; - } finally { - jetty93Up = ex == null ? true : false; - } - } - - public Jetty9WebSocketHandler(HttpServletRequest request, AtmosphereFramework framework, WebSocketProcessor webSocketProcessor) { - this.framework = framework; - this.request = cloneRequest(request); - this.webSocketProcessor = webSocketProcessor; - } - - private AtmosphereRequest cloneRequest(final HttpServletRequest request) { - try { - AtmosphereRequest r = AtmosphereRequestImpl.wrap(request); - return AtmosphereRequestImpl.cloneRequest(r, false, false, false, framework.getAtmosphereConfig().getInitParameter(PROPERTY_SESSION_CREATE, true)); - } catch (Exception ex) { - logger.error("", ex); - throw new RuntimeException("Invalid WebSocket Request"); - } - } - - @Override - public void onWebSocketBinary(byte[] data, int offset, int length) { - logger.trace("WebSocket.onMessage (bytes)"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, data, offset, length); - } - - @Override - public void onWebSocketClose(int closeCode, String s) { - logger.trace("onClose {}:{}", closeCode, s); - try { - webSocketProcessor.close(webSocket, closeCode); - } finally { - request.destroy(); - } - } - - @Override - public void onWebSocketConnect(Session session) { - logger.trace("WebSocket.onOpen."); - webSocket = new Jetty9WebSocket(session, framework.getAtmosphereConfig()); - - /** - * https://github.com/Atmosphere/atmosphere/issues/1998 - * The Original Jetty Request will be recycled, hence we must loads its content in memory. We can't do that before - * as it break Jetty 9.3.0 upgrade process. - * - * This is a performance regression from 9.2 as we need to clone again the request. 9.3.0+ should use jsr 356! - */ - if (jetty93Up) { - HttpServletRequest r = originalRequest(session); - if (r != null) { - // We close except the session which we can still reach. - request = AtmosphereRequestImpl.cloneRequest(r, true, false, false, framework.getAtmosphereConfig().getInitParameter(PROPERTY_SESSION_CREATE, true)); - } else { - // Bad Bad Bad - request = AtmosphereRequestImpl.cloneRequest(r, true, true, false, framework.getAtmosphereConfig().getInitParameter(PROPERTY_SESSION_CREATE, true)); - } - } - - try { - webSocketProcessor.open(webSocket, request, AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), request, webSocket)); - } catch (Exception e) { - logger.warn("Failed to connect to WebSocket", e); - } - } - - @Override - public void onWebSocketError(Throwable e) { - logger.error("{}", e); - onWebSocketClose(1006, "Unexpected error"); - } - - @Override - public void onWebSocketText(String s) { - logger.trace("WebSocket.onMessage (bytes)"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, s); - } - - private HttpServletRequest originalRequest(Session session) { - try { - // Oh boy... - ServletUpgradeRequest request = (ServletUpgradeRequest) session.getUpgradeRequest(); - Field[] fields = ServletUpgradeRequest.class.getDeclaredFields(); - for (Field f : fields) { - f.setAccessible(true); - Object o = f.get(request); - if (o instanceof HttpServletRequest) { - return HttpServletRequest.class.cast(o); - } - } - } catch (Exception ex) { - logger.error("", ex); - } - return null; - } - -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JettyAsyncSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/JettyAsyncSupportWithWebSocket.java deleted file mode 100644 index 31766a7585c..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JettyAsyncSupportWithWebSocket.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; -import org.eclipse.jetty.websocket.WebSocketFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * WebSocket Portable Runtime implementation on top of Jetty's. - * - * @author Jeanfrancois Arcand - */ -public class JettyAsyncSupportWithWebSocket extends Jetty7CometSupport { - - private static final Logger logger = LoggerFactory.getLogger(JettyAsyncSupportWithWebSocket.class); - private final WebSocketFactory webSocketFactory; - - public JettyAsyncSupportWithWebSocket(final AtmosphereConfig config) { - super(config); - final WebSocketProcessor webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - - WebSocketFactory wsf; - try { - String[] jettyVersion = config.getServletContext().getServerInfo().substring(6).split("\\."); - if (Integer.valueOf(jettyVersion[0]) > 7 || Integer.valueOf(jettyVersion[0]) == 7 && Integer.valueOf(jettyVersion[1]) > 4) { - wsf = JettyWebSocketUtil.getFactory(config, webSocketProcessor); - } else { - wsf = null; - } - } catch (Throwable e) { - // If we can't parse Jetty version, assume it's 8 and up. - try { - logger.trace("Unable to parse Jetty version {}", config.getServletContext().getServerInfo()); - } catch (Throwable t) {} - wsf = JettyWebSocketUtil.getFactory(config, webSocketProcessor); - } - webSocketFactory = wsf; - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - Action action = JettyWebSocketUtil.doService(this,req,res,webSocketFactory); - return action == null ? super.service(req,res) : action; - } - - /** - * Return the container's name. - */ - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JettyCometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/JettyCometSupport.java deleted file mode 100644 index e577b3e4cb0..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JettyCometSupport.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.FrameworkConfig; -import org.mortbay.util.ajax.Continuation; -import org.mortbay.util.ajax.ContinuationSupport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.concurrent.ConcurrentLinkedQueue; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Jetty's Continuation. - * - * @author Jeanfrancois Arcand - */ -public class JettyCometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(JettyCometSupport.class); - - private final ConcurrentLinkedQueue resumed = new ConcurrentLinkedQueue(); - - public JettyCometSupport(AtmosphereConfig config) { - super(config); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse response) - throws IOException, ServletException { - Continuation c = ContinuationSupport.getContinuation(req, null); - Action action = null; - - if (!c.isResumed() && !c.isPending() && req.getAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION) == null) { - // This will throw an exception - action = suspended(req, response); - if (action.type() == Action.TYPE.SUSPEND) { - // Do nothing except setting the times out - if (action.timeout() != -1) { - c.suspend(action.timeout()); - } else { - c.suspend(0); - } - } else if (action.type() == Action.TYPE.RESUME) { - if (!resumed.remove(c)) { - c.reset(); - - if (req.getAttribute(ApplicationConfig.RESUMED_ON_TIMEOUT) == null) { - timedout(req, response); - } else { - resumed(req, response); - } - } - } - } else { - if (!resumed.remove(c) && req.getAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION) == null) { - c.reset(); - - if (req.getAttribute(ApplicationConfig.RESUMED_ON_TIMEOUT) == null) { - timedout(req, response); - } else { - resumed(req, response); - } - } - } - return action; - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - Continuation c = ContinuationSupport.getContinuation(r.getRequest(false), null); - resumed.offer(c); - complete(r); - } else { - try { - r.getResponse().flushBuffer(); - } catch (IOException e) { - } - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - Continuation c = ContinuationSupport.getContinuation(r.getRequest(false), null); - if (!c.isNew()) { - c.resume(); - } else { - r.getRequest().setAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION, true); - } - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - Continuation c = ContinuationSupport.getContinuation(req, null); - if (c != null) { - c.resume(); - } - } - return action; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JettyServlet30AsyncSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/JettyServlet30AsyncSupportWithWebSocket.java deleted file mode 100644 index cbeac158f29..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JettyServlet30AsyncSupportWithWebSocket.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; -import org.eclipse.jetty.websocket.WebSocketFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * This class is the same as {@link JettyAsyncSupportWithWebSocket} implementation and add Websocket support - * to Servlet 3.0. - * - * @author Jeanfrancois Arcand - */ -public class JettyServlet30AsyncSupportWithWebSocket extends Servlet30CometSupport { - - private static final Logger logger = LoggerFactory.getLogger(JettyServlet30AsyncSupportWithWebSocket.class); - private final WebSocketFactory webSocketFactory; - - public JettyServlet30AsyncSupportWithWebSocket(final AtmosphereConfig config) { - super(config); - final WebSocketProcessor webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - - webSocketFactory = JettyWebSocketUtil.getFactory(config, webSocketProcessor); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - Action action = JettyWebSocketUtil.doService(this, req, res, webSocketFactory); - return action == null ? super.service(req, res) : action; - } - - /** - * Return the container's name. - */ - public String getContainerName() { - return config.getServletConfig().getServletContext().getServerInfo() + " with WebSocket enabled."; - } - - @Override - public boolean supportWebSocket() { - return true; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketHandler.java deleted file mode 100644 index 4ef8bea7cc8..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.Jetty8WebSocket; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketEventListener; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.UnsupportedEncodingException; - -import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.CONTROL; -import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.HANDSHAKE; - -/** - * Jetty 7 & 8 WebSocket support. - */ -public class JettyWebSocketHandler implements org.eclipse.jetty.websocket.WebSocket, - org.eclipse.jetty.websocket.WebSocket.OnFrame, - org.eclipse.jetty.websocket.WebSocket.OnBinaryMessage, - org.eclipse.jetty.websocket.WebSocket.OnTextMessage, - org.eclipse.jetty.websocket.WebSocket.OnControl { - - private static final Logger logger = LoggerFactory.getLogger(JettyWebSocketHandler.class); - - private final AtmosphereRequest request; - private final AtmosphereFramework framework; - private final WebSocketProcessor webSocketProcessor; - private WebSocket webSocket; - - public JettyWebSocketHandler(AtmosphereRequest request, AtmosphereFramework framework, WebSocketProcessor webSocketProcessor) { - this.request = request; - this.framework = framework; - this.webSocketProcessor = webSocketProcessor; - } - - @Override - public void onMessage(byte[] data, int offset, int length) { - logger.trace("WebSocket.onMessage (bytes)"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, data, offset, length); - } - - @Override - public boolean onControl(byte controlCode, byte[] data, int offset, int length) { - logger.trace("WebSocket.onControl."); - try { - webSocketProcessor.notifyListener(webSocket, new WebSocketEventListener.WebSocketEvent(new String(data, offset, length, "UTF-8"), CONTROL, webSocket)); - } catch (UnsupportedEncodingException e) { - logger.warn("UnsupportedEncodingException", e); - - } - return false; - } - - @Override - public boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length) { - logger.trace("WebSocket.onFrame."); - // TODO: onMessage is always invoked after that method gets called, so no need to enable for now. - // webSocketProcessor.broadcast(data, offset, length); - /* try { - webSocketProcessor.notifyListener(new WebSocketEventListener.WebSocketEvent(new String(data, offset, length, "UTF-8"), MESSAGE, webSocketProcessor.webSocket())); - } catch (UnsupportedEncodingException e) { - logger.warn("UnsupportedEncodingException", e); - - }*/ - return false; - } - - @Override - public void onHandshake(org.eclipse.jetty.websocket.WebSocket.FrameConnection connection) { - logger.trace("WebSocket.onHandshake"); - webSocket = new Jetty8WebSocket(connection, framework.getAtmosphereConfig()); - webSocketProcessor.notifyListener(webSocket, new WebSocketEventListener.WebSocketEvent("", HANDSHAKE, webSocket)); - } - - @Override - public void onMessage(String data) { - logger.trace("WebSocket.onMessage"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, data); - } - - @Override - public void onOpen(org.eclipse.jetty.websocket.WebSocket.Connection connection) { - logger.trace("WebSocket.onOpen {}", connection); - try { - webSocketProcessor.open(webSocket, request, AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), request, webSocket)); - } catch (Exception e) { - logger.warn("Failed to connect to WebSocket", e); - } - } - - @Override - public void onClose(int closeCode, String message) { - logger.trace("onClose {}:{}", closeCode, message); - try { - webSocketProcessor.close(webSocket, closeCode); - } finally { - request.destroy(); - } - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketUtil.java b/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketUtil.java deleted file mode 100644 index a44221ba783..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/JettyWebSocketUtil.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.util.Utils; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.eclipse.jetty.websocket.WebSocketFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; - -public class JettyWebSocketUtil { - - private static final Logger logger = LoggerFactory.getLogger(JettyWebSocketUtil.class); - - public final static Action doService(AsynchronousProcessor cometSupport, - AtmosphereRequest req, - AtmosphereResponse res, - WebSocketFactory webSocketFactory) throws IOException, ServletException { - - Boolean b = (Boolean) req.getAttribute(WebSocket.WEBSOCKET_INITIATED); - if (b == null) b = Boolean.FALSE; - - if (!Utils.webSocketEnabled(req) && req.getAttribute(WebSocket.WEBSOCKET_ACCEPT_DONE) == null) { - if (req.resource() != null && req.resource().transport() == AtmosphereResource.TRANSPORT.WEBSOCKET) { - WebSocket.notSupported(req, res); - return Action.CANCELLED; - } else { - return null; - } - } else { - if (webSocketFactory != null && !b) { - req.setAttribute(WebSocket.WEBSOCKET_INITIATED, true); - try { - webSocketFactory.acceptWebSocket(req, res); - } catch (IllegalStateException ex) { - logger.trace("", ex); - WebSocket.notSupported(req, res); - return Action.CANCELLED; - } - req.setAttribute(WebSocket.WEBSOCKET_ACCEPT_DONE, true); - return new Action(); - } - - Action action = cometSupport.suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - } else if (action.type() == Action.TYPE.RESUME) { - req.setAttribute(WebSocket.WEBSOCKET_RESUME, true); - } - - return action; - } - } - - public final static WebSocketFactory getFactory(final AtmosphereConfig config, final WebSocketProcessor webSocketProcessor) { - - final AtomicBoolean useBuildInSession = new AtomicBoolean(config.isSupportSession()); - // Override the value. - String s = config.getInitParameter(ApplicationConfig.BUILT_IN_SESSION); - if (s != null) { - useBuildInSession.set(Boolean.valueOf(s)); - } - - WebSocketFactory webSocketFactory = new WebSocketFactory(new WebSocketFactory.Acceptor() { - public boolean checkOrigin(HttpServletRequest request, String origin) { - // Allow all origins - logger.trace("WebSocket-checkOrigin request {} with origin {}", request.getRequestURI(), origin); - return true; - } - - public org.eclipse.jetty.websocket.WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) { - logger.trace("WebSocket-connect request {} with protocol {}", request.getRequestURI(), protocol); - - boolean isDestroyable = false; - String s = config.getInitParameter(ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE); - if (s != null && Boolean.valueOf(s)) { - isDestroyable = true; - } - - if (!webSocketProcessor.handshake(request)) { - // res.sendError(HttpServletResponse.SC_FORBIDDEN, "WebSocket requests rejected."); - throw new IllegalStateException(); - } - - return new JettyWebSocketHandler(AtmosphereRequestImpl.cloneRequest(request, false, useBuildInSession.get(), isDestroyable, config.getInitParameter(PROPERTY_SESSION_CREATE, true)), - config.framework(), webSocketProcessor); - } - }); - - int bufferSize = 8192; - if (config.getInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE) != null) { - bufferSize = Integer.valueOf(config.getInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE)); - } - logger.debug("WebSocket Buffer size {}", bufferSize); - webSocketFactory.setBufferSize(bufferSize); - - int timeOut = 5 * 60000; - if (config.getInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME) != null) { - timeOut = Integer.valueOf(config.getInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME)); - } - logger.debug("WebSocket idle timeout {}", timeOut); - webSocketFactory.setMaxIdleTime(timeOut); - - int maxTextBufferSize = 8192; - if (config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE) != null) { - maxTextBufferSize = Integer.valueOf(config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE)); - } - logger.debug("WebSocket maxTextBufferSize {}", maxTextBufferSize); - webSocketFactory.setMaxTextMessageSize(maxTextBufferSize); - - int maxBinaryBufferSize = 8192; - if (config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE) != null) { - maxBinaryBufferSize = Integer.valueOf(config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE)); - } - logger.debug("WebSocket maxBinaryBufferSize {}", maxBinaryBufferSize); - webSocketFactory.setMaxBinaryMessageSize(maxBinaryBufferSize); - - if (config.getInitParameter(ApplicationConfig.JETTY_WEBSOCKET_MIN_VERSION) != null) { - int minVersion = Integer.valueOf(config.getInitParameter(ApplicationConfig.JETTY_WEBSOCKET_MIN_VERSION)); - webSocketFactory.setMinVersion(minVersion); - logger.debug("WebSocket Jetty minVersion {}", minVersion); - } - - return webSocketFactory; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7AsyncSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7AsyncSupportWithWebSocket.java deleted file mode 100644 index 6f520d4329f..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7AsyncSupportWithWebSocket.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; - -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Tomcat's WebSocket support. This code has been adapted from {@link org.apache.catalina.websocket.WebSocketServlet} - */ -public class Tomcat7AsyncSupportWithWebSocket extends Tomcat7CometSupport implements TomcatWebSocketUtil.Delegate { - - private final WebSocketProcessor webSocketProcessor; - - public Tomcat7AsyncSupportWithWebSocket(AtmosphereConfig config) { - super(config); - webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return TomcatWebSocketUtil.doService(req, res, this, config, webSocketProcessor); - } - - @Override - public Action doService(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return super.service(req, res); - } - - @Override - public boolean supportWebSocket() { - return true; - } -} - diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7BIOSupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7BIOSupportWithWebSocket.java deleted file mode 100644 index 67d1f7dddd1..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7BIOSupportWithWebSocket.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Tomcat's WebSocket support. This code has been adapted from {@link org.apache.catalina.websocket.WebSocketServlet} - */ -public class Tomcat7BIOSupportWithWebSocket extends BlockingIOCometSupport implements TomcatWebSocketUtil.Delegate { - - private static final Logger logger = LoggerFactory.getLogger(Tomcat7BIOSupportWithWebSocket.class); - private static final long serialVersionUID = 1L; - private final WebSocketProcessor webSocketProcessor; - - public Tomcat7BIOSupportWithWebSocket(AtmosphereConfig config) { - super(config); - webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return TomcatWebSocketUtil.doService(req, res, this, config, webSocketProcessor); - } - - @Override - public Action doService(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return super.service(req, res); - } - - @Override - public boolean supportWebSocket() { - return true; - } -} - diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java deleted file mode 100644 index cda48087944..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7CometSupport.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.apache.catalina.comet.CometEvent; -import org.apache.catalina.comet.CometEvent.EventType; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.util.ExecutorsFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Tomcat AIO. - * - * @author Jeanfrancois Arcand - */ -public class Tomcat7CometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(Tomcat7CometSupport.class); - - public static final String COMET_EVENT = "CometEvent"; - private final static String SUSPENDED = Tomcat7CometSupport.class.getName() + ".suspended"; - private final Boolean closeConnectionOnInputStream; - - private static final IllegalStateException unableToDetectComet - = new IllegalStateException(unableToDetectComet()); - - public Tomcat7CometSupport(AtmosphereConfig config) { - super(config); - Object b = config.getInitParameter(ApplicationConfig.TOMCAT_CLOSE_STREAM); - closeConnectionOnInputStream = b == null ? true : Boolean.parseBoolean(b.toString()); - try { - Class.forName(CometEvent.class.getName()); - } catch (Throwable e) { - logger.error("Unable to load class {}. Please make sure you have properly installed Atmosphere http://goo.gl/KEi8pc", e); - throw new IllegalStateException(unableToDetectComet()); - } - } - - /** - * Invoked by the Tomcat AIO when a Comet request gets detected. - * - * @param req the {@link AtmosphereRequest} - * @param res the {@link AtmosphereResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - CometEvent event = (CometEvent) req.getAttribute(COMET_EVENT); - - // Comet is not enabled. - - if (event == null) { - throw unableToDetectComet; - } - - logger.trace("event {} with request {}", event, req); - - Action action = null; - // For now, we are just interested in CometEvent.READ - if (event.getEventType() == EventType.BEGIN) { - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - // Do nothing except setting the times out - try { - if (action.timeout() != -1) { - event.setTimeout((int) action.timeout()); - } else { - event.setTimeout(Integer.MAX_VALUE); - } - } catch (UnsupportedOperationException ex) { - // TODO: Must implement the same functionality using a Scheduler - logger.trace("Warning: CometEvent.setTimeout not supported on this Tomcat instance. " + - " [The Tomcat native connector does not support timeouts on asynchronous I/O.]"); - } - req.setAttribute(SUSPENDED, true); - } else { - closeEvent(event, false); - } - } else if (event.getEventType() == EventType.READ) { - // Not implemented - } else if (event.getEventSubType() == CometEvent.EventSubType.CLIENT_DISCONNECT) { - - if (req.getAttribute(SUSPENDED) != null) { - req.setAttribute(SUSPENDED, null); - action = cancelled(req, res); - } - - closeEvent(event, false); - } else if (event.getEventSubType() == CometEvent.EventSubType.TIMEOUT) { - action = timedout(req, res); - closeEvent(event, false); - } else if (event.getEventType() == EventType.ERROR) { - closeEvent(event, false); - } else if (event.getEventType() == EventType.END) { - if (req.resource() != null && req.resource().isResumed()) { - AtmosphereResourceImpl.class.cast(req.resource()).cancel(); - } else if (req.getAttribute(SUSPENDED) != null && closeConnectionOnInputStream) { - req.setAttribute(SUSPENDED, null); - action = cancelled(req, res); - } else { - closeEvent(event, false); - } - } - return action; - } - - private void closeEvent(final CometEvent event, boolean delay) throws IOException { - // Prevent Deadlock - // https://github.com/Atmosphere/atmosphere/issues/1782 - if (delay) { - ExecutorsFactory.getScheduler(config).schedule(new Runnable() { - @Override - public void run() { - close(event); - } - }, 500, TimeUnit.MILLISECONDS); - } else { - close(event); - } - } - - private void close(CometEvent event) { - try { - event.close(); - } catch (Exception ex) { - logger.trace("event.close", ex); - } - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - CometEvent event = (CometEvent) r.getRequest(false).getAttribute(COMET_EVENT); - if (event != null && !r.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) { - close(event); - } - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - try { - CometEvent event = (CometEvent) r.getRequest(false).getAttribute(COMET_EVENT); - if (event == null) return this; - - // Resume without closing the underlying suspended connection. - if (!r.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) { - closeEvent(event, !r.isResumed()); - } - } catch (IOException ex) { - logger.debug("action failed", ex); - } - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - CometEvent event = (CometEvent) req.getAttribute(COMET_EVENT); - if (event == null) return action; - closeEvent(event, false); - } - return action; - } - - /** - * Tomcat was unable to detect Atmosphere's CometProcessor implementation. - * - * @return an error message describing how to fix the issue. - */ - private static String unableToDetectComet() { - StringBuilder sb = new StringBuilder(); - sb.append("Tomcat failed to detect this is a Comet application because context.xml "); - sb.append("is missing or the Http11NioProtocol Connector is not enabled."); - sb.append("You must use the atmosphere-native-runtime dependency in order to use native Comet Support"); - sb.append("\nIf that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar"); - return sb.toString(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7Servlet30SupportWithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7Servlet30SupportWithWebSocket.java deleted file mode 100644 index d5a0a638a6c..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/Tomcat7Servlet30SupportWithWebSocket.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; - -/** - * Tomcat's WebSocket support. This code has been adapted from {@link org.apache.catalina.websocket.WebSocketServlet} - */ -public class Tomcat7Servlet30SupportWithWebSocket extends Servlet30CometSupport implements TomcatWebSocketUtil.Delegate { - - private static final Logger logger = LoggerFactory.getLogger(Tomcat7Servlet30SupportWithWebSocket.class); - private static final long serialVersionUID = 1L; - private final WebSocketProcessor webSocketProcessor; - - public Tomcat7Servlet30SupportWithWebSocket(AtmosphereConfig config) { - super(config); - webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - } - - @Override - public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return TomcatWebSocketUtil.doService(req, res, this, config, webSocketProcessor); - } - - @Override - public Action doService(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return super.service(req, res); - } - - @Override - public boolean supportWebSocket() { - return true; - } -} - diff --git a/modules/cpr/src/main/java/org/atmosphere/container/TomcatCometSupport.java b/modules/cpr/src/main/java/org/atmosphere/container/TomcatCometSupport.java deleted file mode 100644 index 190268d5b06..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/TomcatCometSupport.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.container; - -import org.apache.catalina.CometEvent; -import org.apache.catalina.CometEvent.EventType; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.util.ExecutorsFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; - -/** - * Comet Portable Runtime implementation on top of Tomcat AIO. - * - * @author Jeanfrancois Arcand - */ -public class TomcatCometSupport extends AsynchronousProcessor { - - private static final Logger logger = LoggerFactory.getLogger(TomcatCometSupport.class); - - public static final String COMET_EVENT = "CometEvent"; - private final static String SUSPENDED = TomcatCometSupport.class.getName() + ".suspended"; - private final Boolean closeConnectionOnInputStream; - - public TomcatCometSupport(AtmosphereConfig config) { - super(config); - Object b = config.getInitParameter(ApplicationConfig.TOMCAT_CLOSE_STREAM); - closeConnectionOnInputStream = b == null ? true : Boolean.parseBoolean(b.toString()); - try { - Class.forName(CometEvent.class.getName()); - } catch (Throwable e) { - logger.error("Unable to load class {}. Please make sure you have properly installed Atmosphere http://goo.gl/KEi8pc", e); - throw new IllegalStateException(unableToDetectComet()); - } - } - - /** - * Invoked by the Tomcat AIO when a Comet request gets detected. - * - * @param req the {@link AtmosphereRequest} - * @param res the {@link AtmosphereResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - public Action service(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - CometEvent event = (CometEvent) req.getAttribute(COMET_EVENT); - - // Comet is not enabled. - if (event == null) { - throw new IllegalStateException(unableToDetectComet()); - } - - Action action = null; - // For now, we are just interested in CometEvent.READ - if (event.getEventType() == EventType.BEGIN) { - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - // Do nothing except setting the times out - try { - if (action.timeout() != -1) { - event.setTimeout((int) action.timeout()); - } else { - event.setTimeout(Integer.MAX_VALUE); - } - req.setAttribute(SUSPENDED, true); - } catch (UnsupportedOperationException ex) { - // TODO: Must implement the same functionality using a Scheduler - logger.trace("Warning: CometEvent.setTimeout not supported on this Tomcat instance. " + - " [The Tomcat native connector does not support timeouts on asynchronous I/O.]"); - } - req.setAttribute(SUSPENDED, true); - } else { - close(event); - } - } else if (event.getEventType() == EventType.READ) { - // Not implemented - } else if (event.getEventSubType() == CometEvent.EventSubType.CLIENT_DISCONNECT) { - - if (req.getAttribute(SUSPENDED) != null && closeConnectionOnInputStream) { - req.setAttribute(SUSPENDED, null); - action = cancelled(req, res); - } - close(event); - } else if (event.getEventSubType() == CometEvent.EventSubType.TIMEOUT) { - action = timedout(req, res); - close(event); - } else if (event.getEventType() == EventType.ERROR) { - close(event); - } else if (event.getEventType() == EventType.END) { - if (req.resource() != null && req.resource().isResumed()) { - AtmosphereResourceImpl.class.cast(req.resource()).cancel(); - } else if (req.getAttribute(SUSPENDED) != null && closeConnectionOnInputStream) { - req.setAttribute(SUSPENDED, null); - action = cancelled(req, res); - } else { - close(event); - } - } - return action; - } - - @Override - public void action(AtmosphereResourceImpl r) { - super.action(r); - if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) { - complete(r); - } - } - - private void close(CometEvent event) { - try { - event.close(); - } catch (Exception ex) { - logger.trace("event.close", ex); - } - } - - @Override - public AsyncSupport complete(AtmosphereResourceImpl r) { - final CometEvent event = (CometEvent) r.getRequest(false).getAttribute(COMET_EVENT); - if (event == null) return this; - - if (!r.isResumed()) { - ExecutorsFactory.getScheduler(config).schedule(new Runnable() { - @Override - public void run() { - close(event); - } - - ; - }, 500, TimeUnit.MILLISECONDS); - } else { - close(event); - } - - return this; - } - - @Override - public Action cancelled(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException { - - Action action = super.cancelled(req, res); - if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) { - CometEvent event = (CometEvent) req.getAttribute(COMET_EVENT); - if (event == null) return action; - try { - event.close(); - } catch (IllegalStateException ex) { - logger.trace("event.close", ex); - } - } - return action; - } - - /** - * Tomcat was unable to detect Atmosphere's CometProcessor implementation. - * - * @return an error message describing how to fix the issue. - */ - private static String unableToDetectComet() { - StringBuilder sb = new StringBuilder(); - sb.append("Tomcat failed to detect this is a Comet application because context.xml "); - sb.append("is missing or the Http11NioProtocol Connector is not enabled."); - sb.append("You must use the atmosphere-native-runtime dependency in order to use native Comet Support"); - sb.append("\nIf that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar"); - return sb.toString(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketHandler.java deleted file mode 100644 index 5b8c9de3304..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.apache.catalina.websocket.StreamInbound; -import org.apache.catalina.websocket.WsOutbound; -import org.atmosphere.container.version.TomcatWebSocket; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.nio.CharBuffer; -import java.util.concurrent.atomic.AtomicBoolean; - -public class TomcatWebSocketHandler extends StreamInbound { - - private static final Logger logger = LoggerFactory.getLogger(TomcatWebSocketHandler.class); - - private final WebSocketProcessor webSocketProcessor; - private final AtmosphereRequest request; - private final AtmosphereFramework framework; - private WebSocket webSocket; - private final int webSocketWriteTimeout; - // Tomcat may invoke onClose several time. - private final AtomicBoolean isClosed = new AtomicBoolean(); - - public TomcatWebSocketHandler(AtmosphereRequest request, AtmosphereFramework framework, WebSocketProcessor webSocketProcessor) { - this.request = request; - this.framework = framework; - this.webSocketProcessor = webSocketProcessor; - - String s = framework.getAtmosphereConfig().getInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME); - if (s != null) { - webSocketWriteTimeout = Integer.valueOf(s); - } else { - webSocketWriteTimeout = -1; - } - - s = framework.getAtmosphereConfig().getInitParameter(ApplicationConfig.WEBSOCKET_BUFFER_SIZE); - if (s != null) { - setOutboundByteBufferSize(Integer.valueOf(s)); - setOutboundCharBufferSize(getOutboundByteBufferSize()); - } - } - - @Override - protected void onOpen(WsOutbound outbound) { - logger.trace("WebSocket.onOpen."); - webSocket = new TomcatWebSocket(outbound, framework.getAtmosphereConfig()); - try { - webSocketProcessor.open(webSocket, request, AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), request, webSocket)); - } catch (Exception e) { - logger.warn("failed to connect to web socket", e); - } - } - - @Override - protected void onClose(int closeCode) { - if (webSocketProcessor == null || isClosed.getAndSet(true)) return; - - logger.trace("onClose {}", closeCode); - try { - webSocketProcessor.close(webSocket, closeCode); - } finally { - request.destroy(); - } - } - - protected void onTextMessage(CharBuffer message) throws IOException { - logger.trace("WebSocket.onMessage"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, message.toString()); - } - - @Override - protected final void onBinaryData(InputStream is) throws IOException { - logger.trace("WebSocket.onBynaryStream"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, is); - } - - @Override - protected final void onTextData(Reader r) throws IOException { - logger.trace("WebSocket.onTextStream"); - webSocketProcessor.invokeWebSocketProtocol(webSocket, r); - } - - @Override - public int getReadTimeout() { - return webSocketWriteTimeout; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketUtil.java b/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketUtil.java deleted file mode 100644 index c2dfd605e17..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/TomcatWebSocketUtil.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.atmosphere.container; - -import org.apache.catalina.connector.RequestFacade; -import org.apache.catalina.websocket.StreamInbound; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.HeaderConfig; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; - -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_VERSION; - -public class TomcatWebSocketUtil { - private static final Logger logger = LoggerFactory.getLogger(TomcatWebSocketUtil.class); - private static final Queue sha1Helpers = new ConcurrentLinkedQueue(); - private static byte[] WS_ACCEPT; - - static { - try { - WS_ACCEPT = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes("ISO_8859_1"); - } catch (Exception e) { - logger.error("", e); - } - } - - - public static Action doService(AtmosphereRequest req, AtmosphereResponse res, - Delegate delegate, - AtmosphereConfig config, - WebSocketProcessor webSocketProcessor) throws IOException, ServletException { - // First, handshake - if (req.getAttribute(WebSocket.WEBSOCKET_SUSPEND) == null) { - - boolean useBuildInSession = config.isSupportSession(); - // Override the value. - String s = config.getInitParameter(ApplicationConfig.BUILT_IN_SESSION); - if (s != null) { - useBuildInSession= Boolean.valueOf(s); - } - - // Information required to send the server handshake message - String key = null; - String subProtocol = null; - - boolean allowWebSocketWithoutHeaders = req.getHeader(HeaderConfig.X_ATMO_WEBSOCKET_PROXY) != null ? true : false; - if (!allowWebSocketWithoutHeaders) { - if (!headerContainsToken(req, "Upgrade", "websocket")) { - return delegate.doService(req, res); - } - - if (!headerContainsToken(req, "Connection", "upgrade")) { - return delegate.doService(req, res); - } - - if (!headerContainsToken(req, WEBSOCKET_VERSION, "13")) { - WebSocket.notSupported(req, res); - return new Action(Action.TYPE.CANCELLED); - } - } - - key = req.getHeader("Sec-WebSocket-Key"); - if (key == null) { - return delegate.doService(req, res); - } - - String requireSameOrigin = config.getInitParameter(ApplicationConfig.WEBSOCKET_REQUIRE_SAME_ORIGIN); - - if (!webSocketProcessor.handshake(req)) { - res.sendError(HttpServletResponse.SC_FORBIDDEN, "WebSocket requests rejected."); - return new Action(Action.TYPE.CANCELLED); - } - - if (Boolean.valueOf(requireSameOrigin) && !verifyOrigin(req)) { - res.sendError(HttpServletResponse.SC_FORBIDDEN, "Origin header does not match expected value"); - return new Action(Action.TYPE.CANCELLED); - } - - // If we got this far, all is good. Accept the connection. - res.setHeader("Upgrade", "websocket"); - res.setHeader("Connection", "upgrade"); - res.setHeader("Sec-WebSocket-Accept", getWebSocketAccept(key)); - - if (subProtocol != null) { - res.setHeader("Sec-WebSocket-Protocol", subProtocol); - } - - HttpServletRequest hsr = req.wrappedRequest(); - while (hsr instanceof HttpServletRequestWrapper) - hsr = (HttpServletRequest) ((HttpServletRequestWrapper) hsr).getRequest(); - - RequestFacade facade = (RequestFacade) hsr; - boolean isDestroyable = false; - s = config.getInitParameter(ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE); - if (s != null && Boolean.valueOf(s)) { - isDestroyable = true; - } - StreamInbound inbound = new TomcatWebSocketHandler( - AtmosphereRequestImpl.cloneRequest(req, true, useBuildInSession, isDestroyable, config.getInitParameter(PROPERTY_SESSION_CREATE, true)), - config.framework(), webSocketProcessor); - facade.doUpgrade(inbound); - return new Action(Action.TYPE.CREATED); - } - - try { - Action action = delegate.suspended(req, res); - if (action.type() == Action.TYPE.RESUME) { - req.setAttribute(WebSocket.WEBSOCKET_RESUME, true); - } - return action; - } catch (Exception ex) { - logger.warn("", ex); - } - return Action.CANCELLED; - } - - private static boolean verifyOrigin(HttpServletRequest req) { - String origin = req.getHeader("Origin"); - if (origin == null) { - return false; - } - - try { - URI requestUri = new URI(req.getRequestURL().toString()); - URI originUri = new URI(origin); - - // First check that the protocol (http, https, etc) is not null and matches - if (requestUri.getScheme() != null && originUri.getScheme() != null && - requestUri.getScheme().equals(originUri.getScheme())) { - - // If the authority (userinfo@hostname:port) is not null and matches, then the origin is verified - if (requestUri.getAuthority() != null && originUri.getAuthority() != null && - requestUri.getAuthority().equals(originUri.getAuthority())) { - return true; - } - } - } catch (URISyntaxException e) { - logger.error("Unable to verify request origin", e); - } - - return false; - } - - /* - * This only works for tokens. Quoted strings need more sophisticated - * parsing. - */ - private static boolean headerContainsToken(HttpServletRequest req, - String headerName, String target) { - Enumeration headers = req.getHeaders(headerName); - while (headers.hasMoreElements()) { - String header = headers.nextElement(); - String[] tokens = header.split(","); - for (String token : tokens) { - if (target.equalsIgnoreCase(token.trim())) { - return true; - } - } - } - return false; - } - - - /* - * This only works for tokens. Quoted strings need more sophisticated - * parsing. - */ - private static List getTokensFromHeader(HttpServletRequest req, - String headerName) { - List result = new ArrayList(); - - Enumeration headers = req.getHeaders(headerName); - while (headers.hasMoreElements()) { - String header = headers.nextElement(); - String[] tokens = header.split(","); - for (String token : tokens) { - result.add(token.trim()); - } - } - return result; - } - - - private static String getWebSocketAccept(String key) throws ServletException { - - MessageDigest sha1Helper = sha1Helpers.poll(); - if (sha1Helper == null) { - try { - sha1Helper = MessageDigest.getInstance("SHA1"); - } catch (NoSuchAlgorithmException e) { - throw new ServletException(e); - } - } - - sha1Helper.reset(); - try { - sha1Helper.update(key.getBytes("ISO_8859_1")); - } catch (UnsupportedEncodingException e) { - throw new ServletException(e); - } - String result = org.apache.catalina.util.Base64.encode(sha1Helper.digest(WS_ACCEPT)); - - sha1Helpers.add(sha1Helper); - - return result; - } - - public static interface Delegate { - public Action doService(AtmosphereRequest req, AtmosphereResponse res) - throws IOException, ServletException; - - public Action suspended(AtmosphereRequest request, AtmosphereResponse response) - throws IOException, ServletException; - - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/WebLogicServlet30WithWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/WebLogicServlet30WithWebSocket.java deleted file mode 100644 index c6497db821b..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/WebLogicServlet30WithWebSocket.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.cpr.AtmosphereConfig; - -public class WebLogicServlet30WithWebSocket extends Servlet30CometSupport { - - public WebLogicServlet30WithWebSocket(AtmosphereConfig config) { - super(config); - } - - public boolean supportWebSocket() { - return true; - } - - @Override - public String getContainerName() { - return super.getContainerName() + " using javax.servlet/3.0 and Native WebSocket API"; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/WeblogicWebSocketHandler.java b/modules/cpr/src/main/java/org/atmosphere/container/WeblogicWebSocketHandler.java deleted file mode 100644 index 1567a316cba..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/WeblogicWebSocketHandler.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container; - -import org.atmosphere.container.version.WebLogicWebSocket; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.WebSocketProcessorFactory; -import org.atmosphere.websocket.WebSocket; -import org.atmosphere.websocket.WebSocketEventListener; -import org.atmosphere.websocket.WebSocketProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import weblogic.websocket.ClosingMessage; -import weblogic.websocket.WSHandshakeRequest; -import weblogic.websocket.WSHandshakeResponse; -import weblogic.websocket.WebSocketConnection; -import weblogic.websocket.WebSocketContext; -import weblogic.websocket.WebSocketListener; - -import javax.servlet.ServletContext; -import java.io.IOException; - -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; - -@weblogic.websocket.annotation.WebSocket(pathPatterns = "/ws/*", timeout = -1, maxMessageSize = 8192) -public class WeblogicWebSocketHandler implements WebSocketListener { - - private final Logger logger = LoggerFactory.getLogger(WeblogicWebSocketHandler.class); - private WebSocketProcessor webSocketProcessor; - private AtmosphereConfig config; - private Integer maxTextBufferSize; - private int webSocketWriteTimeout; - private final ThreadLocal request = new ThreadLocal(); - - @Override - public void init(WebSocketContext webSocketContext) { - logger.info("WebSocketContext initialized {}", webSocketContext); - configure(webSocketContext.getServletContext()); - } - - @Override - public void destroy() { - - } - - @Override - public boolean accept(WSHandshakeRequest wsHandshakeRequest, WSHandshakeResponse wsHandshakeResponse) { - request.set(wsHandshakeRequest); - return true; - } - - @Override - public void onOpen(WebSocketConnection webSocketConnection) { - if (webSocketWriteTimeout != -1) - webSocketConnection.getWebSocketContext().setTimeoutSecs(webSocketWriteTimeout); - if (maxTextBufferSize != -1) webSocketConnection.getWebSocketContext().setMaxMessageSize(maxTextBufferSize); - - WebSocket webSocket = new WebLogicWebSocket(webSocketConnection, config); - // TODO: Dangerous - webSocketConnection.getWebSocketContext().getServletContext().setAttribute(webSocketConnection.toString(), webSocket); - - AtmosphereRequest ar = AtmosphereRequestImpl.cloneRequest(request.get(), true, true, true, config.getInitParameter(PROPERTY_SESSION_CREATE, true)); - // https://github.com/Atmosphere/atmosphere/issues/1854 - // We need to force processing of the query string. - ar.queryString(ar.getQueryString()); - request.set(null); - try { - webSocketProcessor.open(webSocket, ar, AtmosphereResponseImpl.newInstance(config, ar, webSocket)); - } catch (IOException e) { - logger.error("{}", e); - } - - } - - @Override - public void onMessage(WebSocketConnection webSocketConnection, String s) { - WebSocket webSocket = (WebSocket) webSocketConnection.getWebSocketContext().getServletContext().getAttribute(webSocketConnection.toString()); - - webSocketProcessor.invokeWebSocketProtocol(webSocket, s); - } - - @Override - public void onMessage(WebSocketConnection webSocketConnection, byte[] bytes) { - WebSocket webSocket = (WebSocket) webSocketConnection.getWebSocketContext().getServletContext().getAttribute(webSocketConnection.toString()); - - webSocketProcessor.invokeWebSocketProtocol(webSocket, bytes, 0, bytes.length); - } - - @Override - public void onFragment(WebSocketConnection webSocketConnection, boolean b, String s) { - logger.trace("Warning, Fragment not supported"); - onMessage(webSocketConnection, s); - } - - @Override - public void onFragment(WebSocketConnection webSocketConnection, boolean b, byte[] bytes) { - logger.trace("Warning, Fragment not supported"); - onMessage(webSocketConnection, bytes); - } - - @Override - public void onPing(WebSocketConnection webSocketConnection, byte[] bytes) { - logger.trace("Warning, Fragment not supported"); - } - - @Override - public void onPong(WebSocketConnection webSocketConnection, byte[] bytes) { - logger.trace("Warning, Fragment not supported"); - } - - @Override - public void onTimeout(WebSocketConnection webSocketConnection) { - WebSocket webSocket = (WebSocket) webSocketConnection.getWebSocketContext().getServletContext().getAttribute(webSocketConnection.toString()); - - webSocketProcessor.close(webSocket, 1000); - } - - @Override - public void onError(WebSocketConnection webSocketConnection, Throwable throwable) { - WebSocket webSocket = (WebSocket) webSocketConnection.getWebSocketContext().getServletContext().getAttribute(webSocketConnection.toString()); - webSocketConnection.getWebSocketContext().getServletContext().removeAttribute(webSocketConnection.toString()); - - webSocketProcessor.notifyListener(webSocket, new WebSocketEventListener.WebSocketEvent(throwable, WebSocketEventListener.WebSocketEvent.TYPE.EXCEPTION, webSocket)); - } - - @Override - public void onClose(WebSocketConnection webSocketConnection, ClosingMessage closingMessage) { - WebSocket webSocket = (WebSocket) webSocketConnection.getWebSocketContext().getServletContext().getAttribute(webSocketConnection.toString()); - webSocketConnection.getWebSocketContext().getServletContext().removeAttribute(webSocketConnection.toString()); - - webSocketProcessor.close(webSocket, closingMessage.getStatusCode()); - } - - private void configure(ServletContext servletContext) { - config = (AtmosphereConfig) servletContext.getAttribute(AtmosphereConfig.class.getName()); - webSocketProcessor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(config.framework()); - - String s = config.getInitParameter(ApplicationConfig.WEBSOCKET_IDLETIME); - if (s != null) { - webSocketWriteTimeout = Integer.valueOf(s); - } else { - webSocketWriteTimeout = -1; - } - - s = config.getInitParameter(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE); - if (s != null) { - maxTextBufferSize = Integer.valueOf(s); - } else { - maxTextBufferSize = -1; - } - } -} - diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/Grizzly2WebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/Grizzly2WebSocket.java deleted file mode 100644 index 30b938602c2..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/Grizzly2WebSocket.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright 2017 Async-IO.org -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not -* use this file except in compliance with the License. You may obtain a copy of -* the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations under -* the License. -*/ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.websocket.WebSocket; - -import java.io.IOException; -import java.util.Arrays; - -public class Grizzly2WebSocket extends WebSocket { - - private final org.glassfish.grizzly.websockets.WebSocket webSocket; - - public Grizzly2WebSocket(org.glassfish.grizzly.websockets.WebSocket webSocket, AtmosphereConfig config) { - super(config); - this.webSocket = webSocket; - } - - @Override - public boolean isOpen() { - return webSocket.isConnected(); - } - - @Override - public WebSocket write(String s) throws IOException { - webSocket.send(s); - return this; - } - - @Override - public WebSocket write(byte[] data, int offset, int length) throws IOException { - webSocket.send(Arrays.copyOfRange(data, offset, length)); - return this; - } - - @Override - public void close() { - logger.trace("WebSocket.close() for AtmosphereResource {}", resource() != null ? resource().uuid() : "null"); - webSocket.close(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/GrizzlyWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/GrizzlyWebSocket.java deleted file mode 100644 index f0417acc295..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/GrizzlyWebSocket.java +++ /dev/null @@ -1,67 +0,0 @@ -/* -* Copyright 2017 Async-IO.org -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not -* use this file except in compliance with the License. You may obtain a copy of -* the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations under -* the License. -*/ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.Arrays; - -public final class GrizzlyWebSocket extends WebSocket { - - private static final Logger logger = LoggerFactory.getLogger(GrizzlyWebSocket.class); - private final com.sun.grizzly.websockets.WebSocket webSocket; - - public GrizzlyWebSocket(com.sun.grizzly.websockets.WebSocket webSocket, AtmosphereConfig config) { - super(config); - this.webSocket = webSocket; - } - - @Override - public boolean isOpen() { - return webSocket.isConnected(); - } - - @Override - public WebSocket write(String s) throws IOException { - logger.trace("WebSocket.write() for {}", resource() != null ? resource().uuid() : ""); - webSocket.send(s); - return this; - } - - @Override - public WebSocket write(byte[] data, int offset, int length) throws IOException { - logger.trace("WebSocket.write() for {}", resource() != null ? resource().uuid() : ""); - webSocket.send(Arrays.copyOfRange(data, offset, length)); - return this; - } - - @Override - public void close() { - logger.trace("WebSocket.close() for AtmosphereResource {}", resource() != null ? resource().uuid() : "null"); - webSocket.close(); - } - - @Override - public WebSocket flush(AtmosphereResponse r) throws IOException { - logger.trace("WebSocket.flush() not supported by Grizzly"); - return this; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/JBossWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/JBossWebSocket.java deleted file mode 100644 index f8278a271f7..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/JBossWebSocket.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017 Péter Miklós - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.jboss.as.websockets.WebSocket; -import org.atmosphere.jboss.websockets.frame.BinaryFrame; -import org.atmosphere.jboss.websockets.frame.TextFrame; - -import java.io.IOException; -import java.util.Arrays; - -/** - * Adapts a JBoss {@link WebSocket} to an Atmosphere {@link org.atmosphere.websocket.WebSocket}. - * - * @author Péter Miklós - */ -public class JBossWebSocket extends org.atmosphere.websocket.WebSocket { - - private final WebSocket webSocket; - - public JBossWebSocket(WebSocket webSocket, AtmosphereConfig config) { - super(config); - this.webSocket = webSocket; - } - - @Override - public boolean isOpen() { - return true; - } - - @Override - public org.atmosphere.websocket.WebSocket write(String s) throws IOException { - webSocket.writeFrame(TextFrame.from(s)); - return this; - } - - @Override - public org.atmosphere.websocket.WebSocket write(byte[] b, int offset, int length) throws IOException { - webSocket.writeFrame(BinaryFrame.from(Arrays.copyOfRange(b, offset, length))); - return this; - } - - @Override - public void close() { - try { - logger.trace("WebSocket.close() for AtmosphereResource {}", resource() != null ? resource().uuid() : "null"); - webSocket.closeSocket(); - } catch (Exception e) { - logger.trace("Error closing websocket.", e); - } - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty8WebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty8WebSocket.java deleted file mode 100644 index b4855b480db..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty8WebSocket.java +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Copyright 2017 Async-IO.org -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not -* use this file except in compliance with the License. You may obtain a copy of -* the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations under -* the License. -*/ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.websocket.WebSocket; -import org.eclipse.jetty.websocket.WebSocket.Connection; - -import java.io.IOException; - -/** - * Jetty 8 WebSocket support. - * - * @author Jeanfrancois Arcand - */ -public class Jetty8WebSocket extends WebSocket { - - private final Connection connection; - - public Jetty8WebSocket(Connection connection, AtmosphereConfig config) { - super(config); - this.connection = connection; - } - - @Override - public String toString() { - return connection.toString(); - } - - @Override - public boolean isOpen() { - return connection.isOpen(); - } - - @Override - public WebSocket write(String s) throws IOException { - logger.trace("WebSocket.write() for {}", resource() != null ? resource().uuid() : ""); - connection.sendMessage(s); - return this; - } - - @Override - public WebSocket write(byte[] b, int offset, int length) throws IOException { - logger.trace("WebSocket.write() for {}", resource() != null ? resource().uuid() : ""); - connection.sendMessage(b, offset, length); - return this; - } - - @Override - public void close() { - logger.trace("WebSocket.close() for AtmosphereResource {}", resource() != null ? resource().uuid() : "null"); - connection.close(); - } - - @Override - public WebSocket flush(AtmosphereResponse r) throws IOException { - logger.trace("WebSocket.flush() not supported by Jetty"); - return this; - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty9WebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty9WebSocket.java deleted file mode 100644 index 57b6fd5383b..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/Jetty9WebSocket.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright 2017 Async-IO.org -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not -* use this file except in compliance with the License. You may obtain a copy of -* the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -* License for the specific language governing permissions and limitations under -* the License. -*/ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.websocket.WebSocket; -import org.eclipse.jetty.websocket.api.Session; - -import java.io.IOException; -import java.nio.ByteBuffer; - -public class Jetty9WebSocket extends WebSocket { - - private final Session webSocketConnection; - - public Jetty9WebSocket(Session webSocketConnection, AtmosphereConfig config) { - super(config); - this.webSocketConnection = webSocketConnection; - } - - @Override - public boolean isOpen() { - return webSocketConnection.isOpen(); - } - - @Override - public WebSocket write(String s) throws IOException { - if (isOpen()) webSocketConnection.getRemote().sendStringByFuture(s); - return this; - } - - @Override - public WebSocket write(byte[] b, int offset, int length) throws IOException { - if (isOpen()) webSocketConnection.getRemote().sendBytesByFuture(ByteBuffer.wrap(b, offset, length)); - return this; - } - - @Override - public void close() { - if (!isOpen()) return; - logger.trace("WebSocket.close() for AtmosphereResource {}", resource() != null ? resource().uuid() : "null"); - try { - webSocketConnection.close(); - // 9.0 -> 9.1 change } catch (IOException e) { - } catch (Throwable e) { - logger.trace("Close error", e); - } - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/TomcatWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/TomcatWebSocket.java deleted file mode 100644 index 652569b0fef..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/TomcatWebSocket.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container.version; - -import org.apache.catalina.websocket.WsOutbound; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * Tomcat WebSocket Support - * - * @author Jeanfrancois Arcand - */ -public class TomcatWebSocket extends WebSocket { - - private static final Logger logger = LoggerFactory.getLogger(TomcatWebSocket.class); - - private final WsOutbound outbound; - private AtomicBoolean isOpen = new AtomicBoolean(true); - private AtomicBoolean isClosed = new AtomicBoolean(); - private final ByteBuffer closeCode = ByteBuffer.wrap(new byte[0]); - - public TomcatWebSocket(WsOutbound outbound, AtmosphereConfig config) { - super(config); - this.outbound = outbound; - } - - @Override - public boolean isOpen() { - return isOpen.get(); - } - - @Override - public WebSocket write(String s) throws IOException { - logger.trace("WebSocket.write() for {}", uuid); - outbound.writeTextMessage(CharBuffer.wrap(s)); - return this; - } - - @Override - public WebSocket write(byte[] b, int offset, int length) throws IOException { - logger.trace("WebSocket.write() for {}", uuid); - outbound.writeBinaryMessage(ByteBuffer.wrap(b, offset, length)); - return this; - } - - @Override - public void close() { - close(uuid()); - } - - @Override - public void close(AtmosphereResponse r) throws IOException { - close(r.uuid()); - } - - void close(String uuid) { - isOpen.set(false); - - if (!isClosed.getAndSet(true)) { - try { - logger.trace("WebSocket.close() for AtmosphereResource {}", uuid); - outbound.close(1000, closeCode); - } catch (IOException e) { - // https://github.com/Atmosphere/atmosphere/issues/1646 - // Tomcat will go in limbo - logger.trace("", e); - } - } else { - logger.trace("Already closed {}", uuid); - } - } - - - @Override - public WebSocket flush(AtmosphereResponse r) throws IOException { - outbound.flush(); - return this; - } - - @Override - public String toString() { - return outbound.toString(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/WebLogicWebSocket.java b/modules/cpr/src/main/java/org/atmosphere/container/version/WebLogicWebSocket.java deleted file mode 100644 index fbe643273ab..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/WebLogicWebSocket.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.container.version; - -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.websocket.WebSocket; -import weblogic.websocket.WebSocketConnection; - -import java.io.IOException; -import java.util.Arrays; - -public class WebLogicWebSocket extends WebSocket { - - private final WebSocketConnection webSocketConnection; - - public WebLogicWebSocket(WebSocketConnection webSocketConnection, AtmosphereConfig config) { - super(config); - this.webSocketConnection = webSocketConnection; - } - - - @Override - public boolean isOpen() { - return webSocketConnection.isOpen(); - } - - @Override - public WebSocket write(String s) throws IOException { - webSocketConnection.send(s); - return this; - } - - @Override - public WebSocket write(byte[] b, int offset, int length) throws IOException { - webSocketConnection.send(Arrays.copyOfRange(b, offset, length)); - return this; - } - - @Override - public void close() { - try { - webSocketConnection.close(1005); - } catch (IOException e) { - e.printStackTrace(); - } - } - - -} diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAsyncSupportResolver.java b/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAsyncSupportResolver.java deleted file mode 100644 index 11f1aa783b1..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAsyncSupportResolver.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - - -package org.atmosphere.cpr; - -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.container.GlassFishServ30WebSocketSupport; -import org.atmosphere.container.GlassFishWebSocketSupport; -import org.atmosphere.container.GlassFishv2CometSupport; -import org.atmosphere.container.Grizzly2CometSupport; -import org.atmosphere.container.Grizzly2WebSocketSupport; -import org.atmosphere.container.GrizzlyCometSupport; -import org.atmosphere.container.GrizzlyServlet30WebSocketSupport; -import org.atmosphere.container.JBossAsyncSupportWithWebSocket; -import org.atmosphere.container.JBossWebCometSupport; -import org.atmosphere.container.JSR356AsyncSupport; -import org.atmosphere.container.Jetty7CometSupport; -import org.atmosphere.container.Jetty9AsyncSupportWithWebSocket; -import org.atmosphere.container.JettyAsyncSupportWithWebSocket; -import org.atmosphere.container.JettyCometSupport; -import org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket; -import org.atmosphere.container.NettyCometSupport; -import org.atmosphere.container.Servlet30CometSupport; -import org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket; -import org.atmosphere.container.Tomcat7CometSupport; -import org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket; -import org.atmosphere.container.TomcatCometSupport; -import org.atmosphere.container.WebLogicServlet30WithWebSocket; -import org.atmosphere.util.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.LinkedList; -import java.util.List; - -/** - * This is the default implementation of @link {AsyncSupportResolver}. - * - * @author Viktor Klang - */ -public class DefaultAsyncSupportResolver implements AsyncSupportResolver { - - private static final Logger logger = LoggerFactory.getLogger(DefaultAsyncSupportResolver.class); - - public final static String SERVLET_30 = "javax.servlet.AsyncListener"; - public final static String GLASSFISH_V2 = "com.sun.enterprise.web.PEWebContainer"; - public final static String TOMCAT_7 = "org.apache.catalina.comet.CometFilterChain"; - public final static String TOMCAT_WEBSOCKET = "org.apache.coyote.http11.upgrade.UpgradeInbound"; - public final static String TOMCAT = "org.apache.coyote.http11.Http11NioProcessor"; - public final static String JBOSS_5 = "org.jboss."; - public final static String JETTY = "org.mortbay.util.ajax.Continuation"; - public final static String JETTY_7 = "org.eclipse.jetty.servlet.ServletContextHandler"; - public final static String JETTY_8 = "org.eclipse.jetty.continuation.Servlet3Continuation"; - public final static String JETTY_9 = "org.eclipse.jetty.websocket.api.WebSocketPolicy"; - public final static String GRIZZLY = "com.sun.grizzly.http.servlet.ServletAdapter"; - public final static String GRIZZLY2 = "org.glassfish.grizzly.http.servlet.ServletHandler"; - public final static String JBOSSWEB = "org.apache.catalina.connector.HttpEventImpl"; - public final static String GRIZZLY_WEBSOCKET = "com.sun.grizzly.websockets.WebSocketEngine"; - public final static String GRIZZLY2_WEBSOCKET = "org.glassfish.grizzly.websockets.WebSocketEngine"; - public final static String NETTY = "org.jboss.netty.channel.Channel"; - public final static String JBOSS_AS7_WEBSOCKET = "org.atmosphere.jboss.as.websockets.servlet.WebSocketServlet"; - public final static String JSR356_WEBSOCKET = "javax.websocket.Endpoint"; - public final static String WEBLOGIC_WEBSOCKET = "weblogic.websocket.annotation.WebSocket"; - public final static String HK2 = "org.glassfish.hk2.utilities.reflection.ReflectionHelper"; - - private final AtmosphereConfig config; - - private final boolean suppress356; - - public DefaultAsyncSupportResolver(final AtmosphereConfig config) { - this.config = config; - this.suppress356 = - Boolean.parseBoolean(config.getInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356)); - } - - /** - * Convenience method that tests if a class with the given FQN is present on the classpath. - * - * @param testClass - * @return true if the class is present - */ - protected boolean testClassExists(final String testClass) { - try { - final boolean exists = testClass != null && testClass.length() > 0 && IOUtils.loadClass(null, testClass) != null; - logger.debug(exists ? "Found {}" : "Not found {}", testClass); - return exists; - } catch (Exception ex) { - return false; - } - } - - /** - * Returns a list of comet support by containers available on the classpath. - * - * @return - */ - public List> detectContainersPresent() { - return new LinkedList>() { - { - if (testClassExists(GLASSFISH_V2)) - add(GlassFishv2CometSupport.class); - - if (testClassExists(JETTY_9)) - add(Jetty7CometSupport.class); - - if (testClassExists(JETTY_8)) - add(Jetty7CometSupport.class); - - if (testClassExists(JETTY_7)) - add(Jetty7CometSupport.class); - - if (testClassExists(JETTY)) - add(JettyCometSupport.class); - - if (testClassExists(JBOSSWEB)) - add(JBossWebCometSupport.class); - - if (testClassExists(TOMCAT_7)) - add(Tomcat7CometSupport.class); - - if (testClassExists(TOMCAT) || testClassExists(JBOSS_5)) - add(TomcatCometSupport.class); - - if (testClassExists(GRIZZLY)) - add(GrizzlyCometSupport.class); - - if (testClassExists(GRIZZLY2)) - add(Grizzly2CometSupport.class); - - if (testClassExists(NETTY)) - add(NettyCometSupport.class); - } - }; - } - - public List> detectWebSocketPresent(final boolean useNativeIfPossible, final boolean useServlet30Async) { - - return new LinkedList>() { - { - if (useServlet30Async && !useNativeIfPossible) { - - if (!suppress356 && testClassExists(JSR356_WEBSOCKET)) { - add(JSR356AsyncSupport.class); - } else { - - if (testClassExists(TOMCAT_WEBSOCKET)) - add(Tomcat7Servlet30SupportWithWebSocket.class); - - if (testClassExists(JETTY_9)) - add(Jetty9AsyncSupportWithWebSocket.class); - - if (testClassExists(JETTY_8)) - add(JettyServlet30AsyncSupportWithWebSocket.class); - - if (testClassExists(GRIZZLY2_WEBSOCKET)) - add(GlassFishServ30WebSocketSupport.class); - - if (testClassExists(GRIZZLY_WEBSOCKET)) - add(GrizzlyServlet30WebSocketSupport.class); - - if (testClassExists(WEBLOGIC_WEBSOCKET) && !testClassExists(HK2)) { - logger.warn("***************************************************************************************************"); - logger.warn("WebLogic WebSocket detected and will be deployed under the hardcoded path <>/ws/*"); - logger.warn("***************************************************************************************************"); - add(WebLogicServlet30WithWebSocket.class); - } - } - } else { - if (!suppress356 && testClassExists(JSR356_WEBSOCKET)) { - add(JSR356AsyncSupport.class); - } else { - if (testClassExists(TOMCAT_WEBSOCKET)) - add(Tomcat7AsyncSupportWithWebSocket.class); - - if (testClassExists(JETTY_9)) - add(Jetty9AsyncSupportWithWebSocket.class); - - if (testClassExists(JETTY_8)) - add(JettyAsyncSupportWithWebSocket.class); - - if (testClassExists(GRIZZLY_WEBSOCKET)) - add(GlassFishWebSocketSupport.class); - - if (testClassExists(GRIZZLY2_WEBSOCKET)) - add(Grizzly2WebSocketSupport.class); - - if (testClassExists(JBOSS_AS7_WEBSOCKET)) - add(JBossAsyncSupportWithWebSocket.class); - } - - } - } - }; - } - - /** - * This method is used to determine the default AsyncSupport if all else fails. - * - * @param preferBlocking - * @return - */ - public AsyncSupport defaultCometSupport(final boolean preferBlocking) { - if (!preferBlocking && testClassExists(SERVLET_30)) { - return new Servlet30CometSupport(config); - } else { - return new BlockingIOCometSupport(config); - } - } - - /** - * Given a Class of something that extends AsyncSupport, it tries to return an instance of that class. - *

- * The class has to have a visible constructor with the signature (@link {AtmosphereConfig}). - * - * @param targetClass - * @return an instance of the specified class or null if the class cannot be instantiated - */ - public AsyncSupport newCometSupport(final Class targetClass) { - try { - return (AsyncSupport) targetClass.getDeclaredConstructor(new Class[]{AtmosphereConfig.class}) - .newInstance(config); - } catch (final Exception e) { - logger.warn("Failed to create AsyncSupport class: {}, error: {}", targetClass, e); - - Throwable cause = e.getCause(); - if (cause != null) { - logger.error("Real error: {}", cause.getMessage(), cause); - } - return null; - } - } - - public AsyncSupport newCometSupport(final String targetClassFQN) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - return (AsyncSupport) cl.loadClass(targetClassFQN) - .getDeclaredConstructor(new Class[]{AtmosphereConfig.class}).newInstance(config); - } catch (final Exception e) { - logger.error("Failed to create AsyncSupport class: {}, error: {}", targetClassFQN, e); - Throwable cause = e.getCause(); - if (cause != null) { - logger.error("Real error: {}", cause.getMessage(), cause); - } - throw new IllegalArgumentException("Unable to create " + targetClassFQN, e); - } - } - - /** - * This method is the general interface to the outside world. - * - * @param useNativeIfPossible - should the resolver try to use a native container comet support if present? - * @param defaultToBlocking - should the resolver default to blocking IO comet support? - * @return an instance of AsyncSupport - */ - public AsyncSupport resolve(final boolean useNativeIfPossible, final boolean defaultToBlocking) { - final AsyncSupport servletAsyncSupport = defaultCometSupport(defaultToBlocking); - - final AsyncSupport nativeSupport; - if (!defaultToBlocking && (useNativeIfPossible || - servletAsyncSupport.getClass().getName().equals(BlockingIOCometSupport.class.getName()))) { - nativeSupport = resolveNativeCometSupport(detectContainersPresent()); - return nativeSupport == null ? servletAsyncSupport : nativeSupport; - } - return servletAsyncSupport; - } - - @Override - public AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking, boolean useServlet30Async) { - AsyncSupport cs = null; - - // Validate the value for old Servlet Container. - useServlet30Async = testClassExists(SERVLET_30); - - if (!defaultToBlocking) { - List> l = detectWebSocketPresent(useNativeIfPossible, useServlet30Async); - - if (!l.isEmpty()) { - cs = resolveWebSocket(l); - } - } - - if (cs == null) { - AsyncSupport nativeSupport = resolveNativeCometSupport(detectContainersPresent()); - return nativeSupport == null ? defaultCometSupport(defaultToBlocking) : nativeSupport; - } else { - return cs; - } - } - - public AsyncSupport resolveWebSocket(final java.util.List> available) { - if (available == null || available.isEmpty()) return null; - else return newCometSupport(available.get(0)); - } - - /** - * This method is called to determine which native comet support to the used. - * - * @param available - * @return the result of @link {resolveMultipleNativeSupportConflict} if there are more than 1 item in the list of available ontainers - */ - protected AsyncSupport resolveNativeCometSupport(final java.util.List> available) { - if (available == null || available.isEmpty()) return null; - else if (available.size() == 1) return newCometSupport(available.get(0)); - else return resolveMultipleNativeSupportConflict(available); - } - - /** - * This method is called if there are more than one potential native container in scope. - * - * @return a AsyncSupport instance - */ - protected AsyncSupport resolveMultipleNativeSupportConflict(final List> available) { - final StringBuilder b = new StringBuilder("Found multiple containers, please specify which one to use: "); - for (Class cs : available) { - b.append((cs != null) ? cs.getCanonicalName() : "null").append(", "); - } - - b.append(" until you do, Atmosphere will use:" + available.get(0)); - logger.warn("{}", b.toString()); - return newCometSupport(available.get(0)); - } -} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Meteor.java b/modules/cpr/src/main/java/org/atmosphere/cpr/Meteor.java deleted file mode 100755 index 64a92354e8e..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Meteor.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.cpr; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.atmosphere.cpr.AtmosphereResourceImpl.METEOR; -import static org.atmosphere.cpr.FrameworkConfig.ATMOSPHERE_RESOURCE; - -/** - * A {@link Meteor} is a simple class that can be used from a {@link javax.servlet.Servlet} - * to suspend, broadcast and resume responses. A {@link Meteor} can be created by invoking - * the build() method. - *

- * Meteor.build(HttpServletRequest).suspend(-1); - *

- * A Meteor is usually created when an application needs to suspend a response. - * A Meteor instance can then be cached and re-used later for either - * broadcasting a message, or when an application needs to resume the - * suspended response. - * - * @author Jeanfrancois Arcand - */ -public class Meteor { - - private static final Logger logger = LoggerFactory.getLogger(Meteor.class); - - private final AtmosphereResource r; - private Object o; - private AtomicBoolean isDestroyed = new AtomicBoolean(false); - - private Meteor(AtmosphereResource r, - List l, Serializer s) { - - this.r = r; - this.r.setSerializer(s); - if (l != null) { - for (BroadcastFilter f : l) { - this.r.getBroadcaster().getBroadcasterConfig().addFilter(f); - } - } - } - - /** - * Retrieve an instance of {@link Meteor} based on the {@link HttpServletRequest}. - * - * @param r {@link HttpServletRequest} - * @return a {@link Meteor} or null if not found - */ - public static Meteor lookup(HttpServletRequest r) { - Object o = r.getAttribute(METEOR); - return o == null ? null : Meteor.class.isAssignableFrom(o.getClass()) ? Meteor.class.cast(o) : null; - } - - /** - * Create a {@link Meteor} using the {@link HttpServletRequest}. - * - * @param r an {@link HttpServletRequest} - * @return a {@link Meteor} than can be used to resume, suspend and broadcast {@link Object} - */ - public final static Meteor build(HttpServletRequest r) { - return build(r, null); - } - - /** - * Create a {@link Meteor} using the {@link HttpServletRequest} and use the - * {@link Serializer} for writing the result of a broadcast operation using - * the {@link HttpServletResponse}. - * - * @param r an {@link HttpServletRequest} - * @param s a {@link Serializer} used when writing broadcast events - * @return a {@link Meteor} than can be used to resume, suspend and broadcast {@link Object} - */ - public final static Meteor build(HttpServletRequest r, Serializer s) { - return build(r, null, s); - } - - /** - * Create a {@link Meteor} using the {@link HttpServletRequest} and use a list of - * {@link BroadcastFilter} and {@link Serializer} for writing the result - * of a broadcast operation the {@link HttpServletResponse}. - * - * @param req an {@link HttpServletRequest} - * @param l a list of {@link BroadcastFilter} - * @param s a {@link Serializer} used when writing broadcast events - * @return a {@link Meteor} than can be used to resume, suspend and broadcast {@link Object} - */ - public final static Meteor build(HttpServletRequest req, List l, Serializer s) { - return build(req, Broadcaster.SCOPE.APPLICATION, l, s); - } - - /** - * Create a {@link Meteor} using the {@link HttpServletRequest} and use a list of - * {@link BroadcastFilter} and {@link Serializer} for writing the result - * of a broadcast operation the {@link HttpServletResponse}. - * - * @param req an {@link HttpServletRequest} - * @param scope the {@link Broadcaster.SCOPE}} - * @param l a list of {@link BroadcastFilter} - * @param s a {@link Serializer} used when writing broadcast events - * @return a {@link Meteor} than can be used to resume, suspend and broadcast {@link Object} - */ - public final static Meteor build(HttpServletRequest req, Broadcaster.SCOPE scope, - List l, Serializer s) { - AtmosphereResource r = - (AtmosphereResource) - req.getAttribute(ATMOSPHERE_RESOURCE); - if (r == null) throw new IllegalStateException("MeteorServlet not defined in web.xml"); - - Broadcaster b = null; - if (scope == Broadcaster.SCOPE.REQUEST) { - try { - BroadcasterFactory f = r.getAtmosphereConfig().getBroadcasterFactory(); - b = f.get(DefaultBroadcaster.class, DefaultBroadcaster.class.getSimpleName() - + r.getAtmosphereConfig().uuidProvider().generateUuid()); - } catch (Throwable t) { - throw new RuntimeException(t); - } - b.setScope(scope); - r.setBroadcaster(b); - req.setAttribute(AtmosphereResourceImpl.SKIP_BROADCASTER_CREATION, Boolean.TRUE); - } - - Meteor m = new Meteor(r, l, (s != null ? s : r.getSerializer())); - req.setAttribute(METEOR, m); - return m; - } - - /** - * Suspend the underlying {@link HttpServletResponse}. Passing a value of -1 - * suspends the response forever. - * - * @param l the maximum time a response stay suspended - * @return {@link Meteor} - */ - public Meteor suspend(long l) { - if (destroyed()) return null; - r.suspend(l); - return this; - } - - /** - * Resume the Meteor after the first broadcast operation. This is useful when long-polling is used. - * - * @param resumeOnBroadcast - * @return this - */ - public Meteor resumeOnBroadcast(boolean resumeOnBroadcast) { - r.resumeOnBroadcast(resumeOnBroadcast); - return this; - } - - /** - * Return the current {@link org.atmosphere.cpr.AtmosphereResource.TRANSPORT}. The transport needs to be - * explicitly set by the client by adding the appropriate {@link HeaderConfig#X_ATMOSPHERE_TRANSPORT} value, - * which can be long-polling, streaming, websocket or JSONP. - * - * @return - */ - public AtmosphereResource.TRANSPORT transport() { - return r.transport(); - } - - /** - * Suspend the underlying {@link HttpServletResponse}. Passing a value of -1 - * suspends the response forever. - * - * @param timeout the maximum time a response stay suspended - * @param timeunit The time unit of the timeout value - * @return {@link Meteor} - */ - - public Meteor suspend(long timeout, TimeUnit timeunit) { - if (destroyed()) return null; - r.suspend(timeout, timeunit); - return this; - } - - /** - * Resume the underlying {@link HttpServletResponse}. - * - * @return {@link Meteor} - */ - public Meteor resume() { - if (destroyed()) return null; - r.resume(); - return this; - } - - /** - * Broadcast an {@link Object} to all suspended responses. - * - * @param o an {@link Object} - * @return {@link Meteor} - */ - public Meteor broadcast(Object o) { - if (destroyed()) return null; - r.getBroadcaster().broadcast(o); - return this; - } - - /** - * Schedule a periodic broadcast, in seconds. - * - * @param o an {@link Object} - * @param period period in seconds - * @return {@link Meteor} - */ - public Meteor schedule(Object o, long period) { - if (destroyed()) return null; - r.getBroadcaster().scheduleFixedBroadcast(o, period, TimeUnit.SECONDS); - return this; - } - - /** - * Schedule a delayed broadcast, in seconds. - * - * @param o an {@link Object} - * @param period period in seconds - * @return {@link Meteor} - */ - public Meteor delayBroadadcast(Object o, long period) { - if (destroyed()) return null; - r.getBroadcaster().delayBroadcast(o, period, TimeUnit.SECONDS); - return this; - } - - /** - * Return the underlying {@link Broadcaster}. - * - * @return - */ - public Broadcaster getBroadcaster() { - if (destroyed()) return null; - return r.getBroadcaster(); - } - - /** - * Set a {@link Broadcaster} instance. - * - * @param b - */ - public void setBroadcaster(Broadcaster b) { - if (destroyed()) return; - r.setBroadcaster(b); - } - - /** - * Return an {@link Object} with this {@link Meteor}. - * - * @return the {@link Object} - */ - public Object attachement() { - return o; - } - - /** - * Attach an {@link Object} with this {@link Meteor}. - * - * @return the {@link Object} - */ - public void attach(Object o) { - this.o = o; - } - - /** - * Add a {@link AtmosphereResourceEventListener} which gets invoked when - * responses are resuming, when the remote client closes the connection or - * when the a {@link Broadcaster#broadcast} operations occurs. - * - * @param e an instance of {@link AtmosphereResourceEventListener} - */ - public Meteor addListener(AtmosphereResourceEventListener e) { - if (!destroyed()) { - r.addEventListener(e); - } - return this; - } - - /** - * Remove a {@link AtmosphereResourceEventListener} which gets invoked when - * a response is resuming, when the remote client closes the connection or - * when the a {@link Broadcaster#broadcast} operations occurs. - * - * @param e an instance of {@link AtmosphereResourceEventListener} - */ - public Meteor removeListener(AtmosphereResourceEventListener e) { - if (!destroyed()) { - r.removeEventListener(e); - } - return this; - } - - /** - * Mark this instance as destroyed. No more operations will be allowed. - */ - public void destroy() { - isDestroyed.set(true); - } - - private boolean destroyed() { - if (isDestroyed.get()) { - logger.debug("This Meteor is destroyed and cannot be used."); - return true; - } - return false; - } - - /** - * Return the underlying {@link AtmosphereResource}. - * - * @return the underlying {@link AtmosphereResource} - */ - public AtmosphereResource getAtmosphereResource() { - return r; - } - - /** - * Return the {@link org.atmosphere.cpr.AtmosphereConfig} - * @return the {@link org.atmosphere.cpr.AtmosphereConfig} - */ - public AtmosphereConfig getAtmosphereConfig() { - return r.getAtmosphereConfig(); - } -} diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/MeteorServlet.java b/modules/cpr/src/main/java/org/atmosphere/cpr/MeteorServlet.java deleted file mode 100644 index 968b61ea3e6..00000000000 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/MeteorServlet.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.cpr; - -import org.atmosphere.handler.ReflectorServletProcessor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.Filter; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import static org.atmosphere.cpr.ApplicationConfig.FILTER_CLASS; -import static org.atmosphere.cpr.ApplicationConfig.FILTER_NAME; -import static org.atmosphere.cpr.ApplicationConfig.MAPPING; -import static org.atmosphere.cpr.ApplicationConfig.SERVLET_CLASS; -import static org.atmosphere.cpr.Broadcaster.ROOT_MASTER; - -/** - * Simple Servlet to use when Atmosphere {@link Meteor} are used. This Servlet will look - * for a Servlet init-param named org.atmosphere.servlet or org.atmosphere.filter and will - * delegate request processing to them. When used, this Servlet will ignore any - * value defined in META-INF/atmosphere.xml as internally it will create a {@link ReflectorServletProcessor}. - * - * @author Jean-Francois Arcand - */ -public class MeteorServlet extends AtmosphereServlet { - - private static final long serialVersionUID = 7526472295622776110L; - protected static final Logger logger = LoggerFactory.getLogger(MeteorServlet.class); - - private Servlet delegate; - - private String delegateMapping; - - private Collection filters; - - public MeteorServlet() { - this(false); - } - - public MeteorServlet(boolean isFilter) { - this(isFilter, false); - } - - public MeteorServlet(boolean isFilter, boolean autoDetectHandlers) { - super(isFilter, autoDetectHandlers); - } - - public MeteorServlet(Servlet delegate, String delegateMapping, Filter... filters) { - this(delegate, delegateMapping, Arrays.asList(filters)); - } - - public MeteorServlet(Servlet delegate, String delegateMapping, Collection filters) { - this(false); - if (delegate == null || delegateMapping == null) { - throw new IllegalArgumentException("Delegate Servlet is undefined"); - } - this.delegate = delegate; - this.delegateMapping = delegateMapping; - if (filters == null) { - this.filters = Collections.emptyList(); - } else { - this.filters = filters; - } - } - - @Override - public void init(final ServletConfig sc) throws ServletException { - if (!framework().isInit) { - super.init(sc); - - if (delegate == null) { - loadDelegateViaConfig(sc); - } else { - ReflectorServletProcessor r = new ReflectorServletProcessor(delegate); - for (Filter f : filters) { - r.addFilter(f); - } - framework().getBroadcasterFactory().remove(delegateMapping); - framework().addAtmosphereHandler(delegateMapping, r); - framework().checkWebSocketSupportState(); - } - } - } - - private void loadDelegateViaConfig(ServletConfig sc) throws ServletException { - String servletClass = framework().getAtmosphereConfig().getInitParameter(SERVLET_CLASS); - String mapping = framework().getAtmosphereConfig().getInitParameter(MAPPING); - String filterClass = framework().getAtmosphereConfig().getInitParameter(FILTER_CLASS); - String filterName = framework().getAtmosphereConfig().getInitParameter(FILTER_NAME); - - if (servletClass != null) { - logger.info("Installed Servlet/Meteor {} mapped to {}", servletClass, mapping == null ? ROOT_MASTER : mapping); - } - if (filterClass != null) { - logger.info("Installed Filter/Meteor {} mapped to /*", filterClass, mapping); - } - - // The annotation was used. - if (servletClass != null || filterClass != null) { - ReflectorServletProcessor r = new ReflectorServletProcessor(); - r.setServletClassName(servletClass); - r.addFilterClassName(filterClass, filterName); - if (mapping == null) { - mapping = Broadcaster.ROOT_MASTER; - framework().getBroadcasterFactory().remove(Broadcaster.ROOT_MASTER); - } - framework().addAtmosphereHandler(mapping, r).initAtmosphereHandler(sc); - } - } - - @Override - public void destroy() { - super.destroy(); - } -} diff --git a/modules/cpr/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/modules/cpr/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer deleted file mode 100644 index 9f2da5c6420..00000000000 --- a/modules/cpr/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer +++ /dev/null @@ -1,3 +0,0 @@ -org.atmosphere.cpr.AnnotationScanningServletContainerInitializer -org.atmosphere.cpr.ContainerInitializer - diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/MeteorTest.java b/modules/cpr/src/test/java/org/atmosphere/cpr/MeteorTest.java deleted file mode 100644 index 87385420c06..00000000000 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/MeteorTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.cpr; - -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.handler.ReflectorServletProcessor; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Enumeration; -import java.util.concurrent.atomic.AtomicReference; - -import static org.mockito.Mockito.mock; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -public class MeteorTest { - - - private AtmosphereFramework framework; - - @BeforeMethod - public void create() throws Throwable { - framework = new AtmosphereFramework(); - framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig())); - framework.init(new ServletConfig() { - @Override - public String getServletName() { - return "void"; - } - - @Override - public ServletContext getServletContext() { - return mock(ServletContext.class); - } - - @Override - public String getInitParameter(String name) { - return null; - } - - @Override - public Enumeration getInitParameterNames() { - return null; - } - }); - } - - @AfterMethod - public void stop() { - framework.destroy(); - } - - @Test - public void testMeteor() throws IOException, ServletException { - final AtomicReference meteor = new AtomicReference(); - final Servlet s = new HttpServlet() { - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - meteor.set(Meteor.lookup(req)); - } - }; - framework.addAtmosphereHandler("/a", new ReflectorServletProcessor(s)); - - AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").build(); - framework.interceptor(new AtmosphereInterceptorAdapter() { - @Override - public Action inspect(AtmosphereResource r) { - Meteor m = Meteor.build(r.getRequest()); - return Action.CONTINUE; - } - - }); - framework.doCometSupport(request, AtmosphereResponseImpl.newInstance()); - - assertNotNull(meteor.get()); - } - - @Test - public void testMeteorNull() throws IOException, ServletException { - final AtomicReference meteor = new AtomicReference(); - final Servlet s = new HttpServlet() { - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - meteor.set(Meteor.lookup(req)); - } - }; - framework.addAtmosphereHandler("/a", new ReflectorServletProcessor(s)); - - AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").build(); - framework.interceptor(new AtmosphereInterceptorAdapter() { - @Override - public Action inspect(AtmosphereResource r) { - return Action.CONTINUE; - } - - }); - framework.doCometSupport(request, AtmosphereResponseImpl.newInstance()); - - assertNull(meteor.get()); - } - -} diff --git a/modules/cpr/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework b/modules/cpr/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework deleted file mode 100644 index fdb668dd517..00000000000 --- a/modules/cpr/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework +++ /dev/null @@ -1,2 +0,0 @@ -INSTALL -org.atmosphere.cpr.AtmosphereFrameworkTest$MyInterceptor \ No newline at end of file diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereFilter.java b/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereFilter.java deleted file mode 100755 index 686728eaeb4..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereFilter.java +++ /dev/null @@ -1,976 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.api.JResponseAsResponse; -import com.sun.jersey.api.model.AbstractMethod; -import com.sun.jersey.spi.container.ContainerRequest; -import com.sun.jersey.spi.container.ContainerRequestFilter; -import com.sun.jersey.spi.container.ContainerResponse; -import com.sun.jersey.spi.container.ContainerResponseFilter; -import com.sun.jersey.spi.container.ContainerResponseWriter; -import com.sun.jersey.spi.container.ResourceFilter; -import com.sun.jersey.spi.container.ResourceFilterFactory; -import org.atmosphere.annotation.Asynchronous; -import org.atmosphere.annotation.Broadcast; -import org.atmosphere.annotation.Cluster; -import org.atmosphere.annotation.Publish; -import org.atmosphere.annotation.Resume; -import org.atmosphere.annotation.Schedule; -import org.atmosphere.annotation.Subscribe; -import org.atmosphere.annotation.Suspend; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterConfig; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.BroadcasterLifeCyclePolicy; -import org.atmosphere.cpr.ClusterBroadcastFilter; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.cpr.HeaderConfig; -import org.atmosphere.websocket.WebSocket; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.net.URI; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; - -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_CLASS; -import static org.atmosphere.cpr.ApplicationConfig.DEFAULT_CONTENT_TYPE; -import static org.atmosphere.cpr.ApplicationConfig.JERSEY_CONTAINER_RESPONSE_WRITER_CLASS; -import static org.atmosphere.cpr.ApplicationConfig.RESUME_ON_BROADCAST; -import static org.atmosphere.cpr.ApplicationConfig.SUPPORT_LOCATION_HEADER; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnSuspend; -import static org.atmosphere.cpr.FrameworkConfig.ATMOSPHERE_CONFIG; -import static org.atmosphere.cpr.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL; -import static org.atmosphere.cpr.HeaderConfig.JSONP_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.LONG_POLLING_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.POLLING_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_UPGRADE; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRACKING_ID; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRANSPORT; - -/** - * {@link ResourceFilterFactory} which intercept the response and appropriately - * set the {@link AtmosphereResourceEvent} filed based on the annotation the application - * has defined. - * - * @author Jeanfrancois Arcand - */ -public class AtmosphereFilter implements ResourceFilterFactory { - - private static final Logger logger = LoggerFactory.getLogger(AtmosphereFilter.class); - private static final String INSTALLATION_ERROR = "The Atmosphere Framework is not installed properly and unexpected result may occurs."; - public final static String SUSPENDED_RESOURCE = AtmosphereFilter.class.getName() + ".suspendedResource"; - public final static String RESUME_UUID = AtmosphereFilter.class.getName() + ".uuid"; - public final static String RESUME_CANDIDATES = AtmosphereFilter.class.getName() + ".resumeCandidates"; - public final static String INJECTED_BROADCASTER = AtmosphereFilter.class.getName() + "injectedBroadcaster"; - - protected enum Action { - SUSPEND, RESUME, BROADCAST, SUSPEND_RESUME, - SCHEDULE_RESUME, RESUME_ON_BROADCAST, NONE, SCHEDULE, SUSPEND_RESPONSE, - SUBSCRIBE, PUBLISH, ASYNCHRONOUS - } - - protected @Context HttpServletRequest servletReq; - - private @Context UriInfo uriInfo; - - private boolean useResumeAnnotation = false; - - private final ConcurrentHashMap resumeCandidates = - new ConcurrentHashMap(); - - /** - * TODO: Fix that messy class. Instead must cache the annotation object itself. - */ - public class Filter implements ResourceFilter, ContainerResponseFilter { - - private final Action action; - private final long timeout; - private final int waitFor; - private final Suspend.SCOPE scope; - private final Class[] filters; - private Class[] listeners = null; - private final ArrayList clusters = new ArrayList(); - private final String topic; - private final boolean writeEntity; - private final String defaultContentType; - - protected Filter(Action action) { - this(action, -1); - } - - protected Filter(Action action, long timeout) { - this(action, timeout, 0); - } - - protected Filter(Action action, long timeout, int waitFor) { - this(action, timeout, waitFor, Suspend.SCOPE.APPLICATION); - } - - public Filter(Action action, long timeout, int waitFor, Suspend.SCOPE scope) { - this(action, timeout, waitFor, scope, null, null, true); - } - - protected Filter(Action action, - long timeout, - int waitFor, - Suspend.SCOPE scope, - Class[] filters, - String topic, - boolean writeEntity) { - this(action, timeout, waitFor, scope, filters, topic, writeEntity, null); - } - - protected Filter(Action action, - long timeout, - int waitFor, - Suspend.SCOPE scope, - Class[] filters, - String topic, - boolean writeEntity, - String contentType) { - - this.action = action; - this.timeout = timeout; - this.scope = scope; - this.waitFor = waitFor; - this.filters = filters; - this.topic = topic; - this.writeEntity = writeEntity; - this.defaultContentType = contentType != null ? (contentType.equals("") ? null : contentType) : null; - } - - public ContainerRequestFilter getRequestFilter() { - return null; - } - - public ContainerResponseFilter getResponseFilter() { - return this; - } - - boolean resumeOnBroadcast(boolean resumeOnBroadcast) { - String transport = servletReq.getHeader(X_ATMOSPHERE_TRANSPORT); - if (transport != null && (transport.equals(JSONP_TRANSPORT) || transport.equals(LONG_POLLING_TRANSPORT))) { - return true; - } - return resumeOnBroadcast; - } - - /** - * Configure the {@link AtmosphereResourceEvent} state (suspend, resume, broadcast) - * based on the annotation the web application has used. - * - * @param request the {@link ContainerRequest} - * @param response the {@link ContainerResponse} - * @return the {@link ContainerResponse} - */ - public ContainerResponse filter(final ContainerRequest request, final ContainerResponse response) { - if (response.getMappedThrowable() != null) { - logger.debug("Unexpected exception", response.getMappedThrowable()); - return response; - } - - if (action == Action.NONE) return response; - - // Check first if something was defined in web.xml - AtmosphereConfig config = (AtmosphereConfig) servletReq.getAttribute(ATMOSPHERE_CONFIG); - if (config == null) { - logger.error(INSTALLATION_ERROR); - throw new WebApplicationException(new IllegalStateException(INSTALLATION_ERROR)); - } - - AtmosphereFramework atmosphereFramework = config.framework(); - - String p = config.getInitParameter(JERSEY_CONTAINER_RESPONSE_WRITER_CLASS); - ContainerResponseWriter w; - if (p != null) { - try { - w = (ContainerResponseWriter) Thread.currentThread().getContextClassLoader().loadClass(p).newInstance(); - logger.trace("Installing ContainerResponseWriter {}", p); - } catch (Throwable e) { - logger.error("Error loading ContainerResponseWriter {}", p, e); - } - } - - // Now check if it was defined as an attribute - w = (ContainerResponseWriter) servletReq.getAttribute(FrameworkConfig.JERSEY_CONTAINER_RESPONSE_WRITER_INSTANCE); - if (w != null) { - response.setContainerResponseWriter(w); - } - - AtmosphereResource r = - (AtmosphereResource) servletReq - .getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); - - if (Boolean.parseBoolean(config.getInitParameter(SUPPORT_LOCATION_HEADER))) { - useResumeAnnotation = true; - } - - // Force the status code to 200 events independently of the value of the entity (null or not) - if (response.getStatus() == 204) { - response.setStatus(200); - } - - switch (action) { - case ASYNCHRONOUS: - String transport = getHeaderOrQueryValue(X_ATMOSPHERE_TRANSPORT); - String broadcasterName = uuid(r); - - if (!topic.equalsIgnoreCase(HeaderConfig.X_ATMOSPHERE_TRACKING_ID)) { - broadcasterName = getHeaderOrQueryValue(topic); - } - - if (transport == null) { - transport = HeaderConfig.LONG_POLLING_TRANSPORT; - } - - if (broadcasterName == null) { - StringBuilder s = new StringBuilder(); - Enumeration e = servletReq.getHeaderNames(); - String t; - while (e.hasMoreElements()) { - t = e.nextElement(); - s.append(t).append("=").append(servletReq.getHeader(t)).append("\n"); - } - - logger.error("\nQueryString:\n{}\n\nHeaders:\n{}", servletReq.getQueryString(), s.toString()); - - throw new WebApplicationException(new IllegalStateException("Must specify transport using header value " - + transport - + " and uuid " + broadcasterName)); - } - String subProtocol = (String) servletReq.getAttribute(FrameworkConfig.WEBSOCKET_SUBPROTOCOL); - - final boolean waitForResource = waitFor == -1 ? true : false; - Broadcaster newBroadcaster; - // See issue https://github.com/Atmosphere/atmosphere/issues/676 - synchronized (broadcasterName.intern()) { - newBroadcaster = config.getBroadcasterFactory().lookup(broadcasterName, true); - newBroadcaster.setBroadcasterLifeCyclePolicy(BroadcasterLifeCyclePolicy.EMPTY_DESTROY); - } - final Broadcaster bcaster = newBroadcaster; - - if (!waitForResource || (!transport.startsWith(POLLING_TRANSPORT) && subProtocol == null)) { - final boolean resumeOnBroadcast = transport.equals(JSONP_TRANSPORT) || transport.equals(LONG_POLLING_TRANSPORT); - - if (listeners != null) { - for (Class listener : listeners) { - try { - AtmosphereResourceEventListener el = atmosphereFramework.newClassInstance(AtmosphereResourceEventListener.class, listener); - r.addEventListener(el); - } catch (Throwable t) { - throw new WebApplicationException( - new IllegalStateException("Invalid AtmosphereResourceEventListener " + listener)); - } - } - } - final Object entity = response.getEntity(); - - r.addEventListener(new OnSuspend() { - @Override - public void onSuspend(AtmosphereResourceEvent event) { - try { - if (entity != null) { - if (waitForResource) { - bcaster.awaitAndBroadcast(entity, 30, TimeUnit.SECONDS); - } else { - bcaster.broadcastOnResume(entity); - event.getResource().resume(); - } - } - } finally { - event.getResource().removeEventListener(this); - } - } - }); - - if (resumeOnBroadcast) { - servletReq.setAttribute(RESUME_ON_BROADCAST, new Boolean(true)); - } - - r.setBroadcaster(bcaster); - executeSuspend(r, timeout, resumeOnBroadcast, null, request, response, writeEntity); - } else { - Object entity = response.getEntity(); - if (waitForResource) { - bcaster.awaitAndBroadcast(entity, 30, TimeUnit.SECONDS); - } else { - bcaster.broadcast(entity); - } - - if (subProtocol == null && writeEntity) { - try { - if (Callable.class.isAssignableFrom(entity.getClass())) { - entity = Callable.class.cast(entity).call(); - } - synchronized (response) { - response.setEntity(entity); - response.write(); - } - } catch (Throwable t) { - logger.debug("Error running Callable", t); - response.setEntity(null); - } - } else { - response.setEntity(null); - } - } - break; - case SUSPEND_RESPONSE: - SuspendResponse s = SuspendResponse.class.cast(JResponseAsResponse.class.cast(response.getResponse()).getJResponse()); - boolean resumeOnBroadcast = resumeOnBroadcast(s.resumeOnBroadcast()); - - for (AtmosphereResourceEventListener el : s.listeners()) { - r.addEventListener(el); - } - - if (s.getEntity() == null) { - //https://github.com/Atmosphere/atmosphere/issues/423 - response.setEntity(""); - } - - Broadcaster bc = s.broadcaster(); - if (bc == null && s.scope() != Suspend.SCOPE.REQUEST) { - bc = (Broadcaster) servletReq.getAttribute(INJECTED_BROADCASTER); - } - - suspend(resumeOnBroadcast, - translateTimeUnit(s.period().value(), s.period().timeUnit()), request, response, bc, r, s.scope(), s.writeEntity()); - - break; - case SUBSCRIBE: - case SUSPEND: - case SUSPEND_RESUME: - resumeOnBroadcast = resumeOnBroadcast((action == Action.SUSPEND_RESUME)); - - if (listeners != null) { - for (Class listener : listeners) { - try { - AtmosphereResourceEventListener el = atmosphereFramework.newClassInstance(AtmosphereResourceEventListener.class, listener); - r.addEventListener(el); - } catch (Throwable t) { - throw new WebApplicationException( - new IllegalStateException("Invalid AtmosphereResourceEventListener " + listener, t)); - } - } - } - - Broadcaster broadcaster = (Broadcaster) servletReq.getAttribute(INJECTED_BROADCASTER); - // @Subscribe - // TODO: Optimize me - if (action == Action.SUBSCRIBE) { - Class c = null; - try { - c = (Class) Class.forName((String) servletReq.getAttribute(BROADCASTER_CLASS)); - } catch (Throwable e) { - throw new IllegalStateException(e.getMessage()); - } - broadcaster = config.getBroadcasterFactory().lookup(c, topic, true); - } - - suspend(resumeOnBroadcast, timeout, request, response, - broadcaster, r, scope, writeEntity); - - break; - case RESUME: - if (response.getEntity() != null) { - try { - synchronized (response) { - response.write(); - } - } catch (IOException ex) { - throw new WebApplicationException(ex); - } - } - - String path = response.getContainerRequest().getPath(); - r = resumeCandidates.remove(path.substring(path.lastIndexOf("/") + 1)); - - if (r != null) { - resume(r); - } else { - throw new WebApplicationException( - new IllegalStateException("Unable to retrieve suspended Response. " + - "Either session-support is not enabled in atmosphere.xml or the" + - "path used to resume is invalid.")); - - } - break; - case BROADCAST: - case PUBLISH: - case RESUME_ON_BROADCAST: - AtmosphereResource ar = (AtmosphereResource) servletReq.getAttribute(SUSPENDED_RESOURCE); - if (ar != null) { - r = ar; - } - - if (action == Action.PUBLISH) { - Class c = null; - try { - c = (Class) Class.forName((String) servletReq.getAttribute(BROADCASTER_CLASS)); - } catch (Throwable e) { - throw new IllegalStateException(e.getMessage()); - } - r.setBroadcaster(config.getBroadcasterFactory().lookup(c, topic, true)); - } - - broadcast(response, r, timeout); - if (!writeEntity) { - synchronized (response) { - response.setEntity(null); - } - } - break; - case SCHEDULE: - case SCHEDULE_RESUME: - Object o = response.getEntity(); - Broadcaster b = r.getBroadcaster(); - if (response.getEntity() instanceof Broadcastable) { - b = ((Broadcastable) response.getEntity()).getBroadcaster(); - o = ((Broadcastable) response.getEntity()).getMessage(); - response.setEntity(((Broadcastable) response.getEntity()).getResponseMessage()); - } - - if (response.getEntity() != null) { - try { - synchronized (response) { - response.write(); - } - } catch (IOException ex) { - throw new WebApplicationException(ex); - } - } - - if (action == Action.SCHEDULE_RESUME) { - configureResumeOnBroadcast(b); - } - - b.scheduleFixedBroadcast(o, waitFor, timeout, TimeUnit.SECONDS); - break; - } - - return response; - } - - String uuid(AtmosphereResource r) { - String s = (String) r.getRequest().getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID); - if (s != null) { - return s; - } - - s = r.getRequest().getHeader(HeaderConfig.X_ATMOSPHERE_TRACKING_ID); - if (s != null && s != "0") { - return s; - } else { - return r.uuid(); - } - } - - String getHeaderOrQueryValue(String name) { - String value = servletReq.getHeader(name); - if (value == null) { - value = servletReq.getParameter(name); - // https://github.com/Atmosphere/atmosphere/issues/166 - if (value == null) { - value = servletReq.getParameter(name.toLowerCase()); - // Last Chance - if (value == null) { - String qs = servletReq.getQueryString(); - if (qs != null && qs.indexOf(name) != -1) { - String[] s = qs.split("&"); - String[] query; - for (String a : s) { - if (a.startsWith(name) || a.startsWith(name.toLowerCase())) { - query = a.split("="); - if (query.length == 2) { - return query[1]; - } - } - } - } - } - } - } - return value; - } - - Response.ResponseBuilder configureHeaders(Response.ResponseBuilder b) throws IOException { - boolean webSocketSupported = servletReq.getAttribute(WebSocket.WEBSOCKET_SUSPEND) != null; - - if (servletReq.getHeaders("Connection") != null && servletReq.getHeaders("Connection").hasMoreElements()) { - String[] e = ((Enumeration) servletReq.getHeaders("Connection")).nextElement().toString().split(","); - for (String upgrade : e) { - if (upgrade != null && upgrade.equalsIgnoreCase(WEBSOCKET_UPGRADE)) { - if (!webSocketSupported) { - b = b.header(X_ATMOSPHERE_ERROR, "Websocket protocol not supported"); - } - } - } - } - return b; - } - - void configureResumeOnBroadcast(Broadcaster b) { - Iterator i = b.getAtmosphereResources().iterator(); - while (i.hasNext()) { - HttpServletRequest r = i.next().getRequest(); - r.setAttribute(RESUME_ON_BROADCAST, true); - } - } - - void configureFilter(Broadcaster bc) { - if (bc == null) throw new WebApplicationException(new IllegalStateException("Broadcaster cannot be null")); - - /** - * Here we can't predict if it's the same set of filter shared across all Broadcaster as - * Broadcaster can have their own BroadcasterConfig instance. - */ - BroadcasterConfig c = bc.getBroadcasterConfig(); - // Already configured - if (c.hasFilters()) { - return; - } - - // Always the first one, before any transformation/filtering - for (ClusterBroadcastFilter cbf : clusters) { - cbf.setBroadcaster(bc); - c.addFilter(cbf); - } - - BroadcastFilter f = null; - if (filters != null) { - for (Class filter : filters) { - try { - f = filter.newInstance(); - } catch (Throwable t) { - logger.warn("Invalid @BroadcastFilter: " + filter, t); - } - c.addFilter(f); - } - } - } - - private void setListeners(Class[] listeners) { - this.listeners = listeners; - } - - void broadcast(ContainerResponse r, AtmosphereResource ar, long delay) { - Object o = r.getEntity(); - - Broadcaster b = ar.getBroadcaster(); - Object msg = o; - Object returnMsg = null; - // Something went wrong if null. - if (o instanceof Broadcastable) { - if (((Broadcastable) o).getBroadcaster() != null) { - b = ((Broadcastable) o).getBroadcaster(); - } - msg = ((Broadcastable) o).getMessage(); - returnMsg = ((Broadcastable) o).getResponseMessage(); - } - - if (action == Action.RESUME_ON_BROADCAST) { - configureResumeOnBroadcast(b); - } - - if (o != null) { - addFilter(b); - r.setEntity(msg); - if (msg == null) return; - - if (delay == -1) { - b.broadcast(msg); - if (o instanceof Broadcastable) { - r.setEntity(returnMsg); - } - } else if (delay == 0) { - b.delayBroadcast(msg); - } else { - b.delayBroadcast(msg, delay, TimeUnit.SECONDS); - } - } - } - - void addFilter(Broadcaster bc) { - configureFilter(bc); - } - - void resume(AtmosphereResource resource) { - resource.resume(); - } - - void addCluster(ClusterBroadcastFilter f) { - clusters.add(f); - } - - void suspend(boolean resumeOnBroadcast, - long timeout, - ContainerRequest request, - ContainerResponse response, - Broadcaster bc, - AtmosphereResource r, - Suspend.SCOPE localScope, - boolean flushEntity) { - - // Force the status code to 200 events independently of the value of the entity (null or not) - if (response.getStatus() == 204) { - response.setStatus(200); - } - - BroadcasterFactory broadcasterFactory = r.getAtmosphereConfig().getBroadcasterFactory(); - - boolean sessionSupported = (Boolean) servletReq.getAttribute(FrameworkConfig.SUPPORT_SESSION); - URI location = null; - // Do not add location header if already there. - if (useResumeAnnotation && !sessionSupported && !resumeOnBroadcast && response.getHttpHeaders().getFirst("Location") == null) { - String uuid = UUID.randomUUID().toString(); - - location = uriInfo.getAbsolutePathBuilder().path(uuid).build(""); - - resumeCandidates.put(uuid, r); - servletReq.setAttribute(RESUME_UUID, uuid); - servletReq.setAttribute(RESUME_CANDIDATES, resumeCandidates); - } - - if (bc == null && localScope != Suspend.SCOPE.REQUEST) { - bc = r.getBroadcaster(); - } - - if (response.getEntity() == null) { - //https://github.com/Atmosphere/atmosphere/issues/423 - response.setEntity(""); - } - - if (response.getEntity() instanceof Broadcastable) { - Broadcastable b = (Broadcastable) response.getEntity(); - bc = b.getBroadcaster(); - response.setEntity(b.getResponseMessage()); - } - - if ((localScope == Suspend.SCOPE.REQUEST) && bc == null) { - if (bc == null) { - try { - String id = servletReq.getHeader(X_ATMOSPHERE_TRACKING_ID); - if (id == null) { - id = UUID.randomUUID().toString(); - } - - bc = broadcasterFactory.get(id); - bc.setScope(Broadcaster.SCOPE.REQUEST); - } catch (Exception ex) { - logger.error("failed to instantiate broadcaster with factory: " + broadcasterFactory, ex); - } - } else { - bc.setScope(Broadcaster.SCOPE.REQUEST); - } - } - r.setBroadcaster(bc); - - if (resumeOnBroadcast) { - servletReq.setAttribute(RESUME_ON_BROADCAST, new Boolean(true)); - } - - executeSuspend(r, timeout, resumeOnBroadcast, location, request, response, flushEntity); - - } - - void executeSuspend(AtmosphereResource r, - long timeout, - boolean resumeOnBroadcast, - URI location, - ContainerRequest request, - ContainerResponse response, - boolean flushEntity) { - - servletReq.setAttribute(FrameworkConfig.CONTAINER_RESPONSE, response); - configureFilter(r.getBroadcaster()); - servletReq.setAttribute(SUSPENDED_RESOURCE, r); - - // Set the content-type based on the returned entity. - try { - MediaType contentType = response.getMediaType(); - if (contentType == null && response.getEntity() != null) { - LinkedList l = new LinkedList(); - // Will retrun the first - l.add(request.getAcceptableMediaType(new LinkedList())); - contentType = response.getMessageBodyWorkers().getMessageBodyWriterMediaType( - response.getEntity().getClass(), - response.getEntityType(), - response.getAnnotations(), - l); - - if (contentType == null || - contentType.isWildcardType() || contentType.isWildcardSubtype()) - contentType = MediaType.APPLICATION_OCTET_STREAM_TYPE; - } - - Object entity = response.getEntity(); - - Response.ResponseBuilder b = Response.ok(); - b = configureHeaders(b); - - AtmosphereConfig config = r.getAtmosphereConfig(); - - String defaultCT = config.getInitParameter(DEFAULT_CONTENT_TYPE); - if (defaultCT == null) { - defaultCT = "text/plain; charset=ISO-8859-1"; - } - - String ct = contentType == null ? defaultCT : contentType.toString(); - - if (defaultContentType != null) { - ct = defaultContentType; - } - - if (entity != null) { - b = b.header("Content-Type", ct); - } - servletReq.setAttribute(FrameworkConfig.EXPECTED_CONTENT_TYPE, ct); - - if (entity != null && flushEntity) { - try { - if (Callable.class.isAssignableFrom(entity.getClass())) { - entity = Callable.class.cast(entity).call(); - } - } catch (Throwable t) { - logger.error("Error executing callable {}", entity); - entity = null; - } - - if (location != null) { - b = b.header(HttpHeaders.LOCATION, location); - } - - synchronized (response) { - AtmosphereResourceEventListenerAdapter a = - (AtmosphereResourceEventListenerAdapter) servletReq.getAttribute(CALLBACK_JAVASCRIPT_PROTOCOL); - if (a != null) { - try { - a.onSuspend(r.getAtmosphereResourceEvent()); - } catch (Exception ex) { - logger.debug("AtmosphereFilter error", ex); - } finally { - servletReq.removeAttribute(CALLBACK_JAVASCRIPT_PROTOCOL); - } - } - r.removeEventListener(a); - response.setResponse(b.entity(entity).build()); - response.write(); - } - } - - response.setEntity(null); - r.suspend(timeout); - } catch (IOException ex) { - throw new WebApplicationException(ex); - } - } - } - - /** - * Create a {@link ResourceFilter} which contains the information about the - * annotation being processed. - *

- * XXX Need to filter invalid mix of annotation. - * - * @param am an {@link AbstractMethod} - * @return a List of {@link ResourceFilter} to invoke. - */ - @Override - public List create(AbstractMethod am) { - LinkedList list = new LinkedList(); - Filter f; - - for (Annotation annotation : am.getAnnotations()) { - logger.trace("AtmosphereFilter processing annotation: {}", annotation); - } - - if (am.getMethod() == null) { - return null; - } - - if (SuspendResponse.class.isAssignableFrom(am.getMethod().getReturnType())) { - list.addLast(new Filter(Action.SUSPEND_RESPONSE)); - return list; - } - - if (am.isAnnotationPresent(Broadcast.class)) { - int delay = am.getAnnotation(Broadcast.class).delay(); - Class[] broadcastFilter = am.getAnnotation(Broadcast.class).filters(); - - if (am.getAnnotation(Broadcast.class).resumeOnBroadcast()) { - f = new Filter(Action.RESUME_ON_BROADCAST, delay, 0, Suspend.SCOPE.APPLICATION, broadcastFilter, null, - am.getAnnotation(Broadcast.class).writeEntity()); - } else { - f = new Filter(Action.BROADCAST, delay, 0, Suspend.SCOPE.APPLICATION, broadcastFilter, null, - am.getAnnotation(Broadcast.class).writeEntity()); - } - - list.addLast(f); - - if (am.isAnnotationPresent(Cluster.class)) { - broadcastFilter = am.getAnnotation(Cluster.class).value(); - for (Class c : broadcastFilter) { - try { - ClusterBroadcastFilter cbf = c.newInstance(); - cbf.setUri(am.getAnnotation(Cluster.class).name()); - f.addCluster(cbf); - } catch (Throwable t) { - logger.warn("Invalid ClusterBroadcastFilter", t); - } - } - } - } - - if (am.isAnnotationPresent(Asynchronous.class)) { - int suspendTimeout = am.getAnnotation(Asynchronous.class).period(); - Class[] broadcastFilter = am.getAnnotation(Asynchronous.class).broadcastFilter(); - - boolean wait = am.getAnnotation(Asynchronous.class).waitForResource(); - f = new Filter(Action.ASYNCHRONOUS, - suspendTimeout, - wait ? -1 : 0, - null, - broadcastFilter, - am.getAnnotation(Asynchronous.class).header(), - am.getAnnotation(Asynchronous.class).writeEntity(), - am.getAnnotation(Asynchronous.class).contentType()); - f.setListeners(am.getAnnotation(Asynchronous.class).eventListeners()); - list.addFirst(f); - } - - if (am.isAnnotationPresent(Suspend.class)) { - - long suspendTimeout = am.getAnnotation(Suspend.class).period(); - TimeUnit tu = am.getAnnotation(Suspend.class).timeUnit(); - suspendTimeout = translateTimeUnit(suspendTimeout, tu); - - Suspend.SCOPE scope = am.getAnnotation(Suspend.class).scope(); - - if (am.getAnnotation(Suspend.class).resumeOnBroadcast()) { - f = new Filter(Action.SUSPEND_RESUME, - suspendTimeout, - 0, - scope, - null, - null, - am.getAnnotation(Suspend.class).writeEntity(), - am.getAnnotation(Suspend.class).contentType()); - } else { - f = new Filter(Action.SUSPEND, - suspendTimeout, - 0, - scope, - null, - null, - am.getAnnotation(Suspend.class).writeEntity(), - am.getAnnotation(Suspend.class).contentType()); - } - f.setListeners(am.getAnnotation(Suspend.class).listeners()); - - list.addFirst(f); - } - - if (am.isAnnotationPresent(Subscribe.class)) { - int timeout = am.getAnnotation(Subscribe.class).timeout(); - f = new Filter(Action.SUBSCRIBE, timeout, -1, Suspend.SCOPE.APPLICATION, - null, am.getAnnotation(Subscribe.class).value(), am.getAnnotation(Subscribe.class).writeEntity()); - - f.setListeners(am.getAnnotation(Subscribe.class).listeners()); - - list.addFirst(f); - } - - if (am.isAnnotationPresent(Publish.class)) { - f = new Filter(Action.PUBLISH, -1, -1, Suspend.SCOPE.APPLICATION, - null, am.getAnnotation(Publish.class).value(), true); - list.addFirst(f); - } - - if (am.isAnnotationPresent(Resume.class)) { - useResumeAnnotation = true; - int suspendTimeout = am.getAnnotation(Resume.class).value(); - list.addFirst(new Filter(Action.RESUME, suspendTimeout)); - } - - if (am.isAnnotationPresent(Schedule.class)) { - int period = am.getAnnotation(Schedule.class).period(); - int waitFor = am.getAnnotation(Schedule.class).waitFor(); - - if (am.getAnnotation(Schedule.class).resumeOnBroadcast()) { - list.addFirst(new Filter(Action.SCHEDULE_RESUME, period, waitFor)); - } else { - list.addFirst(new Filter(Action.SCHEDULE, period, waitFor)); - } - } - - if (!list.isEmpty()) { - f = new Filter(Action.NONE); - list.addFirst(f); - } - - return list; - } - - protected long translateTimeUnit(long period, TimeUnit tu) { - if (period == -1) return period; - - switch (tu) { - case SECONDS: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.SECONDS); - case MINUTES: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.MINUTES); - case HOURS: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.HOURS); - case DAYS: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.DAYS); - case MILLISECONDS: - return period; - case MICROSECONDS: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.MICROSECONDS); - case NANOSECONDS: - return TimeUnit.MILLISECONDS.convert(period, TimeUnit.NANOSECONDS); - } - return period; - } - -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereProviders.java b/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereProviders.java deleted file mode 100644 index 9d45950cc71..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereProviders.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.spi.StringReader; -import com.sun.jersey.spi.StringReaderProvider; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.FrameworkConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -/** - * Placeholder for injection of Atmosphere object based on - * any parameter value (header, cookie, query, matrix or path) - * - * @author Paul.Sandoz@Sun.Com - * @author Jean-Francois Arcand - */ -public class AtmosphereProviders { - - private static final Logger logger = LoggerFactory.getLogger(AtmosphereProviders.class); - - public static class BroadcasterProvider implements StringReaderProvider { - - @Context - HttpServletRequest req; - - @Override - public StringReader getStringReader(Class type, Type genericType, Annotation[] annotations) { - - if (Broadcaster.class.isAssignableFrom(type)) { - return new BroadcasterStringReader(); - } - - return null; - } - - @StringReader.ValidateDefaultValue(false) - public class BroadcasterStringReader implements StringReader { - @Override - public Object fromString(String topic) { - Broadcaster broadcaster; - try { - AtmosphereResource r = - (AtmosphereResource) - req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); - BroadcasterFactory bp = r.getAtmosphereConfig().getBroadcasterFactory(); - - Class c; - try { - c = (Class) Class.forName((String) req.getAttribute(ApplicationConfig.BROADCASTER_CLASS)); - } catch (Throwable e) { - throw new IllegalStateException(e.getMessage()); - } - broadcaster = bp.lookup(c, topic, true); - } catch (Throwable ex) { - throw new WebApplicationException(ex); - } - logger.trace("Injected Broadcaster {}", broadcaster); - req.setAttribute(AtmosphereFilter.INJECTED_BROADCASTER, broadcaster); - return broadcaster; - } - } - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceConfigurator.java b/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceConfigurator.java deleted file mode 100755 index 42cdb8bff32..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceConfigurator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.api.core.ResourceConfig; -import com.sun.jersey.api.core.ResourceConfigurator; - -import java.util.Collections; - - -/** - * Automatically add the {@link AtmosphereFilter} to the list of {@link ResourceConfig}. - * - * @author Jeanfrancois Arcand - * @author Paul Sandoz - */ -public class AtmosphereResourceConfigurator implements ResourceConfigurator { - - @Override - public void configure(ResourceConfig config) { - Collections.addAll(config.getClasses(), - AtmosphereProviders.BroadcasterProvider.class, - BroadcasterFactoryInjector.PerRequest.class, - BroadcasterFactoryInjector.Singleton.class, - BroadcasterInjector.PerRequest.class, - BroadcasterInjector.Singleton.class, - AtmosphereResourceInjector.PerRequest.class, - AtmosphereResourceInjector.Singleton.class); - config.getResourceFilterFactories().add(AtmosphereFilter.class); - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceInjector.java b/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceInjector.java deleted file mode 100644 index 70380995ee0..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/AtmosphereResourceInjector.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.core.spi.component.ComponentContext; -import com.sun.jersey.core.spi.component.ComponentScope; -import com.sun.jersey.spi.inject.Injectable; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; - -import javax.ws.rs.core.Context; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Proxy; -import java.lang.reflect.Type; - -/** - * Allow {@link AtmosphereResourceEvent} injection via the {@link Context} annotation supported - * by Jersey. - * - * @author Jeanfrancois Arcand - * @author Paul Sandoz - */ -abstract class AtmosphereResourceInjector extends BaseInjectableProvider { - - boolean isValidType(Type c) { - if (c == AtmosphereResource.class) return true; - - if (c instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) c; - if (pt.getRawType() != AtmosphereResource.class) return false; - - if (pt.getActualTypeArguments().length != 2) return false; - - if (pt.getActualTypeArguments()[0] != AtmosphereRequestImpl.class) return false; - if (pt.getActualTypeArguments()[1] != AtmosphereResponseImpl.class) return false; - - return true; - } - return false; - } - - public static final class PerRequest extends AtmosphereResourceInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.PerRequest; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type c) { - if (!isValidType(c)) - return null; - - return new Injectable() { - @Override - public AtmosphereResource getValue() { - return getAtmosphereResource(AtmosphereResourceImpl.class, false); - } - }; - } - } - - public static final class Singleton extends AtmosphereResourceInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.Singleton; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type c) { - if (!isValidType(c)) - return null; - - return new Injectable() { - @Override - public AtmosphereResource getValue() { - return (AtmosphereResource) Proxy.newProxyInstance(this.getClass().getClassLoader(), - new Class[]{AtmosphereResource.class}, new InvocationHandler() { - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - return method.invoke(getAtmosphereResource(AtmosphereResource.class, false), args); - } - }); - } - }; - } - } - -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/BaseInjectableProvider.java b/modules/jersey/src/main/java/org/atmosphere/jersey/BaseInjectableProvider.java deleted file mode 100644 index cfdf4f9a2c7..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/BaseInjectableProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.spi.inject.InjectableProvider; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.FrameworkConfig; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; -import java.lang.reflect.Type; - -/** - * @author Paul Sandoz - */ -abstract public class BaseInjectableProvider implements InjectableProvider { - // The current {@link HttpServletRequest{ - @Context - HttpServletRequest req; - - protected AtmosphereResource getAtmosphereResource(Class injectType, boolean session) { - - try { - AtmosphereResource r = (AtmosphereResource) - req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); - - return r; - } catch (IllegalStateException ex) { - throw new IllegalStateException("An instance of the class " + injectType.getName() + " could not be injected because there is no HTTP request in scope", ex); - } - } - -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/Broadcastable.java b/modules/jersey/src/main/java/org/atmosphere/jersey/Broadcastable.java deleted file mode 100644 index 9bde3e9f6b3..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/Broadcastable.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Simple placeholder that can be used to broadcast message using a specific - * {@link Broadcaster}. - * - * @author Jeanfrancois Arcand - */ -public class Broadcastable { - - private static final Logger logger = LoggerFactory.getLogger(Broadcastable.class); - - private final Object message; - private final Broadcaster b; - private final Object callerMessage; - - public Broadcastable(Broadcaster b) { - this.b = b; - message = ""; - callerMessage = ""; - } - - /** - * Broadcast the message to the set of suspended {@link AtmosphereResource}, and write back - * the message to the request which invoked the current resource method. - * - * @param message the message which will be broadcasted - * @param b the {@link Broadcaster} - */ - public Broadcastable(Object message, Broadcaster b) { - this.b = b; - this.message = message; - callerMessage = message; - } - - /** - * Broadcast the message to the set of suspended {@link AtmosphereResource}, and write back - * the callerMessage to the request which invoked the current resource method. - * - * @param message the message which will be broadcasted - * @param callerMessage the message which will be sent back to the request. - * @param b the {@link Broadcaster} - */ - public Broadcastable(Object message, Object callerMessage, Broadcaster b) { - this.b = b; - this.message = message; - this.callerMessage = callerMessage; - if (callerMessage == null) { - throw new NullPointerException("callerMessage cannot be null"); - } - } - - /** - * Broadcast the message. - * - * @return the transformed message ({@link BroadcastFilter}) - */ - public Object broadcast() { - try { - return b.broadcast(message).get(); - } catch (Exception ex) { - logger.error("failed to broadcast message: " + message, ex); - } - return null; - } - - public Object getMessage() { - return message; - } - - public Broadcaster getBroadcaster() { - return b; - } - - public Object getResponseMessage() { - return callerMessage; - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterFactoryInjector.java b/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterFactoryInjector.java deleted file mode 100644 index 14cbfd0bf82..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterFactoryInjector.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.core.spi.component.ComponentContext; -import com.sun.jersey.core.spi.component.ComponentScope; -import com.sun.jersey.spi.inject.Injectable; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.BroadcasterListener; - -import javax.ws.rs.core.Context; -import java.lang.reflect.Type; -import java.util.Collection; - -/** - * Allow {@link org.atmosphere.cpr.BroadcasterFactory} injection via the {@link Context} annotation supported - * by Jersey. - * - * @author Jeanfrancois Arcand - * @author Paul Sandoz - */ -abstract class BroadcasterFactoryInjector extends BaseInjectableProvider { - - protected BroadcasterFactoryInjector() { - } - - boolean isValidType(Type t) { - return (t instanceof Class) && BroadcasterFactory.class.isAssignableFrom((Class) t); - } - - public static final class PerRequest extends BroadcasterFactoryInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.PerRequest; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type c) { - if (!isValidType(c)) - return null; - - return new Injectable() { - @Override - public BroadcasterFactory getValue() { - return getAtmosphereResource(AtmosphereResource.class, true).getAtmosphereConfig().getBroadcasterFactory(); - } - }; - } - } - - public static final class Singleton extends BroadcasterFactoryInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.Singleton; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type c) { - if (!isValidType(c)) - return null; - - return new Injectable() { - @Override - public BroadcasterFactory getValue() { - return new BroadcasterFactoryProxy(); - } - }; - } - - class BroadcasterFactoryProxy implements BroadcasterFactory { - BroadcasterFactory _get() { - return getAtmosphereResource(AtmosphereResource.class, true).getAtmosphereConfig().getBroadcasterFactory(); - } - - @Override - public void configure(Class clazz, String broadcasterLifeCyclePolicy, AtmosphereConfig c) { - _get().configure(clazz, broadcasterLifeCyclePolicy, c); - } - - @Override - public Broadcaster get() { - return _get().get(); - } - - @Override - public Broadcaster get(Object id) { - return _get().get(id); - } - - @Override - public T get(Class c, Object id) { - return _get().get(c, id); - } - - @Override - public void destroy() { - _get().destroy(); - } - - @Override - public boolean add(Broadcaster b, Object id) { - return _get().add(b, id); - } - - @Override - public boolean remove(Broadcaster b, Object id) { - return _get().remove(b, id); - } - - @Override - public T lookup(Class c, Object id) { - return _get().lookup(c, id); - } - - @Override - public T lookup(Class c, Object id, boolean createIfNull) { - return _get().lookup(c, id, createIfNull); - } - - @Override - public Broadcaster lookup(Object id) { - return _get().lookup(id); - } - - @Override - public Broadcaster lookup(Object id, boolean createIfNull) { - return _get().lookup(id, createIfNull); - } - - @Override - public void removeAllAtmosphereResource(AtmosphereResource r) { - _get().removeAllAtmosphereResource(r); - } - - @Override - public boolean remove(Object id) { - return _get().remove(id); - } - - @Override - public Collection lookupAll() { - return _get().lookupAll(); - } - - @Override - public BroadcasterFactory addBroadcasterListener(BroadcasterListener b) { - _get().addBroadcasterListener(b); - return this; - } - - @Override - public BroadcasterFactory removeBroadcasterListener(BroadcasterListener b) { - _get().removeBroadcasterListener(b); - return this; - } - - @Override - public Collection broadcasterListeners() { - return _get().broadcasterListeners(); - } - } - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterInjector.java b/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterInjector.java deleted file mode 100644 index 6c6f4d98a20..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/BroadcasterInjector.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.core.spi.component.ComponentContext; -import com.sun.jersey.core.spi.component.ComponentScope; -import com.sun.jersey.spi.inject.Injectable; -import org.atmosphere.cpr.Broadcaster; - -import javax.ws.rs.core.Context; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.lang.reflect.Type; - -/** - * Allow {@link Broadcaster} injection via the {@link Context} annotation supported - * by Jersey. - * - * @author Jeanfrancois Arcand - * @author Paul Sandoz - */ -abstract class BroadcasterInjector extends BaseInjectableProvider { - - boolean isValidType(Type t) { - return (t instanceof Class) && Broadcaster.class.isAssignableFrom((Class) t); - } - - public static final class PerRequest extends BroadcasterInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.PerRequest; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type t) { - if (!isValidType(t)) - return null; - - return new Injectable() { - @Override - public Broadcaster getValue() { - return getAtmosphereResource(Broadcaster.class, true).getBroadcaster(); - } - }; - } - } - - public static final class Singleton extends BroadcasterInjector { - @Override - public ComponentScope getScope() { - return ComponentScope.Singleton; - } - - @Override - public Injectable getInjectable(ComponentContext ic, Context a, Type t) { - if (!isValidType(t)) - return null; - - return new Injectable() { - @Override - public Broadcaster getValue() { - return (Broadcaster) Proxy.newProxyInstance(this.getClass().getClassLoader(), - new Class[]{Broadcaster.class}, - new InvocationHandler() { - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - return method.invoke(getAtmosphereResource(Broadcaster.class, true).getBroadcaster(), - args); - } - }); - - } - }; - } - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/JerseyBroadcaster.java b/modules/jersey/src/main/java/org/atmosphere/jersey/JerseyBroadcaster.java deleted file mode 100644 index b4039a168fe..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/JerseyBroadcaster.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.jersey; - -import com.sun.jersey.spi.container.ContainerResponse; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcaster; -import org.atmosphere.jersey.util.JerseyBroadcasterUtil; - -/** - * Special {@link Broadcaster} that use the {@link ContainerResponse} under the hood - * to serialize the response. - * - * @author Jeanfrancois Arcand - */ -public class JerseyBroadcaster extends DefaultBroadcaster { - - public JerseyBroadcaster() {} - - @Override - protected void invokeOnStateChange(final AtmosphereResource r, final AtmosphereResourceEvent e) { - JerseyBroadcasterUtil.broadcast(r, e, this); - } - -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/SuspendResponse.java b/modules/jersey/src/main/java/org/atmosphere/jersey/SuspendResponse.java deleted file mode 100644 index 9abe2889971..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/SuspendResponse.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.api.JResponse; -import org.atmosphere.annotation.Suspend; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.Broadcaster; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.concurrent.TimeUnit; - -/** - * This class can be used to suspend response programmatically, similar to {@link org.atmosphere.annotation.Suspend} - * annotation. - *

- *         SuspendResponse<String> r = new SuspendResponse.SuspendResponseBuilder<String>()
- *              .broadcaster(broadcaster)
- *              .outputComments(true)
- *              .period(5, TimeUnit.SECONDS)
- *              .entity("foo")
- *              .build();
- * 
- * - * @param the {@link org.atmosphere.jersey.SuspendResponse#entity type} - * @author Jeanfrancois Arcand - */ -public class SuspendResponse extends JResponse { - private final TimeSpan suspendTimeout; - private final Suspend.SCOPE scope; - private final boolean outputComments; - private final boolean resumeOnBroadcast; - private final Collection listeners; - private final Broadcaster broadcaster; - private final boolean writeEntity; - - protected SuspendResponse(SuspendResponseBuilder b) { - super(b); - this.suspendTimeout = b.suspendTimeout; - this.scope = b.scope; - this.outputComments = b.outputComments; - this.resumeOnBroadcast = b.resumeOnBroadcast; - this.listeners = b.listeners; - this.broadcaster = b.broadcaster; - this.writeEntity = b.writeEntity; - } - - /** - * Return the {@link org.atmosphere.annotation.Suspend.SCOPE} value. - * - * @return the {@link org.atmosphere.annotation.Suspend.SCOPE} value. - */ - public Suspend.SCOPE scope() { - return scope; - } - - /** - * Return the {@link org.atmosphere.jersey.SuspendResponse.TimeSpan} used to suspend the response. - * - * @return the {@link org.atmosphere.jersey.SuspendResponse.TimeSpan} used to suspend the response. - */ - public TimeSpan period() { - return suspendTimeout; - } - - /** - * Tell Atmosphere to write some comments during the connection suspension. - * - * @return true is comment will be written. - */ - public boolean outputComments() { - return outputComments; - } - - /** - * Resume the connection on the first {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} operations. - * - * @return true if the connection needs to be resumed. - */ - public boolean resumeOnBroadcast() { - return resumeOnBroadcast; - } - - /** - * Write the returned entity back to the calling connection. Default is false. - */ - public boolean writeEntity() { - return writeEntity; - } - - /** - * Return the {@link Broadcaster} that will be used to broadcast events. - * - * @return the {@link Broadcaster} that will be used to broadcast events. - */ - public Broadcaster broadcaster() { - return broadcaster; - } - - /** - * Return the current list of {@link AtmosphereResourceEventListener} classes. - * - * @return the current list of {@link AtmosphereResourceEventListener} classes. - */ - public Collection listeners() { - return Collections.unmodifiableCollection(listeners); - } - - /** - * A Builder for {@link org.atmosphere.jersey.SuspendResponse} - * - * @param - */ - public static class SuspendResponseBuilder extends AJResponseBuilder> { - - protected TimeSpan suspendTimeout = new TimeSpan(-1, TimeUnit.MILLISECONDS); - protected Suspend.SCOPE scope = Suspend.SCOPE.APPLICATION; - protected boolean outputComments = true; - protected boolean resumeOnBroadcast = false; - protected final Collection listeners - = new ArrayList(); - private Broadcaster broadcaster; - private boolean writeEntity = true; - - /** - * Default constructor. - */ - public SuspendResponseBuilder() { - } - - /** - * Construct a shallow copy. The metadata map will be copied but not the - * key/value references. - * - * @param that the AJResponseBuilder to copy from. - */ - public SuspendResponseBuilder(SuspendResponseBuilder that) { - super(that); - } - - /** - * Set the {@link org.atmosphere.annotation.Suspend.SCOPE} value - * - * @param scope {@link org.atmosphere.annotation.Suspend.SCOPE} value - * @return this - */ - public SuspendResponseBuilder scope(Suspend.SCOPE scope) { - this.scope = scope; - return this; - } - - /** - * Set the timeout period. - * - * @param suspendTimeout the period - * @param timeUnit the {@link java.util.concurrent.TimeUnit} - * @return this - */ - public SuspendResponseBuilder period(int suspendTimeout, TimeUnit timeUnit) { - this.suspendTimeout = new TimeSpan(suspendTimeout, timeUnit); - return this; - } - - /** - * Set true to tell Atmosphere to write comments when suspending. - * - * @param outputComments true to tell Atmosphere to write comments when suspending - * @return this - */ - public SuspendResponseBuilder outputComments(boolean outputComments) { - this.outputComments = outputComments; - return this; - } - - /** - * Set to true to resume the connection on the first {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} - * - * @param resumeOnBroadcast true to resume the connection on the first {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} - * @return this - */ - public SuspendResponseBuilder resumeOnBroadcast(boolean resumeOnBroadcast) { - this.resumeOnBroadcast = resumeOnBroadcast; - return this; - } - - /** - * Set the {@link Broadcaster} - * - * @param broadcaster {@link Broadcaster} - * @return this - */ - public SuspendResponseBuilder broadcaster(Broadcaster broadcaster) { - this.broadcaster = broadcaster; - return this; - } - - /** - * Write the returned entity back to the calling connection. Default is false. - */ - public SuspendResponseBuilder writeEntity(boolean writeEntity) { - this.writeEntity = writeEntity; - return this; - } - - /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} - * - * @param e {@link org.atmosphere.cpr.AtmosphereResourceEventListener} - * @return this - */ - public SuspendResponseBuilder addListener(AtmosphereResourceEventListener e) { - listeners.add(e); - return this; - } - - /** - * Build the {@link org.atmosphere.jersey.SuspendResponse} - * - * @return an instance of {@link org.atmosphere.jersey.SuspendResponse} - */ - public SuspendResponse build() { - SuspendResponse r = new SuspendResponse(this); - reset(); - return r; - } - } - - /** - * Util class that encapsulate a period and a TimeUnit. - */ - public static class TimeSpan { - - private final TimeUnit timeUnit; - private final int period; - - public TimeSpan(int period, TimeUnit timeUnit) { - this.period = period; - this.timeUnit = timeUnit; - } - - public int value() { - return period; - } - - public TimeUnit timeUnit() { - return timeUnit; - } - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseyBroadcasterUtil.java b/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseyBroadcasterUtil.java deleted file mode 100644 index 4d3b8f7f5f4..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseyBroadcasterUtil.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey.util; - -import com.sun.jersey.spi.container.ContainerResponse; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcaster; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.jersey.AtmosphereFilter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Simple util class shared among Jersey's Broadcaster. - * - * @author Jeanfrancois Arcand - */ -public final class JerseyBroadcasterUtil { - - private static final Logger logger = LoggerFactory.getLogger(JerseyBroadcasterUtil.class); - - public final static void broadcast(final AtmosphereResource r, final AtmosphereResourceEvent e, final Broadcaster broadcaster) { - AtmosphereRequest request = r.getRequest(); - ContainerResponse cr = null; - - // Make sure only one thread can play with the ContainerResponse. Threading issue can arise if there is a scheduler - // or if ContainerResponse is associated with more than Broadcaster. - cr = (ContainerResponse) request.getAttribute(FrameworkConfig.CONTAINER_RESPONSE); - - if (cr == null || !r.isSuspended() && !r.getAtmosphereResourceEvent().isResumedOnTimeout()) { - if (cr == null) { - logger.warn("Unexpected state. ContainerResponse has been resumed. Caching message {} for {}", - e.getMessage(), r.uuid()); - } else { - logger.warn("The AtmosphereResource {} hasn't been suspended yet.", - r.uuid(), e); - } - - if (DefaultBroadcaster.class.isAssignableFrom(broadcaster.getClass())) { - DefaultBroadcaster.class.cast(broadcaster).cacheLostMessage(r, true); - } - AtmosphereResourceImpl.class.cast(r)._destroy(); - return; - } - - synchronized (cr) { - try { - // This is required when you change the response's type - String m = null; - - if (request.getAttribute(FrameworkConfig.EXPECTED_CONTENT_TYPE) != null) { - m = (String) request.getAttribute(FrameworkConfig.EXPECTED_CONTENT_TYPE); - } - - if (m == null || m.equalsIgnoreCase("text/event-stream")) { - if (cr.getHttpHeaders().getFirst(HttpHeaders.CONTENT_TYPE) != null) { - m = cr.getHttpHeaders().getFirst(HttpHeaders.CONTENT_TYPE).toString(); - } - - if (m == null || m.equalsIgnoreCase("application/octet-stream")) { - m = r.getAtmosphereConfig().getInitParameter(ApplicationConfig.SSE_CONTENT_TYPE); - if (m == null) { - m = "text/plain"; - } - } - } - - if (e.getMessage() instanceof Response) { - cr.setResponse((Response) e.getMessage()); - cr.getHttpHeaders().add(HttpHeaders.CONTENT_TYPE, m); - cr.write(); - try { - cr.getOutputStream().flush(); - } catch (IOException ex) { - logger.trace("", ex); - } - } else if (e.getMessage() instanceof List) { - for (Object msg : (List) e.getMessage()) { - cr.setResponse(Response.ok(msg).build()); - cr.getHttpHeaders().add(HttpHeaders.CONTENT_TYPE, m); - cr.write(); - } - - // https://github.com/Atmosphere/atmosphere/issues/169 - try { - cr.getOutputStream().flush(); - } catch (IOException ex) { - logger.trace("", ex); - } - } else { - if (e.getMessage() == null) { - logger.warn("Broadcasted message is null"); - return; - } - - cr.setResponse(Response.ok(e.getMessage()).build()); - cr.getHttpHeaders().add(HttpHeaders.CONTENT_TYPE, m); - cr.write(); - try { - cr.getOutputStream().flush(); - } catch (IOException ex) { - logger.trace("", ex); - } - } - } catch (Throwable t) { - boolean notifyAndCache = true; - logger.trace("Unexpected exception for AtmosphereResource {} and Broadcaster {}", r.uuid(), broadcaster.getID()); - if (isJetty(r)) { - for (StackTraceElement element : t.getStackTrace()) { - if (element.getClassName().equals("java.io.BufferedWriter") - && element.getMethodName().equals("flush")) { - logger.trace("Workaround issue https://github.com/Atmosphere/atmosphere/issues/710"); - notifyAndCache = false; - } - } - } - - if (DefaultBroadcaster.class.isAssignableFrom(broadcaster.getClass())) { - DefaultBroadcaster.class.cast(broadcaster).onException(t, r, notifyAndCache); - } else { - onException(t, r); - } - } finally { - if (cr != null) { - cr.setEntity(null); - } - - Boolean resumeOnBroadcast = (Boolean) request.getAttribute(ApplicationConfig.RESUME_ON_BROADCAST); - if (resumeOnBroadcast != null && resumeOnBroadcast) { - - String uuid = (String) request.getAttribute(AtmosphereFilter.RESUME_UUID); - if (uuid != null) { - if (request.getAttribute(AtmosphereFilter.RESUME_CANDIDATES) != null) { - ((ConcurrentHashMap) request.getAttribute(AtmosphereFilter.RESUME_CANDIDATES)).remove(uuid); - } - } - r.getRequest().setAttribute(FrameworkConfig.CONTAINER_RESPONSE, null); - r.resume(); - } - - } - } - } - - final static void onException(Throwable t, AtmosphereResource r) { - logger.trace("onException()", t); - r.notifyListeners(new AtmosphereResourceEventImpl((AtmosphereResourceImpl) r, true, false)); - AtmosphereResourceImpl.class.cast(r)._destroy(); - } - - public static boolean isJetty(AtmosphereResource r) { - final String container = r.getAtmosphereConfig().getServletContext().getServerInfo(); - if (container != null && container.toLowerCase().indexOf("jetty") != -1) { - return true; - } - return false; - } -} diff --git a/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseySimpleBroadcaster.java b/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseySimpleBroadcaster.java deleted file mode 100755 index 31718f548e5..00000000000 --- a/modules/jersey/src/main/java/org/atmosphere/jersey/util/JerseySimpleBroadcaster.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey.util; - - -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.util.SimpleBroadcaster; - -/** - * Simple {@link org.atmosphere.cpr.Broadcaster} implementation that use the calling thread when broadcasting events. - * - * @author Jeanfrancois Arcand - */ -public class JerseySimpleBroadcaster extends SimpleBroadcaster { - - @Override - protected void invokeOnStateChange(final AtmosphereResource r, final AtmosphereResourceEvent e) { - JerseyBroadcasterUtil.broadcast(r, e, this); - } -} \ No newline at end of file diff --git a/modules/jersey/src/main/resources/META-INF/services/jersey-server-components b/modules/jersey/src/main/resources/META-INF/services/jersey-server-components deleted file mode 100644 index 4877273deed..00000000000 --- a/modules/jersey/src/main/resources/META-INF/services/jersey-server-components +++ /dev/null @@ -1 +0,0 @@ -org.atmosphere.jersey.AtmosphereResourceConfigurator diff --git a/modules/jersey/src/test/java/org/atmosphere/jersey/BaseTest.java b/modules/jersey/src/test/java/org/atmosphere/jersey/BaseTest.java deleted file mode 100644 index 87a921662e1..00000000000 --- a/modules/jersey/src/test/java/org/atmosphere/jersey/BaseTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import org.atmosphere.container.Jetty7CometSupport; -import org.atmosphere.cpr.AtmosphereServlet; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; - -import java.io.IOException; -import java.net.ServerSocket; - -public abstract class BaseTest { - - protected static final Logger logger = LoggerFactory.getLogger(BaseTest.class); - - protected static final String ROOT = "/*"; - - protected AtmosphereServlet atmoServlet; - public String urlTarget; - public int port; - private Server server; - - public void startServer() throws Exception { - server = new Server(port); - ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); - context.setContextPath("/"); - server.setHandler(context); - context.addServlet(new ServletHolder(atmoServlet), "/*"); - server.start(); - } - - public void configureCometSupport() { - atmoServlet.framework().setAsyncSupport(new Jetty7CometSupport(atmoServlet.framework().getAtmosphereConfig())); - } - - public void stopServer() throws Exception { - server.stop(); - } - - public static class TestHelper { - - public static int getEnvVariable(final String varName, int defaultValue) { - if (null == varName) { - return defaultValue; - } - String varValue = System.getenv(varName); - if (null != varValue) { - try { - return Integer.parseInt(varValue); - } catch (NumberFormatException e) { - // will return default value bellow - } - } - return defaultValue; - } - } - - protected int findFreePort() throws IOException { - ServerSocket socket = null; - - try { - socket = new ServerSocket(0); - - return socket.getLocalPort(); - } finally { - if (socket != null) { - socket.close(); - } - } - } - - @BeforeMethod(alwaysRun = true) - public void setUpGlobal() throws Exception { - port = TestHelper.getEnvVariable("ATMOSPHERE_HTTP_PORT", findFreePort()); - urlTarget = getUrlTarget(port); - atmoServlet = new AtmosphereServlet(); - atmoServlet.framework().addInitParameter("com.sun.jersey.config.property.packages", this.getClass().getPackage().getName()); - - configureCometSupport(); - startServer(); - } - - abstract String getUrlTarget(int port); - - @AfterMethod(alwaysRun = true) - public void unsetAtmosphereHandler() throws Exception { - if (atmoServlet != null) atmoServlet.destroy(); - stopServer(); - } - - -} diff --git a/modules/jersey/src/test/java/org/atmosphere/jersey/MappingResourceTest.java b/modules/jersey/src/test/java/org/atmosphere/jersey/MappingResourceTest.java deleted file mode 100644 index eb9ead9d624..00000000000 --- a/modules/jersey/src/test/java/org/atmosphere/jersey/MappingResourceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.jersey; - -import com.ning.http.client.AsyncHttpClient; -import com.ning.http.client.Response; -import org.testng.annotations.Test; - -import java.util.concurrent.TimeUnit; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -/** - * @author paulsandoz - */ -public class MappingResourceTest extends BaseTest { - - String getUrlTarget(int port) { - return "http://127.0.0.1:" + port + "/jfarcand@apache.org"; - } - - @Test(timeOut = 20000, enabled = true) - public void testSpecialCharsMapping() { - logger.info("{}: running test: testSpecialCharsMapping", getClass().getSimpleName()); - - AsyncHttpClient c = new AsyncHttpClient(); - try { - long t1 = System.currentTimeMillis(); - Response r = c.prepareGet(urlTarget).execute().get(10, TimeUnit.SECONDS); - assertNotNull(r); - assertEquals(r.getStatusCode(), 200); - String resume = r.getResponseBody(); - assertEquals(resume, ""); - long current = System.currentTimeMillis() - t1; - assertTrue(current > 5000 && current < 10000); - } catch (Exception e) { - logger.error("test failed", e); - fail(e.getMessage()); - } - c.close(); - - } - -} diff --git a/modules/jersey/src/test/java/org/atmosphere/jersey/QueryStringTest.java b/modules/jersey/src/test/java/org/atmosphere/jersey/QueryStringTest.java deleted file mode 100644 index 7f2b7a1b523..00000000000 --- a/modules/jersey/src/test/java/org/atmosphere/jersey/QueryStringTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package org.atmosphere.jersey; - -import com.ning.http.client.AsyncHttpClient; -import com.ning.http.client.Response; -import org.testng.annotations.Test; - -import java.util.concurrent.TimeUnit; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -public class QueryStringTest extends BaseTest { - - String getUrlTarget(int port) { - return "http://127.0.0.1:" + port + "/jfarcand@apache.org"; - } - - @Test(timeOut = 20000, enabled = true) - public void testSpecialCharsMapping() { - logger.info("{}: running test: testSpecialCharsMapping", getClass().getSimpleName()); - - AsyncHttpClient c = new AsyncHttpClient(); - try { - long t1 = System.currentTimeMillis(); - Response r = c.prepareGet(urlTarget + "/a?a=a&b=b").execute().get(10, TimeUnit.SECONDS); - assertNotNull(r); - assertEquals(r.getStatusCode(), 200); - assertEquals(r.getResponseBody(), "ab"); - } catch (Exception e) { - logger.error("test failed", e); - fail(e.getMessage()); - } - c.close(); - - } - -} diff --git a/modules/jersey/src/test/java/org/atmosphere/jersey/TestResource.java b/modules/jersey/src/test/java/org/atmosphere/jersey/TestResource.java deleted file mode 100644 index 9cc18c068f0..00000000000 --- a/modules/jersey/src/test/java/org/atmosphere/jersey/TestResource.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.spi.resource.Singleton; -import org.atmosphere.annotation.Broadcast; -import org.atmosphere.annotation.Suspend; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterFactory; -import org.jboss.netty.handler.codec.http.QueryStringEncoder; - -import javax.ws.rs.FormParam; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; - -import static org.testng.Assert.assertNotNull; - -@Path("/{topic}") -@Produces("text/plain;charset=ISO-8859-1") -public class TestResource { - - private - @PathParam("topic") - Broadcaster topic; - - @Context - BroadcasterFactory bf; - - @Context - AtmosphereResource ar; - - @GET - @Suspend(period = 5000) - public String subscribe() { - assertNotNull(topic.toString()); - assertNotNull(bf.toString()); - assertNotNull(ar.toString()); - return ""; - } - - @GET - @Path("/a") - public String queryString(@QueryParam("a") String a, @QueryParam("b") String b) { - return a + b; - } -} \ No newline at end of file diff --git a/modules/jersey/src/test/java/org/atmosphere/jersey/WriteTimeoutTest.java b/modules/jersey/src/test/java/org/atmosphere/jersey/WriteTimeoutTest.java deleted file mode 100644 index 3c05d6a9af0..00000000000 --- a/modules/jersey/src/test/java/org/atmosphere/jersey/WriteTimeoutTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2017 Jean-Francois Arcand - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.jersey; - -import com.sun.jersey.spi.container.servlet.ServletContainer; -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcasterFactory; -import org.atmosphere.handler.ReflectorServletProcessor; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; - -import static org.mockito.Mockito.mock; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - -public class WriteTimeoutTest { - - private AtmosphereResource ar; - private J broadcaster; - private AtmosphereHandler atmosphereHandler; - private AtmosphereConfig config; - - - private final static class F extends DefaultBroadcasterFactory { - - protected F(Class clazz, String broadcasterLifeCyclePolicy, AtmosphereConfig c) { - super(clazz, broadcasterLifeCyclePolicy, c); - } - } - - public final static class J extends JerseyBroadcaster { - private CountDownLatch latch; - - public J() { - } - - JerseyBroadcaster latch(CountDownLatch latch) { - this.latch = latch; - return this; - } - - @Override - protected void invokeOnStateChange(final AtmosphereResource r, final AtmosphereResourceEvent e) { - try { - if (latch != null) latch.await(5, TimeUnit.SECONDS); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - } - } - - @BeforeMethod - public void setUp() throws Exception { - config = new AtmosphereFramework().addInitParameter("org.atmosphere.cpr.Broadcaster.writeTimeout", "2000") - .addInitParameter("com.sun.jersey.config.property.packages", "org.atmosphere.jersey") - .addInitParameter("org.atmosphere.useStream", "true") - .addInitParameter("org.atmosphere.disableOnStateEvent", "true") - .init(new ServletConfig() { - @Override - public String getServletName() { - return "void"; - } - - @Override - public ServletContext getServletContext() { - return mock(ServletContext.class); - } - - @Override - public String getInitParameter(String name) { - return null; - } - - @Override - public Enumeration getInitParameterNames() { - return Collections.enumeration(new ArrayList()); - } - }).getAtmosphereConfig(); - DefaultBroadcasterFactory factory = new F(J.class, "NEVER", config); - config.framework().setBroadcasterFactory(factory); - broadcaster = (J) factory.get("test"); - atmosphereHandler = new ReflectorServletProcessor(new ServletContainer()); - } - - @AfterMethod - public void unSetUp() throws Exception { - broadcaster.destroy(); - } - - @Test - public void testWriteTimeout() throws ExecutionException, InterruptedException, ServletException { - final CountDownLatch latch = new CountDownLatch(1); - final CountDownLatch guard = new CountDownLatch(1); - - ar = new AtmosphereResourceImpl(config, - broadcaster, - mock(AtmosphereRequestImpl.class), - AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), - atmosphereHandler); - - broadcaster.latch(latch).addAtmosphereResource(ar); - - final AtomicReference t = new AtomicReference(); - ar.addEventListener(new AtmosphereResourceEventListenerAdapter() { - @Override - public void onThrowable(AtmosphereResourceEvent event) { - t.set(event.throwable()); - guard.countDown(); - } - }); - broadcaster.broadcast("foo", ar).get(); - guard.await(10, TimeUnit.SECONDS); - assertNotNull(t.get()); - assertEquals(t.get().getMessage(), "Unable to write after 2000"); - } - - @Test - public void testNoWriteTimeout() throws ExecutionException, InterruptedException, ServletException { - ar = new AtmosphereResourceImpl(config, - broadcaster, - mock(AtmosphereRequestImpl.class), - AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), - atmosphereHandler); - - broadcaster.addAtmosphereResource(ar); - - final AtomicReference t = new AtomicReference(); - ar.addEventListener(new AtmosphereResourceEventListenerAdapter() { - @Override - public void onThrowable(AtmosphereResourceEvent event) { - t.set(event.throwable()); - } - }); - broadcaster.broadcast("foo", ar).get(); - assertEquals(t.get(), null); - } -} diff --git a/modules/jersey/src/test/resources/logback-test.xml b/modules/jersey/src/test/resources/logback-test.xml deleted file mode 100755 index daf610ab80b..00000000000 --- a/modules/jersey/src/test/resources/logback-test.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} %level [%thread] %logger{10} [%file:%line] %msg%n - - - - - - - - - - - - diff --git a/modules/native/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java b/modules/native/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java deleted file mode 100644 index 66ee024de5a..00000000000 --- a/modules/native/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright 2017 Async-IO.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package org.atmosphere.cpr; - -import org.apache.catalina.CometEvent; -import org.apache.catalina.CometProcessor; -import org.atmosphere.container.JBossAsyncSupportWithWebSocket; -import org.atmosphere.container.JBossWebCometSupport; -import org.atmosphere.container.Tomcat7CometSupport; -import org.atmosphere.container.TomcatCometSupport; -import org.jboss.servlet.http.HttpEvent; -import org.jboss.servlet.http.HttpEventServlet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Enumeration; - -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_UPGRADE; - -/** - * This servlet supports native Comet support with Tomcat 6, 7 and JBoss Web 3.x - * - * @author Jeanfrancois Arcand - */ -public class AtmosphereServlet extends HttpServlet implements CometProcessor, HttpEventServlet, org.apache.catalina.comet.CometProcessor { - - private static final long serialVersionUID = 7526472295622776147L; - protected static final Logger logger = LoggerFactory.getLogger(AtmosphereServlet.class); - protected final AtmosphereFrameworkInitializer initializer; - - /** - * Create an Atmosphere Servlet. - */ - public AtmosphereServlet() { - this(false); - } - - /** - * Create an Atmosphere Servlet. - * - * @param isFilter true if this instance is used as an {@link org.atmosphere.cpr.AtmosphereFilter} - */ - public AtmosphereServlet(boolean isFilter) { - this(isFilter, true); - } - - /** - * Create an Atmosphere Servlet. - * - * @param isFilter true if this instance is used as an {@link org.atmosphere.cpr.AtmosphereFilter} - * @param autoDetectHandlers - */ - public AtmosphereServlet(boolean isFilter, boolean autoDetectHandlers) { - initializer = new AtmosphereFrameworkInitializer(isFilter, autoDetectHandlers); - } - - @Override - public void destroy() { - initializer.destroy(); - } - - @Override - public void init(final ServletConfig sc) throws ServletException { - configureFramework(sc); - super.init(sc); - } - - protected AtmosphereServlet configureFramework(ServletConfig sc) throws ServletException { - return configureFramework(sc, true); - } - - protected AtmosphereServlet configureFramework(ServletConfig sc, boolean init) throws ServletException { - initializer.configureFramework(sc, init, true, AtmosphereFramework.class); - return this; - } - - protected AtmosphereFramework newAtmosphereFramework() { - return initializer.newAtmosphereFramework(AtmosphereFramework.class); - } - - public AtmosphereFramework framework() { - return initializer.framework(); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doHead(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doOptions(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doTrace(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doDelete(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doPut(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doGet(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - doPost(req, res); - } - - /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} - * - * @param req the {@link javax.servlet.http.HttpServletRequest} - * @param res the {@link javax.servlet.http.HttpServletResponse} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - @Override - public void doPost(HttpServletRequest req, HttpServletResponse res) - throws IOException, ServletException { - initializer.framework().doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(res)); - } - - /** - * Hack to support Tomcat AIO like other WebServer. This method is invoked - * by Tomcat when it detect a {@link Servlet} implements the interface - * {@link CometProcessor} without invoking {@link Servlet#service} - * - * @param cometEvent the {@link CometEvent} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - public void event(CometEvent cometEvent) throws IOException, ServletException { - HttpServletRequest req = cometEvent.getHttpServletRequest(); - HttpServletResponse res = cometEvent.getHttpServletResponse(); - req.setAttribute(TomcatCometSupport.COMET_EVENT, cometEvent); - - if (!initializer.framework().getAsyncSupport().supportWebSocket()) { - if (!initializer.framework().isCometSupportSpecified && !initializer.framework().isCometSupportConfigured.getAndSet(true)) { - synchronized (initializer.framework().asyncSupport) { - if (!initializer.framework().asyncSupport.getClass().equals(TomcatCometSupport.class)) { - AsyncSupport current = initializer.framework().asyncSupport; - logger.warn("TomcatCometSupport is enabled, switching to it"); - initializer.framework().asyncSupport = new TomcatCometSupport(initializer.framework().config); - if (current instanceof AsynchronousProcessor) { - ((AsynchronousProcessor) current).shutdown(); - } - initializer.framework().asyncSupport.init(initializer.framework().config.getServletConfig()); - } - } - } - } - - initializer.framework().doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(res)); - - String transport = cometEvent.getHttpServletRequest().getParameter(HeaderConfig.X_ATMOSPHERE_TRANSPORT); - if (transport != null && transport.equalsIgnoreCase(HeaderConfig.WEBSOCKET_TRANSPORT)) { - cometEvent.close(); - } - } - - /** - * Hack to support Tomcat 7 AIO - */ - public void event(org.apache.catalina.comet.CometEvent cometEvent) throws IOException, ServletException { - HttpServletRequest req = cometEvent.getHttpServletRequest(); - HttpServletResponse res = cometEvent.getHttpServletResponse(); - req.setAttribute(Tomcat7CometSupport.COMET_EVENT, cometEvent); - - if (!initializer.framework().getAsyncSupport().supportWebSocket()) { - if (!initializer.framework().isCometSupportSpecified && !initializer.framework().isCometSupportConfigured.getAndSet(true)) { - synchronized (initializer.framework().asyncSupport) { - if (!initializer.framework().asyncSupport.getClass().equals(Tomcat7CometSupport.class)) { - AsyncSupport current = initializer.framework().asyncSupport; - logger.warn("TomcatCometSupport7 is enabled, switching to it"); - initializer.framework().asyncSupport = new Tomcat7CometSupport(initializer.framework().config); - if (current instanceof AsynchronousProcessor) { - ((AsynchronousProcessor) current).shutdown(); - } - initializer.framework().asyncSupport.init(initializer.framework().config.getServletConfig()); - } - } - } - } - - initializer.framework().doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(res)); - - // https://github.com/Atmosphere/atmosphere/issues/920 - String transport = cometEvent.getHttpServletRequest().getParameter(HeaderConfig.X_ATMOSPHERE_TRANSPORT); - boolean webSocketSupported = (transport != null && transport.equalsIgnoreCase(HeaderConfig.WEBSOCKET_TRANSPORT)); - if (!webSocketSupported) { - try { - Enumeration connection = req.getHeaders("Connection"); - if (connection != null && connection.hasMoreElements()) { - String[] e = connection.nextElement().toString().split(","); - for (String upgrade : e) { - if (upgrade.trim().equalsIgnoreCase(WEBSOCKET_UPGRADE)) { - webSocketSupported = true; - break; - } - } - } - } catch (Exception ex) { - logger.trace("", ex); - } - } - - if (webSocketSupported) { - cometEvent.close(); - } - } - - /** - * Hack to support JBossWeb AIO like other WebServer. This method is invoked - * by Tomcat when it detect a {@link Servlet} implements the interface - * {@link HttpEventServlet} without invoking {@link Servlet#service} - * - * @param httpEvent the {@link CometEvent} - * @throws java.io.IOException - * @throws javax.servlet.ServletException - */ - public void event(HttpEvent httpEvent) throws IOException, ServletException { - HttpServletRequest req = httpEvent.getHttpServletRequest(); - HttpServletResponse res = httpEvent.getHttpServletResponse(); - req.setAttribute(JBossWebCometSupport.HTTP_EVENT, httpEvent); - - if (!initializer.framework().isCometSupportSpecified && !initializer.framework().isCometSupportConfigured.getAndSet(true)) { - synchronized (initializer.framework().asyncSupport) { - if (!initializer.framework().asyncSupport.getClass().equals(JBossWebCometSupport.class) - && !initializer.framework().asyncSupport.getClass().equals(JBossAsyncSupportWithWebSocket.class)) { - AsyncSupport current = initializer.framework().asyncSupport; - logger.warn("JBossWebCometSupport is enabled, switching to it"); - initializer.framework().asyncSupport = new JBossWebCometSupport(initializer.framework().config); - if (current instanceof AsynchronousProcessor) { - ((AsynchronousProcessor) current).shutdown(); - } - initializer.framework().asyncSupport.init(initializer.framework().config.getServletConfig()); - } - } - } - - boolean isWebSocket = req.getHeader("Upgrade") == null ? false : true; - if (isWebSocket && initializer.framework().asyncSupport.getClass().equals(JBossAsyncSupportWithWebSocket.class)) { - logger.trace("Dispatching websocket event: " + httpEvent); - ((JBossAsyncSupportWithWebSocket) initializer.framework().asyncSupport).dispatch(httpEvent); - } else { - logger.trace("Dispatching comet event: " + httpEvent); - initializer.framework().doCometSupport(AtmosphereRequestImpl.wrap(req), AtmosphereResponseImpl.wrap(res)); - } - } - -} diff --git a/modules/pom.xml b/modules/pom.xml index b9cf094e7b4..ad832249547 100755 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -15,9 +15,6 @@ https://github.com/Atmosphere/atmosphere - cpr - annotations - jersey - native + runtime diff --git a/modules/runtime/pom.xml b/modules/runtime/pom.xml new file mode 100644 index 00000000000..ee6991399a8 --- /dev/null +++ b/modules/runtime/pom.xml @@ -0,0 +1,128 @@ + + + + org.atmosphere + atmosphere-project + 3.0.0-SNAPSHOT + ../../pom.xml + + 4.0.0 + org.atmosphere + atmosphere-runtime + bundle + 3.0.0-SNAPSHOT + atmosphere-runtime + https://github.com/Atmosphere/atmosphere + + install + + + true + src/main/java/ + + **/*.java + + + + src/main/resources + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + generate-sources + package + + jar-no-fork + + + + + + org.apache.felix + maven-bundle-plugin + ${felix-version} + true + + + + com.sun*;resolution:=optional, + org.apache.shiro*;resolution:=optional, + javax.servlet*;version="${servlet-version-range}", + javax.websocket*;resolution:=optional, + javax.enterprise*;resolution:=optional, + javax.inject*;resolution:=optional, + *, + + + org.atmosphere.cache*, + org.atmosphere.client*, + org.atmosphere.config*, + org.atmosphere.config.managed*, + org.atmosphere.config.service*, + org.atmosphere.container*, + org.atmosphere.cpr*, + org.atmosphere.inject*, + org.atmosphere.inject.annotation*, + org.atmosphere.handler*, + org.atmosphere.interceptor*, + org.atmosphere.pool*, + org.atmosphere.util*, + org.atmosphere.websocket*, + org.atmosphere.lifecycle*, + org.atmosphere.websocket.protocol*, + + + + + + + + + org.mockito + mockito-all + 1.9.5 + jar + test + + + + org.apache.shiro + shiro-core + ${shiro-version} + provided + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + javax + javaee-api + 7.0 + + + + org.apache.shiro + shiro-web + ${shiro-version} + provided + + + + org.apache.commons + commons-pool2 + ${commons-pool2} + true + + + + diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AnnotationUtil.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AnnotationUtil.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AnnotationUtil.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AnnotationUtil.java index 856083aa291..77e67f0c3ab 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AnnotationUtil.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AnnotationUtil.java @@ -17,14 +17,14 @@ import org.atmosphere.client.TrackMessageSizeInterceptor; import org.atmosphere.config.managed.ManagedServiceInterceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; import org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor; import org.atmosphere.interceptor.SuspendTrackerInterceptor; import org.slf4j.Logger; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java index e4ffa1a9d6e..5442d37dc4f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportListenerServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AsyncSupportListenerService; -import org.atmosphere.cpr.AsyncSupportListener; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AsyncSupportListener; +import org.atmosphere.runtime.AtmosphereFramework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java index 671f695e821..3c120d355f0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AsyncSupportServiceProcessor.java @@ -17,9 +17,9 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AsyncSupportService; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.DefaultAsyncSupportResolver; +import org.atmosphere.runtime.AsyncSupport; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.DefaultAsyncSupportResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java index dc6669e8f95..2289ac36443 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereFrameworkServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AtmosphereFrameworkListenerService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereFrameworkListener; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFrameworkListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java index ca76d227ed6..045a82794bd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereHandlerServiceProcessor.java @@ -18,9 +18,9 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.managed.AtmosphereHandlerServiceInterceptor; import org.atmosphere.config.service.AtmosphereHandlerService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereInterceptor; import org.atmosphere.util.IntrospectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java index b1a0b6352f0..5df575bf43c 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereInterceptorServiceProcessor.java @@ -17,9 +17,9 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AtmosphereInterceptorService; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java index 3742fc20af9..5a777cd8da3 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceFactoryServiceProcessor.java @@ -17,10 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AtmosphereResourceFactoryService; -import org.atmosphere.config.service.BroadcasterFactoryService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResourceFactory; -import org.atmosphere.cpr.BroadcasterFactory; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereResourceFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java index 2645693ad51..fbec3a79736 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereResourceListenerServiceProcessor.java @@ -16,11 +16,9 @@ package org.atmosphere.annotation; import org.atmosphere.config.AtmosphereAnnotation; -import org.atmosphere.config.service.AsyncSupportListenerService; import org.atmosphere.config.service.AtmosphereResourceListenerService; -import org.atmosphere.cpr.AsyncSupportListener; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResourceListener; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereResourceListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java index 6541408bb31..427d79f8876 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/AtmosphereServiceProcessor.java @@ -17,13 +17,13 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AtmosphereService; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereServletProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereServletProcessor; import org.atmosphere.handler.ReflectorServletProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ import static org.atmosphere.annotation.AnnotationUtil.filters; import static org.atmosphere.annotation.AnnotationUtil.interceptors; import static org.atmosphere.annotation.AnnotationUtil.listeners; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHOD; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHOD; @AtmosphereAnnotation(AtmosphereService.class) public class AtmosphereServiceProcessor implements Processor { diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java index ce9976d1d5b..7d2e826cb3a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcastFilterServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterFilterService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.BroadcastFilter; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.BroadcastFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java index 5ac65a0b7f8..dff86f652a6 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheInspectorServiceProcessor.java @@ -18,7 +18,7 @@ import org.atmosphere.cache.BroadcasterCacheInspector; import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterCacheInspectorService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java index 32d5862d0e8..0b570a1e72d 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterCacheListenerService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.BroadcasterCacheListener; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.BroadcasterCacheListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java index 5ebbc965d91..06a9d4708ed 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterCacheServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterCacheService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.BroadcasterCache; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.BroadcasterCache; @AtmosphereAnnotation(BroadcasterCacheService.class) public class BroadcasterCacheServiceProcessor implements Processor { diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java index 83e17ff1d71..6815190e4e3 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterFactoryServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterFactoryService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.BroadcasterFactory; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.BroadcasterFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java index b3a8799cb94..2a50e64e247 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterListenerServiceProcessor.java @@ -17,9 +17,9 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterListenerService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterListener; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java index 1ddedc0c517..f5e122326e1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/BroadcasterServiceProcessor.java @@ -17,8 +17,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.BroadcasterService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.Broadcaster; @AtmosphereAnnotation(BroadcasterService.class) public class BroadcasterServiceProcessor implements Processor { diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java index 37fc5756e14..be94a416a3a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/EndpointMapperServiceProcessor.java @@ -17,7 +17,7 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.EndpointMapperService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.util.EndpointMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java index 756b740d0ff..afa54a83f97 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/ManagedServiceProcessor.java @@ -18,11 +18,11 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.managed.ManagedAtmosphereHandler; import org.atmosphere.config.service.ManagedService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.BroadcasterConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.BroadcasterConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java index b2738b06b9d..62c8bcbfde8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/MeteorServiceProcessor.java @@ -18,8 +18,8 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.managed.MeteorServiceInterceptor; import org.atmosphere.config.service.MeteorService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; import org.atmosphere.handler.ReflectorServletProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/Processor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/Processor.java similarity index 74% rename from modules/cpr/src/main/java/org/atmosphere/annotation/Processor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/Processor.java index 513e961871c..746bc6dc6a8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/Processor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/Processor.java @@ -15,19 +15,19 @@ */ package org.atmosphere.annotation; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; /** * Class annotated with {@link org.atmosphere.config.AtmosphereAnnotation} must implement this interface in order to get invoked - * when the {@link org.atmosphere.cpr.AtmosphereFramework#init()} executes. Classes implementing this interface will + * when the {@link org.atmosphere.runtime.AtmosphereFramework#init()} executes. Classes implementing this interface will * have a chance to process annotated classes and take the appropriate action. */ public interface Processor { /** - * Invoked by the {@link org.atmosphere.cpr.AnnotationHandler} when an annotation is detected. + * Invoked by the {@link org.atmosphere.runtime.AnnotationHandler} when an annotation is detected. * - * @param framework the {@link org.atmosphere.cpr.AtmosphereFramework} + * @param framework the {@link org.atmosphere.runtime.AtmosphereFramework} * @param annotatedClass the annotated classes. */ public void handle(final AtmosphereFramework framework, final Class annotatedClass); diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java index 0ae182c6a52..90868c3702f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/UUIDProviderServiceProcessor.java @@ -17,7 +17,7 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.UUIDProviderService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.util.UUIDProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java index 2ea658f0be3..df9fdc1d96b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketFactoryServiceProcessor.java @@ -17,7 +17,7 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.WebSocketFactoryService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.websocket.WebSocketFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java index 911ee9460cc..1f9aa100775 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketHandlerServiceProcessor.java @@ -17,9 +17,9 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.WebSocketHandlerService; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.WebSocketProcessorFactory; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.WebSocketProcessorFactory; import org.atmosphere.websocket.WebSocketHandler; import org.atmosphere.websocket.WebSocketProcessor; import org.slf4j.Logger; @@ -32,7 +32,7 @@ import static org.atmosphere.annotation.AnnotationUtil.broadcasterClass; import static org.atmosphere.annotation.AnnotationUtil.filters; import static org.atmosphere.annotation.AnnotationUtil.listeners; -import static org.atmosphere.cpr.AtmosphereFramework.REFLECTOR_ATMOSPHEREHANDLER; +import static org.atmosphere.runtime.AtmosphereFramework.REFLECTOR_ATMOSPHEREHANDLER; @AtmosphereAnnotation(WebSocketHandlerService.class) public class WebSocketHandlerServiceProcessor implements Processor { diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java index 16760c5b7db..aaf8baa5a21 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProcessorServiceProcessor.java @@ -17,7 +17,7 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.WebSocketProcessorService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.websocket.WebSocketProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java index bf7f796396c..8965ab96da1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/annotation/WebSocketProtocolServiceProcessor.java @@ -17,7 +17,7 @@ import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.WebSocketProtocolService; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.websocket.WebSocketProtocol; @AtmosphereAnnotation(WebSocketProtocolService.class) diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java b/modules/runtime/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java rename to modules/runtime/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java index 0fa352bcfc0..a4a90acc5ed 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/AbstractBroadcasterCache.java @@ -15,10 +15,10 @@ */ package org.atmosphere.cache; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.BroadcasterCacheListener; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.BroadcasterCacheListener; import org.atmosphere.util.ExecutorsFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; /** - * Abstract {@link org.atmosphere.cpr.BroadcasterCache} which is used to implement headers, query parameters or + * Abstract {@link org.atmosphere.runtime.BroadcasterCache} which is used to implement headers, query parameters or * session based caching. * * @author Paul Khodchenkov diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/BroadcastMessage.java b/modules/runtime/src/main/java/org/atmosphere/cache/BroadcastMessage.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/cache/BroadcastMessage.java rename to modules/runtime/src/main/java/org/atmosphere/cache/BroadcastMessage.java index bdd24214d4d..99f8aa31778 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/BroadcastMessage.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/BroadcastMessage.java @@ -18,7 +18,7 @@ import java.util.UUID; /** - * A wrapper around an object passed to {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} + * A wrapper around an object passed to {@link org.atmosphere.runtime.Broadcaster#broadcast(Object)} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/BroadcasterCacheInspector.java b/modules/runtime/src/main/java/org/atmosphere/cache/BroadcasterCacheInspector.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/cache/BroadcasterCacheInspector.java rename to modules/runtime/src/main/java/org/atmosphere/cache/BroadcasterCacheInspector.java diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/CacheMessage.java b/modules/runtime/src/main/java/org/atmosphere/cache/CacheMessage.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/cache/CacheMessage.java rename to modules/runtime/src/main/java/org/atmosphere/cache/CacheMessage.java index 0e555b113c5..cafb5e11f91 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/CacheMessage.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/CacheMessage.java @@ -60,8 +60,8 @@ public long getCreateTime() { } /** - * Return the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} - * @return {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * Return the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} + * @return {@link org.atmosphere.runtime.AtmosphereResource#uuid()} */ public String uuid(){ return uuid; diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java b/modules/runtime/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java rename to modules/runtime/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java index 122a69c9fd5..b009c8f7bec 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/DefaultBroadcasterCache.java @@ -15,10 +15,10 @@ */ package org.atmosphere.cache; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.BroadcasterCacheListener; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.BroadcasterCacheListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java b/modules/runtime/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java rename to modules/runtime/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java index ac7b8c76c0a..a31a7aee2d7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/SessionBroadcasterCache.java @@ -16,7 +16,7 @@ package org.atmosphere.cache; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +26,7 @@ import java.util.List; /** - * Simple {@link org.atmosphere.cpr.BroadcasterCache} that use an {@link javax.servlet.http.HttpSession} to cache + * Simple {@link org.atmosphere.runtime.BroadcasterCache} that use an {@link javax.servlet.http.HttpSession} to cache * messages. * * @author Jeanfrancois Arcand diff --git a/modules/cpr/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java b/modules/runtime/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java rename to modules/runtime/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java index b376cd7d71f..69f53958d38 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java +++ b/modules/runtime/src/main/java/org/atmosphere/cache/UUIDBroadcasterCache.java @@ -15,8 +15,8 @@ */ package org.atmosphere.cache; -import static org.atmosphere.cpr.ApplicationConfig.UUIDBROADCASTERCACHE_CLIENT_IDLETIME; -import static org.atmosphere.cpr.ApplicationConfig.UUIDBROADCASTERCACHE_IDLE_CACHE_INTERVAL; +import static org.atmosphere.runtime.ApplicationConfig.UUIDBROADCASTERCACHE_CLIENT_IDLETIME; +import static org.atmosphere.runtime.ApplicationConfig.UUIDBROADCASTERCACHE_IDLE_CACHE_INTERVAL; import java.util.ArrayList; import java.util.HashSet; @@ -31,10 +31,10 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.BroadcasterCacheListener; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.BroadcasterCacheListener; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.UUIDProvider; import org.slf4j.Logger; diff --git a/modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java b/modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java rename to modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java index 2b395d0d1a5..a8dde790a30 100644 --- a/modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeFilter.java @@ -15,12 +15,12 @@ */ package org.atmosphere.client; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.PerRequestBroadcastFilter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.PerRequestBroadcastFilter; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRACKMESSAGESIZE; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRACKMESSAGESIZE; /** * A {@link PerRequestBroadcastFilter} implementation that add the expected length of the message. This is @@ -30,7 +30,7 @@ * NOTE: The broadcasted message MUST BE a String. If your application is broadcasting another object, you need to * write your own Filter. *

- * If you aren't using atmosphere.js, you need to add the {@link org.atmosphere.cpr.HeaderConfig#X_ATMOSPHERE_TRACKMESSAGESIZE} header in order to + * If you aren't using atmosphere.js, you need to add the {@link org.atmosphere.runtime.HeaderConfig#X_ATMOSPHERE_TRACKMESSAGESIZE} header in order to * enable that Filter. The delimiter character used is '|'. *

* For example, broadcasting String 'helloword' will be received by the client as '9|helloword' but delivered as 'helloword' diff --git a/modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java similarity index 88% rename from modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java index ff1d3ab7916..be6b6e8f9ac 100644 --- a/modules/cpr/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/client/TrackMessageSizeInterceptor.java @@ -15,17 +15,17 @@ */ package org.atmosphere.client; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.interceptor.InvokationOrder; import org.atmosphere.util.IOUtils; import org.atmosphere.util.Utils; @@ -41,13 +41,13 @@ import java.util.Arrays; import java.util.HashSet; -import static org.atmosphere.cpr.ApplicationConfig.EXCLUDED_CONTENT_TYPES; -import static org.atmosphere.cpr.ApplicationConfig.MESSAGE_DELIMITER; +import static org.atmosphere.runtime.ApplicationConfig.EXCLUDED_CONTENT_TYPES; +import static org.atmosphere.runtime.ApplicationConfig.MESSAGE_DELIMITER; /** - * An {@link org.atmosphere.cpr.AtmosphereInterceptor} that add a message size and delimiter. + * An {@link org.atmosphere.runtime.AtmosphereInterceptor} that add a message size and delimiter. *

- * The special String is configurable using {@link org.atmosphere.cpr.ApplicationConfig#MESSAGE_DELIMITER} and + * The special String is configurable using {@link org.atmosphere.runtime.ApplicationConfig#MESSAGE_DELIMITER} and * you can configure this class to exclude some response's content-type by using the {@link ApplicationConfig#EXCLUDED_CONTENT_TYPES} * * @author Jeanfrancois Arcand diff --git a/modules/cpr/src/main/java/org/atmosphere/config/ApplicationConfiguration.java b/modules/runtime/src/main/java/org/atmosphere/config/ApplicationConfiguration.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/ApplicationConfiguration.java rename to modules/runtime/src/main/java/org/atmosphere/config/ApplicationConfiguration.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/AtmosphereAnnotation.java b/modules/runtime/src/main/java/org/atmosphere/config/AtmosphereAnnotation.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/AtmosphereAnnotation.java rename to modules/runtime/src/main/java/org/atmosphere/config/AtmosphereAnnotation.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/AtmosphereHandlerConfig.java b/modules/runtime/src/main/java/org/atmosphere/config/AtmosphereHandlerConfig.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/AtmosphereHandlerConfig.java rename to modules/runtime/src/main/java/org/atmosphere/config/AtmosphereHandlerConfig.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/AtmosphereHandlerProperty.java b/modules/runtime/src/main/java/org/atmosphere/config/AtmosphereHandlerProperty.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/AtmosphereHandlerProperty.java rename to modules/runtime/src/main/java/org/atmosphere/config/AtmosphereHandlerProperty.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/FrameworkConfiguration.java b/modules/runtime/src/main/java/org/atmosphere/config/FrameworkConfiguration.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/FrameworkConfiguration.java rename to modules/runtime/src/main/java/org/atmosphere/config/FrameworkConfiguration.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java index 81e2fa3af06..378a5eb3062 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/managed/AtmosphereHandlerServiceInterceptor.java @@ -17,11 +17,11 @@ import org.atmosphere.config.service.AtmosphereHandlerService; import org.atmosphere.config.service.Singleton; -import org.atmosphere.cpr.AtmosphereFramework.AtmosphereHandlerWrapper; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.AtmosphereFramework.AtmosphereHandlerWrapper; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.FrameworkConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/Decoder.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/Decoder.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/Decoder.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/Decoder.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/Encoder.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/Encoder.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/Encoder.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/Encoder.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/Invoker.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/Invoker.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/Invoker.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/Invoker.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java index 9b74317785b..ed425b9f628 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedAtmosphereHandler.java @@ -26,15 +26,15 @@ import org.atmosphere.config.service.Put; import org.atmosphere.config.service.Ready; import org.atmosphere.config.service.Resume; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceFactory; -import org.atmosphere.cpr.AtmosphereResourceHeartbeatEventListener; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceFactory; +import org.atmosphere.runtime.AtmosphereResourceHeartbeatEventListener; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; import org.atmosphere.handler.AnnotatedProxy; import org.atmosphere.util.IOUtils; @@ -56,9 +56,9 @@ import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnClose; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnResume; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnSuspend; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnClose; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnResume; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnSuspend; import static org.atmosphere.util.IOUtils.isBodyEmpty; import static org.atmosphere.util.IOUtils.readEntirely; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java index 6247f459854..9dfc7d01635 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/managed/ManagedServiceInterceptor.java @@ -18,12 +18,12 @@ import org.atmosphere.config.service.ManagedService; import org.atmosphere.config.service.PathParam; import org.atmosphere.config.service.Singleton; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.handler.AnnotatedProxy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java index 09ec4f8459d..cc784fc2e4b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/managed/MeteorServiceInterceptor.java @@ -17,10 +17,10 @@ import org.atmosphere.config.service.MeteorService; import org.atmosphere.config.service.Singleton; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.handler.ReflectorServletProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java similarity index 84% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java index 9b2fcc033a6..2b4259c6eb0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/managed/ServiceInterceptor.java @@ -15,14 +15,14 @@ */ package org.atmosphere.config.managed; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.interceptor.InvokationOrder; import org.atmosphere.util.Utils; import org.slf4j.Logger; @@ -67,8 +67,8 @@ public Action inspect(AtmosphereResource r) { } /** - * Inspect the request and its mapped {@link org.atmosphere.cpr.AtmosphereHandler} to determine if the '{}' was used when defined the - * annotation's path value. It will create a new {@link org.atmosphere.cpr.AtmosphereHandler} in case {} is detected . + * Inspect the request and its mapped {@link org.atmosphere.runtime.AtmosphereHandler} to determine if the '{}' was used when defined the + * annotation's path value. It will create a new {@link org.atmosphere.runtime.AtmosphereHandler} in case {} is detected . * * @param request * @param w diff --git a/modules/cpr/src/main/java/org/atmosphere/config/managed/TypeResolver.java b/modules/runtime/src/main/java/org/atmosphere/config/managed/TypeResolver.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/managed/TypeResolver.java rename to modules/runtime/src/main/java/org/atmosphere/config/managed/TypeResolver.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java index 91894abc464..bd30a01cf41 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportListenerService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.AsyncSupportListener} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.AsyncSupportListener} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportService.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportService.java index 18a4e2bd1d2..1db9c8c064b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AsyncSupportService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AsyncSupportService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.AsyncSupport} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.AsyncSupport} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java index 56616e4f47d..fc5993ec836 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereFrameworkListenerService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for installing {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * An annotation for installing {@link org.atmosphere.runtime.AtmosphereFrameworkListener} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java similarity index 68% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java index 583a2b8c853..31a748d3258 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereHandlerService.java @@ -16,12 +16,12 @@ package org.atmosphere.config.service; import org.atmosphere.cache.DefaultBroadcasterCache; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.DefaultBroadcaster; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -30,7 +30,7 @@ import java.lang.annotation.Target; /** - * An annotation for {@link org.atmosphere.cpr.AtmosphereHandler} + * An annotation for {@link org.atmosphere.runtime.AtmosphereHandler} * * @author Jeanfrancois Arcand */ @@ -40,9 +40,9 @@ public @interface AtmosphereHandlerService { /** - * The {@link org.atmosphere.cpr.Broadcaster} class name + * The {@link org.atmosphere.runtime.Broadcaster} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcaster() default DefaultBroadcaster.class; @@ -59,42 +59,42 @@ String path() default "/"; /** - * Properties that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Properties are defined + * Properties that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Properties are defined * delimited using "=" and separated using comma. * - * @return an array of properties that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler} + * @return an array of properties that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler} */ String[] properties() default {}; /** - * Set to true if this {@link org.atmosphere.cpr.AtmosphereHandler} supports sessions + * Set to true if this {@link org.atmosphere.runtime.AtmosphereHandler} supports sessions * * @return true if session are supported. */ boolean supportSession() default false; /** - * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Configuration + * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Configuration * name and value is delimited by "=", and different configuration lines are separated by comma. */ String[] atmosphereConfig() default {}; /** - * A list of {@link org.atmosphere.cpr.AtmosphereInterceptor} to install + * A list of {@link org.atmosphere.runtime.AtmosphereInterceptor} to install */ Class[] interceptors() default {}; /** - * The {@link org.atmosphere.cpr.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} + * The {@link org.atmosphere.runtime.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} * is installed. It is strongly recommended to install the {@link org.atmosphere.cache.UUIDBroadcasterCache} to prevent * message being lost. * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcasterCache() default DefaultBroadcasterCache.class; /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} to track internal events. + * Add {@link org.atmosphere.runtime.AtmosphereResourceEventListener} to track internal events. */ public Class[] listeners() default {}; } diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java similarity index 79% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java index ff6de494625..6a2ced358de 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereInterceptorService.java @@ -22,10 +22,10 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.AtmosphereInterceptor} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.AtmosphereInterceptor} class to use by default. * - * A class annotated with this annotation will be invoked during the {@link org.atmosphere.cpr.AtmosphereConfig#startupHook(org.atmosphere.cpr.AtmosphereConfig.StartupHook)} - * execution. Thus, do not invoke that method from an {@link org.atmosphere.cpr.AtmosphereInterceptor#configure(org.atmosphere.cpr.AtmosphereConfig)} to avoid unpredictable behaviors. + * A class annotated with this annotation will be invoked during the {@link org.atmosphere.runtime.AtmosphereConfig#startupHook(org.atmosphere.runtime.AtmosphereConfig.StartupHook)} + * execution. Thus, do not invoke that method from an {@link org.atmosphere.runtime.AtmosphereInterceptor#configure(org.atmosphere.runtime.AtmosphereConfig)} to avoid unpredictable behaviors. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java index 577e75b19e3..73b2cd2ca0f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceFactoryService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.AtmosphereResourceFactory} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.AtmosphereResourceFactory} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java index 7e49939ba75..b4cd8a419fd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereResourceListenerService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * Install an {@link org.atmosphere.cpr.AtmosphereResourceListener} + * Install an {@link org.atmosphere.runtime.AtmosphereResourceListener} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereService.java similarity index 70% rename from modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereService.java index d175e7ab081..0ac07f902fc 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/AtmosphereService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/AtmosphereService.java @@ -17,12 +17,12 @@ import org.atmosphere.cache.UUIDBroadcasterCache; import org.atmosphere.client.TrackMessageSizeInterceptor; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.DefaultBroadcaster; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -34,12 +34,12 @@ * that can be used with frameworks like Jersey, Wicket or any framework running the Atmosphere Framework. The annotation * allow configuring Atmosphere's components like {@link Broadcaster}, {@link AtmosphereInterceptor}, etc. * - * This annotation doesn't install any Atmosphere Component like {@link ManagedService}, {@link org.atmosphere.cpr.AtmosphereHandler} + * This annotation doesn't install any Atmosphere Component like {@link ManagedService}, {@link org.atmosphere.runtime.AtmosphereHandler} * or {@link org.atmosphere.websocket.WebSocketHandler}. The framework supporting the annotation must itself deploy an * Atmosphere's Service when specified, The {@link #servlet()} returned value will be used to install a * {@link org.atmosphere.handler.ReflectorServletProcessor} that will dispatch requests to the {@link javax.servlet.Servlet}. * You can customize the request dispatch by setting the {@link #dispatch()} to false. When set to false, the - * {@link org.atmosphere.handler.ReflectorServletProcessor#onRequest(org.atmosphere.cpr.AtmosphereResource)} will never be invoked. + * {@link org.atmosphere.handler.ReflectorServletProcessor#onRequest(org.atmosphere.runtime.AtmosphereResource)} will never be invoked. * * By default, only the {@link org.atmosphere.client.TrackMessageSizeInterceptor} is installed. */ @@ -47,7 +47,7 @@ @Retention(RetentionPolicy.RUNTIME) public @interface AtmosphereService { /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} to track internal events. + * Add {@link org.atmosphere.runtime.AtmosphereResourceEventListener} to track internal events. */ public Class[] listeners() default {}; @@ -57,14 +57,14 @@ Class[] broadcastFilters() default {}; /** - * The {@link org.atmosphere.cpr.Broadcaster} class name + * The {@link org.atmosphere.runtime.Broadcaster} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcaster() default DefaultBroadcaster.class; /** - * A list of {@link org.atmosphere.cpr.AtmosphereInterceptor} to install. Default are + * A list of {@link org.atmosphere.runtime.AtmosphereInterceptor} to install. Default are * {@link org.atmosphere.client.TrackMessageSizeInterceptor} and {@link org.atmosphere.interceptor.HeartbeatInterceptor} */ Class[] interceptors() default { @@ -72,15 +72,15 @@ Class[] interceptors() default { }; /** - * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Configuration + * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Configuration * name and value is delimited by "=", and different configuration lines are separated by comma. */ String[] atmosphereConfig() default {}; /** - * The {@link org.atmosphere.cpr.BroadcasterCache} class name + * The {@link org.atmosphere.runtime.BroadcasterCache} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name. Default is {@link org.atmosphere.cache.UUIDBroadcasterCache} + * @return The {@link org.atmosphere.runtime.Broadcaster} class name. Default is {@link org.atmosphere.cache.UUIDBroadcasterCache} */ Class broadcasterCache() default UUIDBroadcasterCache.class; @@ -95,10 +95,10 @@ Class[] interceptors() default { String path() default "/"; /** - * Dispatch the managed {@link org.atmosphere.cpr.AtmosphereResource} to the mapped - * {@link org.atmosphere.cpr.AtmosphereHandler#onRequest(org.atmosphere.cpr.AtmosphereResource)}. If set to false, no - * HTTP GET operations will invoke the {@link org.atmosphere.handler.ReflectorServletProcessor#onRequest(org.atmosphere.cpr.AtmosphereResource)}. - * The HTTP method can be customized using {@link org.atmosphere.cpr.ApplicationConfig#ATMOSPHERERESOURCE_INTERCEPTOR_METHOD} value via + * Dispatch the managed {@link org.atmosphere.runtime.AtmosphereResource} to the mapped + * {@link org.atmosphere.runtime.AtmosphereHandler#onRequest(org.atmosphere.runtime.AtmosphereResource)}. If set to false, no + * HTTP GET operations will invoke the {@link org.atmosphere.handler.ReflectorServletProcessor#onRequest(org.atmosphere.runtime.AtmosphereResource)}. + * The HTTP method can be customized using {@link org.atmosphere.runtime.ApplicationConfig#ATMOSPHERERESOURCE_INTERCEPTOR_METHOD} value via * {@link #atmosphereConfig}. If the {@link #servlet()} is undefined changing this value has no effect. */ boolean dispatch() default true; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheInspectorService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheInspectorService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheInspectorService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheInspectorService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java index 18a92ccbfb0..27197674e93 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for installing {@link org.atmosphere.cpr.BroadcasterListener} + * An annotation for installing {@link org.atmosphere.runtime.BroadcasterListener} */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java index 449878a3412..1b7f7adb9f7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterCacheService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.BroadcasterCache} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.BroadcasterCache} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java index e1078c8ef22..f5fad921fa9 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFactoryService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.BroadcasterFactory} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.BroadcasterFactory} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java index 1b8fa68dd5d..926b70edfc1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterFilterService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere to add the {@link org.atmosphere.cpr.BroadcastFilter} to all created {@link org.atmosphere.cpr.Broadcaster} + * An annotation for telling Atmosphere to add the {@link org.atmosphere.runtime.BroadcastFilter} to all created {@link org.atmosphere.runtime.Broadcaster} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java index 71f1f278b07..b7d1fc96857 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterListenerService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for installing {@link org.atmosphere.cpr.BroadcasterListener} + * An annotation for installing {@link org.atmosphere.runtime.BroadcasterListener} */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterService.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterService.java index d29535bb566..8e08df9a4a7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/BroadcasterService.java @@ -22,7 +22,7 @@ import java.lang.annotation.Target; /** - * An annotation for telling Atmosphere which {@link org.atmosphere.cpr.Broadcaster} class to use by default. + * An annotation for telling Atmosphere which {@link org.atmosphere.runtime.Broadcaster} class to use by default. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Delete.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Delete.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Delete.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Delete.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/DeliverTo.java b/modules/runtime/src/main/java/org/atmosphere/config/service/DeliverTo.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/DeliverTo.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/DeliverTo.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Disconnect.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Disconnect.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Disconnect.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Disconnect.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/EndpointMapperService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/EndpointMapperService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/EndpointMapperService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/EndpointMapperService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Get.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Get.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Get.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Get.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Heartbeat.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Heartbeat.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Heartbeat.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Heartbeat.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/ManagedService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/ManagedService.java similarity index 77% rename from modules/cpr/src/main/java/org/atmosphere/config/service/ManagedService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/ManagedService.java index 2758cff6895..fad2461803f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/ManagedService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/ManagedService.java @@ -17,12 +17,12 @@ import org.atmosphere.cache.UUIDBroadcasterCache; import org.atmosphere.client.TrackMessageSizeInterceptor; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.DefaultBroadcaster; import org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor; import org.atmosphere.interceptor.HeartbeatInterceptor; import org.atmosphere.interceptor.SuspendTrackerInterceptor; @@ -41,7 +41,7 @@ *

  • The {@link org.atmosphere.client.TrackMessageSizeInterceptor} for making sure messages are delivered entirely
  • * * - * Annotating your {@link org.atmosphere.cpr.AtmosphereHandler} is the same as doing: + * Annotating your {@link org.atmosphere.runtime.AtmosphereHandler} is the same as doing: *
    @AtmosphereHandlerService( path = "/chat", @@ -73,36 +73,36 @@ public Class[] listeners() default {}; /** - * The {@link org.atmosphere.cpr.Broadcaster} class name + * The {@link org.atmosphere.runtime.Broadcaster} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcaster() default DefaultBroadcaster.class; /** - * A list of {@link org.atmosphere.cpr.AtmosphereInterceptor} to install. Defined interceptor will be appended to the default set: {@link AtmosphereResourceLifecycleInterceptor}, + * A list of {@link org.atmosphere.runtime.AtmosphereInterceptor} to install. Defined interceptor will be appended to the default set: {@link AtmosphereResourceLifecycleInterceptor}, * {@link org.atmosphere.config.managed.ManagedServiceInterceptor}, {@link TrackMessageSizeInterceptor}, * {@link HeartbeatInterceptor} and {@link SuspendTrackerInterceptor} */ Class[] interceptors() default {}; /** - * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Configuration + * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Configuration * name and value is delimited by "=", and different configuration lines are separated by comma. */ String[] atmosphereConfig() default {}; /** - * The {@link org.atmosphere.cpr.BroadcasterCache} class name + * The {@link org.atmosphere.runtime.BroadcasterCache} class name *

    * Default is {@link UUIDBroadcasterCache}. * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name. + * @return The {@link org.atmosphere.runtime.Broadcaster} class name. */ Class broadcasterCache() default UUIDBroadcasterCache.class; /** - * A list of {@link org.atmosphere.cpr.BroadcastFilter} + * A list of {@link org.atmosphere.runtime.BroadcastFilter} */ Class[] broadcastFilters() default {}; } diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Message.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Message.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Message.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Message.java index 7e68c4379cf..129c64726e4 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/Message.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/Message.java @@ -24,7 +24,7 @@ import java.lang.annotation.Target; /** - * Annotate a method that will get invoked when String messages are broadcasted using the {@link org.atmosphere.cpr.Broadcaster} + * Annotate a method that will get invoked when String messages are broadcasted using the {@link org.atmosphere.runtime.Broadcaster} * associated with the class where the annotation is associated. * * @author Jeanfrancois Arcand diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/MeteorService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/MeteorService.java similarity index 65% rename from modules/cpr/src/main/java/org/atmosphere/config/service/MeteorService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/MeteorService.java index d58d0c0945f..049db2ac9d0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/MeteorService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/MeteorService.java @@ -16,12 +16,12 @@ package org.atmosphere.config.service; import org.atmosphere.cache.DefaultBroadcasterCache; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.DefaultBroadcaster; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -30,7 +30,7 @@ import java.lang.annotation.Target; /** - * Annotate a {@link org.atmosphere.cpr.Meteor} implementation so Atmosphere can install it at runtime. + * Annotate a {@link org.atmosphere.runtime.Meteor} implementation so Atmosphere can install it at runtime. * * @author Jeanfrancois Arcand */ @@ -40,53 +40,53 @@ public @interface MeteorService { /** - * The url mapping for the associated {@link org.atmosphere.cpr.Meteor} + * The url mapping for the associated {@link org.atmosphere.runtime.Meteor} * - * @return url mapping for the associated {@link org.atmosphere.cpr.Meteor} + * @return url mapping for the associated {@link org.atmosphere.runtime.Meteor} */ String path() default "/"; /** - * A list of {@link org.atmosphere.cpr.BroadcastFilter} + * A list of {@link org.atmosphere.runtime.BroadcastFilter} */ Class[] broadcastFilters() default {}; /** - * The {@link org.atmosphere.cpr.Broadcaster} class name + * The {@link org.atmosphere.runtime.Broadcaster} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcaster() default DefaultBroadcaster.class; /** - * Set to true if this {@link org.atmosphere.cpr.AtmosphereHandler} supports sessions + * Set to true if this {@link org.atmosphere.runtime.AtmosphereHandler} supports sessions * * @return true if sessions are supported. */ boolean supportSession() default false; /** - * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Configuration + * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Configuration * name and value is delimited by "=", and different configuration lines are separated by comma. */ String[] atmosphereConfig() default {}; /** - * A list of {@link org.atmosphere.cpr.AtmosphereInterceptor} to install + * A list of {@link org.atmosphere.runtime.AtmosphereInterceptor} to install */ Class[] interceptors() default {}; /** - * The {@link org.atmosphere.cpr.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} + * The {@link org.atmosphere.runtime.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} * is installed. It is strongly recommended to install the {@link org.atmosphere.cache.UUIDBroadcasterCache} to prevent * messages being lost. * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcasterCache() default DefaultBroadcasterCache.class; /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} to track internal events. + * Add {@link org.atmosphere.runtime.AtmosphereResourceEventListener} to track internal events. */ public Class[] listeners() default {}; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/PathParam.java b/modules/runtime/src/main/java/org/atmosphere/config/service/PathParam.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/PathParam.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/PathParam.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Post.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Post.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Post.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Post.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Put.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Put.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Put.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Put.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Ready.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Ready.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Ready.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Ready.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Resume.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Resume.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Resume.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Resume.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/Singleton.java b/modules/runtime/src/main/java/org/atmosphere/config/service/Singleton.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/Singleton.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/Singleton.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/UUIDProviderService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/UUIDProviderService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/UUIDProviderService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/UUIDProviderService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketFactoryService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketFactoryService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketFactoryService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketFactoryService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java similarity index 72% rename from modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java index d732ddcda5b..b64243b17fb 100644 --- a/modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java +++ b/modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketHandlerService.java @@ -16,11 +16,11 @@ package org.atmosphere.config.service; import org.atmosphere.cache.DefaultBroadcasterCache; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.DefaultBroadcaster; import org.atmosphere.websocket.WebSocketEventListener; import java.lang.annotation.Documented; @@ -40,16 +40,16 @@ public @interface WebSocketHandlerService { /** - * A list of {@link org.atmosphere.cpr.BroadcastFilter} + * A list of {@link org.atmosphere.runtime.BroadcastFilter} */ Class[] broadcastFilters() default {}; /** - * The {@link org.atmosphere.cpr.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} + * The {@link org.atmosphere.runtime.BroadcasterCache} class name. By default, a no-ops {@link DefaultBroadcasterCache} * is installed. It is strongly recommended to install the {@link org.atmosphere.cache.UUIDBroadcasterCache} to prevent * messages being lost. * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcasterCache() default DefaultBroadcasterCache.class; @@ -61,25 +61,25 @@ String path() default "/"; /** - * The {@link org.atmosphere.cpr.Broadcaster} class name + * The {@link org.atmosphere.runtime.Broadcaster} class name * - * @return The {@link org.atmosphere.cpr.Broadcaster} class name + * @return The {@link org.atmosphere.runtime.Broadcaster} class name */ Class broadcaster() default DefaultBroadcaster.class; /** - * A list of {@link org.atmosphere.cpr.AtmosphereInterceptor} to install + * A list of {@link org.atmosphere.runtime.AtmosphereInterceptor} to install */ Class[] interceptors() default {}; /** - * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.cpr.AtmosphereHandler}. Configuration + * Atmosphere's configuration that will be passed to the associated {@link org.atmosphere.runtime.AtmosphereHandler}. Configuration * name and value is delimited by "=", and different configuration lines are separated by comma. */ String[] atmosphereConfig() default {}; /** - * Add {@link org.atmosphere.cpr.AtmosphereResourceEventListener} to track internal events. + * Add {@link org.atmosphere.runtime.AtmosphereResourceEventListener} to track internal events. */ public Class[] listeners() default {}; diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketProcessorService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketProcessorService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketProcessorService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketProcessorService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketProtocolService.java b/modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketProtocolService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/config/service/WebSocketProtocolService.java rename to modules/runtime/src/main/java/org/atmosphere/config/service/WebSocketProtocolService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java b/modules/runtime/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java similarity index 57% rename from modules/cpr/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java rename to modules/runtime/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java index 792436c3f65..adfe8205f70 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/BlockingIOCometSupport.java @@ -15,16 +15,16 @@ */ package org.atmosphere.container; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncSupport; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,17 +33,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnResume; -/** - * This class is used when the {@link org.atmosphere.cpr.AtmosphereFramework} fails to autodetect - * the Servlet Container we are running on. - *

    - * This {@link org.atmosphere.cpr.AsyncSupport} implementation uses a blocking approach, meaning - * the request thread will be blocked until another Thread invoke the {@link Broadcaster#broadcast}. - * - * @author Jeanfrancois Arcand - */ public class BlockingIOCometSupport extends AsynchronousProcessor { private static final Logger logger = LoggerFactory.getLogger(BlockingIOCometSupport.class); @@ -59,58 +49,22 @@ public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { Action action = null; - try { - action = suspended(req, res); - if (action.type() == Action.TYPE.SUSPEND) { - suspend(action, req, res); - } else if (action.type() == Action.TYPE.RESUME) { - CountDownLatch latch = (CountDownLatch) req.getAttribute(LATCH); - - if (latch == null || req.getAttribute(AtmosphereResourceImpl.PRE_SUSPEND) == null) { - logger.debug("response wasn't suspended: {}", res); - return action; - } - - latch.countDown(); + action = suspended(req, res); + if (action.type() == Action.TYPE.SUSPEND) { + suspend(action, req, res); + } else if (action.type() == Action.TYPE.RESUME) { + CountDownLatch latch = (CountDownLatch) req.getAttribute(LATCH); - Action nextAction = resumed(req, res); - if (nextAction.type() == Action.TYPE.SUSPEND) { - suspend(action, req, res); - } + if (latch == null || req.getAttribute(AtmosphereResourceImpl.PRE_SUSPEND) == null) { + logger.debug("response wasn't suspended: {}", res); + return action; } - } finally { - Object event = req.getAttribute(TomcatCometSupport.COMET_EVENT); - if (event != null) { - try { - Class.forName(org.apache.catalina.CometEvent.class.getName()); - - if (org.apache.catalina.CometEvent.class.isAssignableFrom(event.getClass())) { - org.apache.catalina.CometEvent.class.cast(event).close(); - } - } catch (Throwable e) { - logger.trace("", e); - } - - - try { - Class.forName(org.apache.catalina.comet.CometEvent.class.getName()); - if (org.apache.catalina.comet.CometEvent.class.isAssignableFrom(event.getClass())) { - org.apache.catalina.comet.CometEvent.class.cast(event).close(); - } - } catch (Throwable e) { - logger.trace("", e); - } - } + latch.countDown(); - try { - event = req.getAttribute(JBossWebCometSupport.HTTP_EVENT); - if (event != null) { - Class.forName(org.jboss.servlet.http.HttpEvent.class.getName()); - org.jboss.servlet.http.HttpEvent.class.cast(event).close(); - } - } catch (Throwable e) { - logger.trace("", e); + Action nextAction = resumed(req, res); + if (nextAction.type() == Action.TYPE.SUSPEND) { + suspend(action, req, res); } } return action; @@ -135,7 +89,7 @@ protected void suspend(Action action, AtmosphereRequest req, AtmosphereResponse AtmosphereResource resource = req.resource(); if (resource != null) { try { - resource.addEventListener(new OnResume() { + resource.addEventListener(new AtmosphereResourceEventListenerAdapter.OnResume() { @Override public void onResume(AtmosphereResourceEvent event) { latch.countDown(); @@ -198,4 +152,4 @@ public AsyncSupport complete(AtmosphereResourceImpl r) { } return this; } -} +} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java b/modules/runtime/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java rename to modules/runtime/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java index ee1dcd8875a..950fb784300 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/JSR356AsyncSupport.java @@ -15,10 +15,10 @@ */ package org.atmosphere.container; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.WebSocketProcessorFactory; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.WebSocketProcessorFactory; import org.atmosphere.util.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/container/JSR356Endpoint.java b/modules/runtime/src/main/java/org/atmosphere/container/JSR356Endpoint.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/container/JSR356Endpoint.java rename to modules/runtime/src/main/java/org/atmosphere/container/JSR356Endpoint.java index f398bb4001e..1133088cdf9 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/JSR356Endpoint.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/JSR356Endpoint.java @@ -16,11 +16,11 @@ package org.atmosphere.container; import org.atmosphere.container.version.JSR356WebSocket; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.atmosphere.util.CookieUtil; import org.atmosphere.util.IOUtils; import org.atmosphere.websocket.WebSocket; @@ -49,7 +49,7 @@ import java.util.Set; import java.util.concurrent.Callable; -import static org.atmosphere.cpr.ApplicationConfig.ALLOW_QUERYSTRING_AS_REQUEST; +import static org.atmosphere.runtime.ApplicationConfig.ALLOW_QUERYSTRING_AS_REQUEST; public class JSR356Endpoint extends Endpoint { diff --git a/modules/cpr/src/main/java/org/atmosphere/container/NettyCometSupport.java b/modules/runtime/src/main/java/org/atmosphere/container/NettyCometSupport.java similarity index 83% rename from modules/cpr/src/main/java/org/atmosphere/container/NettyCometSupport.java rename to modules/runtime/src/main/java/org/atmosphere/container/NettyCometSupport.java index 8eab45589ec..eaf4a9f55c0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/NettyCometSupport.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/NettyCometSupport.java @@ -15,15 +15,15 @@ */ package org.atmosphere.container; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AsyncSupport; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,7 +31,7 @@ import java.io.IOException; /** - * Netty's Framework {@link org.atmosphere.cpr.AsyncSupport} and framework running on top of it, like vert.x and Play! + * Netty's Framework {@link org.atmosphere.runtime.AsyncSupport} and framework running on top of it, like vert.x and Play! */ public class NettyCometSupport extends AsynchronousProcessor { diff --git a/modules/cpr/src/main/java/org/atmosphere/container/Servlet30CometSupport.java b/modules/runtime/src/main/java/org/atmosphere/container/Servlet30CometSupport.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/container/Servlet30CometSupport.java rename to modules/runtime/src/main/java/org/atmosphere/container/Servlet30CometSupport.java index 03e95a573d6..7ff7dfbb598 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/Servlet30CometSupport.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/Servlet30CometSupport.java @@ -15,16 +15,15 @@ */ package org.atmosphere.container; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncSupport; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,10 +34,10 @@ import javax.servlet.ServletException; import java.io.IOException; -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; +import static org.atmosphere.runtime.ApplicationConfig.MAX_INACTIVE; /** - * This class is used when the {@link org.atmosphere.cpr.AtmosphereFramework} detect the container + * This class is used when the {@link org.atmosphere.runtime.AtmosphereFramework} detect the container * detect Servlet 3.0 Asynch API. * * @author Jeanfrancois Arcand @@ -82,7 +81,7 @@ public Action service(AtmosphereRequest request, AtmosphereResponse response) /** * Suspend the connection by invoking {@link AtmosphereRequestImpl#startAsync()} * - * @param action The {@link org.atmosphere.cpr.Action} + * @param action The {@link org.atmosphere.runtime.Action} * @param req the {@link AtmosphereRequest} * @param res the {@link AtmosphereResponse} * @throws java.io.IOException diff --git a/modules/cpr/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java b/modules/runtime/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java rename to modules/runtime/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java index 7fda683ff42..5ffae81959d 100644 --- a/modules/cpr/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java +++ b/modules/runtime/src/main/java/org/atmosphere/container/version/JSR356WebSocket.java @@ -16,11 +16,11 @@ package org.atmosphere.container.version; import org.atmosphere.cache.BroadcastMessage; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.WebSocketProcessorFactory; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.WebSocketProcessorFactory; import org.atmosphere.websocket.WebSocket; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java b/modules/runtime/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java rename to modules/runtime/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java index 967b03734e0..e449b39368f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/handler/AbstractReflectorAtmosphereHandler.java @@ -17,17 +17,17 @@ package org.atmosphere.handler; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.AtmosphereServletProcessor; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.AtmosphereServletProcessor; +import org.atmosphere.runtime.Broadcaster; import org.atmosphere.util.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +39,7 @@ import java.util.Iterator; import java.util.List; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_USE_STREAM; /** * Simple {@link AtmosphereHandler} that reflect every call to @@ -58,7 +58,7 @@ public abstract class AbstractReflectorAtmosphereHandler implements AtmosphereSe /** * Write the {@link AtmosphereResourceEvent#getMessage()} back to the client using * the {@link AtmosphereResponseImpl#getOutputStream()} or {@link AtmosphereResponseImpl#getWriter()}. - * If a {@link org.atmosphere.cpr.Serializer} is defined, it will be invoked and the write operation + * If a {@link org.atmosphere.runtime.Serializer} is defined, it will be invoked and the write operation * will be delegated to it. *

    * By default, this method will try to use {@link AtmosphereResponseImpl#getWriter()}. @@ -232,8 +232,8 @@ public void init(AtmosphereConfig config) throws ServletException { /** *

    - * This default implementation does nothing when {@link #onRequest(org.atmosphere.cpr.AtmosphereResource)} is called. - * It could be used when all the installed {@link org.atmosphere.cpr.AtmosphereInterceptor interceptors} do the job + * This default implementation does nothing when {@link #onRequest(org.atmosphere.runtime.AtmosphereResource)} is called. + * It could be used when all the installed {@link org.atmosphere.runtime.AtmosphereInterceptor interceptors} do the job * and the framework requires us to install an handler. *

    * diff --git a/modules/cpr/src/main/java/org/atmosphere/handler/AnnotatedProxy.java b/modules/runtime/src/main/java/org/atmosphere/handler/AnnotatedProxy.java similarity index 80% rename from modules/cpr/src/main/java/org/atmosphere/handler/AnnotatedProxy.java rename to modules/runtime/src/main/java/org/atmosphere/handler/AnnotatedProxy.java index 709ff8db288..3ab7c8417c3 100644 --- a/modules/cpr/src/main/java/org/atmosphere/handler/AnnotatedProxy.java +++ b/modules/runtime/src/main/java/org/atmosphere/handler/AnnotatedProxy.java @@ -15,18 +15,18 @@ */ package org.atmosphere.handler; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereHandler; /** - * Marker class for an {@link org.atmosphere.cpr.AtmosphereHandler} proxy of a POJO object. + * Marker class for an {@link org.atmosphere.runtime.AtmosphereHandler} proxy of a POJO object. * * @author Jeanfrancois Arcand */ public interface AnnotatedProxy extends AtmosphereHandler { /** - * The Object the {@link org.atmosphere.cpr.AtmosphereHandler} is proxying. + * The Object the {@link org.atmosphere.runtime.AtmosphereHandler} is proxying. * * @return */ diff --git a/modules/cpr/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java index 7e047bbad70..06c035eb475 100644 --- a/modules/cpr/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/handler/AtmosphereHandlerAdapter.java @@ -15,9 +15,9 @@ */ package org.atmosphere.handler; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/handler/OnMessage.java b/modules/runtime/src/main/java/org/atmosphere/handler/OnMessage.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/handler/OnMessage.java rename to modules/runtime/src/main/java/org/atmosphere/handler/OnMessage.java index 7a55e0e3237..c58d7b100bd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/handler/OnMessage.java +++ b/modules/runtime/src/main/java/org/atmosphere/handler/OnMessage.java @@ -15,12 +15,11 @@ */ package org.atmosphere.handler; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +31,7 @@ * and {@link org.atmosphere.interceptor.BroadcastOnPostAtmosphereInterceptor} to reduce the handling of the suspend/resume/disconnect and * broadcast operation. *

    - * You can also safely used this class with {@link org.atmosphere.cpr.BroadcasterCache}. + * You can also safely used this class with {@link org.atmosphere.runtime.BroadcasterCache}. * method * * @author Jeanfrancois Arcand @@ -86,7 +85,7 @@ public void onOpen(AtmosphereResource resource) throws IOException { } /** - * Implement this method to get invoked every time a new {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} + * Implement this method to get invoked every time a new {@link org.atmosphere.runtime.Broadcaster#broadcast(Object)} * occurs. * * @param response an {@link AtmosphereResponse} diff --git a/modules/cpr/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java b/modules/runtime/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java index 9e26ff5bb05..cd38ecfb8a5 100644 --- a/modules/cpr/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/handler/ReflectorServletProcessor.java @@ -16,13 +16,13 @@ package org.atmosphere.handler; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereServletProcessor; -import org.atmosphere.cpr.CompletionAware; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereServletProcessor; +import org.atmosphere.runtime.CompletionAware; import org.atmosphere.util.AtmosphereFilterChain; import org.atmosphere.util.FilterConfigImpl; import org.atmosphere.util.IOUtils; @@ -51,7 +51,7 @@ * An implementation of {@link AtmosphereHandler} using the {@link AtmosphereServletProcessor} that delegate the {@link AtmosphereHandler#onRequest} * to a set of {@link FilterChain} and {@link Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)} * and store the {@link AtmosphereResource} as a {@link AtmosphereRequestImpl#getAttribute(String)} attribute named - * {@link org.atmosphere.cpr.FrameworkConfig#ATMOSPHERE_RESOURCE}. The {@link AtmosphereResource} can later be retrieved + * {@link org.atmosphere.runtime.FrameworkConfig#ATMOSPHERE_RESOURCE}. The {@link AtmosphereResource} can later be retrieved * and used to suspend/resume and broadcast. * * @author Jeanfrancois Arcand @@ -154,7 +154,7 @@ private void loadFilterInstances(ServletConfig sc) { /** * Delegate the request to the Servlet.service method, and add the {@link AtmosphereResource} * to the {@link HttpServletRequest#setAttribute(java.lang.String, java.lang.Object))}. - * The {@link AtmosphereResource} can ve retrieved using {@link org.atmosphere.cpr.FrameworkConfig#ATMOSPHERE_RESOURCE} + * The {@link AtmosphereResource} can ve retrieved using {@link org.atmosphere.runtime.FrameworkConfig#ATMOSPHERE_RESOURCE} * value. * * @param r The {@link AtmosphereResource} diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java index 2af1109304e..082f932dbe3 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigAware.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereConfig; /** * @author Jeanfrancois Arcand @@ -24,7 +24,7 @@ public interface AtmosphereConfigAware { /** * Configure an AtmosphereFramework object. * - * @param config {@link org.atmosphere.cpr.AtmosphereConfig} + * @param config {@link org.atmosphere.runtime.AtmosphereConfig} */ void configure(AtmosphereConfig config); } diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java index b06c2472449..823acd449bc 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereConfigInjectable.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereConfig; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java index 5f519b4e702..877fd266f64 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereFrameworkInjectable.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereProducers.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereProducers.java similarity index 85% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereProducers.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereProducers.java index 4cba5c8bc9d..96793cd07dd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereProducers.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereProducers.java @@ -15,12 +15,12 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResourceFactory; -import org.atmosphere.cpr.AtmosphereResourceSessionFactory; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.MetaBroadcaster; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereResourceFactory; +import org.atmosphere.runtime.AtmosphereResourceSessionFactory; +import org.atmosphere.runtime.BroadcasterFactory; +import org.atmosphere.runtime.MetaBroadcaster; import org.atmosphere.websocket.WebSocketFactory; import javax.enterprise.context.ApplicationScoped; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java index 66dd2fe42bb..6d512fc9881 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereRequestIntrospector.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.ThreadLocalInvoker; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java index 6d415b36bbb..d814fc6a93a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceEventIntrospector.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.ThreadLocalInvoker; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java index 5c5a2ccf89e..72be14e70ff 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceFactoryInjectable.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResourceFactory; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResourceFactory; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java index 78c72f70ccd..49f395bdf95 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceIntrospector.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.ThreadLocalInvoker; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java index eb5040c3df1..45d48268cc8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResourceSessionFactoryInjectable.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResourceSessionFactory; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResourceSessionFactory; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java index d2523d0ee66..1f814427b48 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/AtmosphereResponseIntrospector.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.ThreadLocalInvoker; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java index bfb69723cd1..8407bee0646 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterFactoryInjectable.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.BroadcasterFactory; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.BroadcasterFactory; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java index e80e35d987a..8dd035a8dd8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/BroadcasterIntrospector.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.ThreadLocalInvoker; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/CDIProducer.java b/modules/runtime/src/main/java/org/atmosphere/inject/CDIProducer.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/inject/CDIProducer.java rename to modules/runtime/src/main/java/org/atmosphere/inject/CDIProducer.java diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospector.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospector.java index eafdb229e4e..902e2fc21ff 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospector.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java b/modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java index 2c1e689624a..99741a50b09 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/InjectIntrospectorAdapter.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/Injectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/Injectable.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/inject/Injectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/Injectable.java index bf242fdd436..e493f8b62d6 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/Injectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/Injectable.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereConfig; import javax.inject.Inject; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java b/modules/runtime/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java rename to modules/runtime/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java index fef4d60d885..3d21c3db2e8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/InjectableObjectFactory.java @@ -15,12 +15,12 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereObjectFactory; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereObjectFactory; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.inject.annotation.ApplicationScoped; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.IOUtils; @@ -43,9 +43,9 @@ /** * Support injection of Atmosphere's Internal object using - * {@link org.atmosphere.cpr.AtmosphereConfig},{@link AtmosphereFramework},{@link org.atmosphere.cpr.BroadcasterFactory, - * {@link org.atmosphere.cpr.AtmosphereResourceFactory } ,{@link org.atmosphere.cpr.DefaultMetaBroadcaster } and - * {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory } and classes implementing the {@link Injectable} defined inside + * {@link org.atmosphere.runtime.AtmosphereConfig},{@link AtmosphereFramework},{@link org.atmosphere.runtime.BroadcasterFactory, + * {@link org.atmosphere.runtime.AtmosphereResourceFactory } ,{@link org.atmosphere.runtime.DefaultMetaBroadcaster } and + * {@link org.atmosphere.runtime.AtmosphereResourceSessionFactory } and classes implementing the {@link Injectable} defined inside * META_INF/services/org.atmosphere.inject.Inject * * @author Jeanfrancois Arcand @@ -233,7 +233,7 @@ private void injectMethods(Set methods, U instance) throws IllegalAc /** * @param instance the requested object. * @param defaultType the type of the requested object - * @param framework the {@link org.atmosphere.cpr.AtmosphereFramework} + * @param framework the {@link org.atmosphere.runtime.AtmosphereFramework} * @param * @throws IllegalAccessException */ diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/InjectionListener.java b/modules/runtime/src/main/java/org/atmosphere/inject/InjectionListener.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/inject/InjectionListener.java rename to modules/runtime/src/main/java/org/atmosphere/inject/InjectionListener.java diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java index 88b0b86d99f..9fa715c4e72 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/MetaBroadcasterInjectable.java @@ -15,8 +15,8 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.MetaBroadcaster; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.MetaBroadcaster; import org.atmosphere.inject.annotation.ApplicationScoped; import java.lang.reflect.Type; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/PathParamIntrospector.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/PathParamIntrospector.java index eb42823f347..6682ebc7134 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/PathParamIntrospector.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/PathParamIntrospector.java @@ -17,9 +17,9 @@ import org.atmosphere.config.service.ManagedService; import org.atmosphere.config.service.PathParam; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.handler.AnnotatedProxy; import org.atmosphere.inject.annotation.RequestScoped; import org.atmosphere.util.Utils; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/PostConstructIntrospector.java b/modules/runtime/src/main/java/org/atmosphere/inject/PostConstructIntrospector.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/inject/PostConstructIntrospector.java rename to modules/runtime/src/main/java/org/atmosphere/inject/PostConstructIntrospector.java diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java b/modules/runtime/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java rename to modules/runtime/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java index 17ade097f38..732591d1a09 100644 --- a/modules/cpr/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java +++ b/modules/runtime/src/main/java/org/atmosphere/inject/WebSocketFactoryInjectable.java @@ -15,7 +15,7 @@ */ package org.atmosphere.inject; -import org.atmosphere.cpr.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereConfig; import org.atmosphere.inject.annotation.ApplicationScoped; import org.atmosphere.websocket.WebSocketFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/annotation/ApplicationScoped.java b/modules/runtime/src/main/java/org/atmosphere/inject/annotation/ApplicationScoped.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/inject/annotation/ApplicationScoped.java rename to modules/runtime/src/main/java/org/atmosphere/inject/annotation/ApplicationScoped.java diff --git a/modules/cpr/src/main/java/org/atmosphere/inject/annotation/RequestScoped.java b/modules/runtime/src/main/java/org/atmosphere/inject/annotation/RequestScoped.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/inject/annotation/RequestScoped.java rename to modules/runtime/src/main/java/org/atmosphere/inject/annotation/RequestScoped.java diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java index c33f3a564f5..53815ba4ab2 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/AllowInterceptor.java @@ -16,7 +16,7 @@ package org.atmosphere.interceptor; /** - * A marker interface that does nothing except used by {@link org.atmosphere.cpr.AtmosphereInterceptor} to modify the default + * A marker interface that does nothing except used by {@link org.atmosphere.runtime.AtmosphereInterceptor} to modify the default * behavior of any functionality. * * @author Jeanfrancois Arcand diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java index e37cb6e9dfd..2dc67da5a5c 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/AndroidAtmosphereInterceptor.java @@ -15,15 +15,15 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResource.TRANSPORT; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource.TRANSPORT; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java similarity index 77% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java index e02f62645dd..01861d8fe2c 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceLifecycleInterceptor.java @@ -15,12 +15,12 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,35 +28,35 @@ import java.io.IOException; import java.util.concurrent.TimeUnit; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHOD; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_TIMEOUT; -import static org.atmosphere.cpr.AtmosphereResource.TRANSPORT.POLLING; -import static org.atmosphere.cpr.AtmosphereResource.TRANSPORT.UNDEFINED; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnBroadcast; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_METHOD; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERERESOURCE_INTERCEPTOR_TIMEOUT; +import static org.atmosphere.runtime.AtmosphereResource.TRANSPORT.POLLING; +import static org.atmosphere.runtime.AtmosphereResource.TRANSPORT.UNDEFINED; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnBroadcast; /** *

    This {@link AtmosphereInterceptor} implementation automatically suspends the intercepted * {@link AtmosphereResource} and takes care of managing the response's state (flushing, resuming, - * etc.) when a {@link org.atmosphere.cpr.Broadcaster#broadcast} is invoked. When used, {@link org.atmosphere.cpr.AtmosphereHandler} implementations no longer need to make calls to + * etc.) when a {@link org.atmosphere.runtime.Broadcaster#broadcast} is invoked. When used, {@link org.atmosphere.runtime.AtmosphereHandler} implementations no longer need to make calls to * {@link AtmosphereResource#suspend}. *

    - * If your application doesn't use {@link org.atmosphere.cpr.Broadcaster}, this interceptor will not work and you need to programmatically + * If your application doesn't use {@link org.atmosphere.runtime.Broadcaster}, this interceptor will not work and you need to programmatically * resume, flush, etc. *

    *

    By default, intercepted {@link AtmosphereResource} instances are suspended when a GET * request is received. You can change the triggering http method by configuring - * {@link org.atmosphere.cpr.ApplicationConfig#ATMOSPHERERESOURCE_INTERCEPTOR_METHOD} + * {@link org.atmosphere.runtime.ApplicationConfig#ATMOSPHERERESOURCE_INTERCEPTOR_METHOD} *

    *

    *

    Use this class when you don't want to manage the suspend/resume operation from your - * particular Atmosphere framework implementation classes ({@link org.atmosphere.cpr.AtmosphereHandler}, + * particular Atmosphere framework implementation classes ({@link org.atmosphere.runtime.AtmosphereHandler}, * {@link org.atmosphere.websocket.WebSocketHandler}, or - * {@link org.atmosphere.cpr.Meteor} instances) or extensions (GWT, Jersey, Wicket, etc...) + * {@link org.atmosphere.runtime.Meteor} instances) or extensions (GWT, Jersey, Wicket, etc...) *

    * For this mechanism to work properly, each client must set the - * {@link org.atmosphere.cpr.HeaderConfig#X_ATMOSPHERE_TRANSPORT} header. Your AtmosphereHandler must also extends the + * {@link org.atmosphere.runtime.HeaderConfig#X_ATMOSPHERE_TRANSPORT} header. Your AtmosphereHandler must also extends the * {@link org.atmosphere.handler.AbstractReflectorAtmosphereHandler} or implements the logic defined inside - * {@link org.atmosphere.handler.AbstractReflectorAtmosphereHandler#postStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)} + * {@link org.atmosphere.handler.AbstractReflectorAtmosphereHandler#postStateChange(org.atmosphere.runtime.AtmosphereResourceEvent)} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java index e1f2ef44433..f32238c5f2f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/AtmosphereResourceStateRecovery.java @@ -15,17 +15,17 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterCache; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.BroadcasterListenerAdapter; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventImpl; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterCache; +import org.atmosphere.runtime.BroadcasterFactory; +import org.atmosphere.runtime.BroadcasterListenerAdapter; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.Utils; import org.slf4j.Logger; @@ -42,8 +42,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.ApplicationConfig.STATE_RECOVERY_TIMEOUT; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnSuspend; +import static org.atmosphere.runtime.ApplicationConfig.STATE_RECOVERY_TIMEOUT; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnSuspend; /** * This interceptor associates a {@link AtmosphereResource} to all {@link Broadcaster} the resource was added before @@ -151,8 +151,8 @@ public void onBroadcast(AtmosphereResourceEvent event) { /** * Check the cache to see if messages has been added directly by using - * {@link BroadcasterCache#addToCache(String, org.atmosphere.cpr.AtmosphereResource, org.atmosphere.cache.BroadcastMessage)} - * after {@link Broadcaster#addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource)} has been + * {@link BroadcasterCache#addToCache(String, org.atmosphere.runtime.AtmosphereResource, org.atmosphere.cache.BroadcastMessage)} + * after {@link Broadcaster#addAtmosphereResource(org.atmosphere.runtime.AtmosphereResource)} has been * invoked. */ final List cachedMessages = retrieveCache(r, tracker, true); diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java similarity index 85% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java index d610391fbe4..2075a3c56de 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/BroadcastOnPostAtmosphereInterceptor.java @@ -15,10 +15,10 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,8 +28,8 @@ import static org.atmosphere.util.IOUtils.readEntirely; /** - * This read the request's body and invoke the associated {@link org.atmosphere.cpr.Broadcaster} of an {@link AtmosphereResource}. - * The broadcast always happens AFTER the request has been delivered to an {@link org.atmosphere.cpr.AtmosphereHandler}. + * This read the request's body and invoke the associated {@link org.atmosphere.runtime.Broadcaster} of an {@link AtmosphereResource}. + * The broadcast always happens AFTER the request has been delivered to an {@link org.atmosphere.runtime.AtmosphereHandler}. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java similarity index 83% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java index 535602036e1..a81dbaf6fde 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/CacheHeadersInterceptor.java @@ -15,19 +15,19 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.util.Utils; -import static org.atmosphere.cpr.HeaderConfig.CACHE_CONTROL; -import static org.atmosphere.cpr.HeaderConfig.EXPIRES; -import static org.atmosphere.cpr.HeaderConfig.PRAGMA; +import static org.atmosphere.runtime.HeaderConfig.CACHE_CONTROL; +import static org.atmosphere.runtime.HeaderConfig.EXPIRES; +import static org.atmosphere.runtime.HeaderConfig.PRAGMA; /** * At interceptor for customizing the following headers: Expire, Cache-Control, Pragma, diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java similarity index 88% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java index 1683ddd41f9..d435b33e753 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/CorsInterceptor.java @@ -15,14 +15,14 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.Utils; /** diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java index 58065bbd1ff..79b5c5efe01 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/HeartbeatInterceptor.java @@ -15,21 +15,21 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.AtmosphereResourceHeartbeatEventListener; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.HeaderConfig; -import org.atmosphere.cpr.HeartbeatAtmosphereResourceEvent; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter; +import org.atmosphere.runtime.AtmosphereResourceHeartbeatEventListener; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.HeaderConfig; +import org.atmosphere.runtime.HeartbeatAtmosphereResourceEvent; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.IOUtils; import org.atmosphere.util.Utils; @@ -45,15 +45,15 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.ApplicationConfig.CLIENT_HEARTBEAT_INTERVAL_IN_SECONDS; -import static org.atmosphere.cpr.ApplicationConfig.HEARTBEAT_INTERVAL_IN_SECONDS; -import static org.atmosphere.cpr.ApplicationConfig.HEARTBEAT_PADDING_CHAR; -import static org.atmosphere.cpr.ApplicationConfig.RESUME_ON_HEARTBEAT; +import static org.atmosphere.runtime.ApplicationConfig.CLIENT_HEARTBEAT_INTERVAL_IN_SECONDS; +import static org.atmosphere.runtime.ApplicationConfig.HEARTBEAT_INTERVAL_IN_SECONDS; +import static org.atmosphere.runtime.ApplicationConfig.HEARTBEAT_PADDING_CHAR; +import static org.atmosphere.runtime.ApplicationConfig.RESUME_ON_HEARTBEAT; /** *

    * An interceptor that send whitespace every in 60 seconds by default. Another value could be specified with the - * {@link org.atmosphere.cpr.ApplicationConfig#HEARTBEAT_INTERVAL_IN_SECONDS} in the atmosphere config. The heartbeat will be scheduled as soon as the + * {@link org.atmosphere.runtime.ApplicationConfig#HEARTBEAT_INTERVAL_IN_SECONDS} in the atmosphere config. The heartbeat will be scheduled as soon as the * request is suspended. *

    *

    diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java index 894b5796741..4d3313d4da5 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/IdleResourceInterceptor.java @@ -15,13 +15,13 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.Utils; import org.atmosphere.websocket.WebSocket; @@ -31,7 +31,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; +import static org.atmosphere.runtime.ApplicationConfig.MAX_INACTIVE; /** * An Interceptor that track idle {@link AtmosphereResource} and close it. This interceptor is useful for diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/InvokationOrder.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/InvokationOrder.java similarity index 82% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/InvokationOrder.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/InvokationOrder.java index aa6fab0ecbe..ec7f5f42d4b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/InvokationOrder.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/InvokationOrder.java @@ -16,10 +16,10 @@ package org.atmosphere.interceptor; /** - * A simple marker class to use with {@link org.atmosphere.cpr.AtmosphereInterceptor} in order to determine in which + * A simple marker class to use with {@link org.atmosphere.runtime.AtmosphereInterceptor} in order to determine in which * position in the interceptor's chain the AtmosphereInterceptor must be installed. *

    - * Normally all {@link org.atmosphere.cpr.AtmosphereInterceptor} are installed using the {@link InvokationOrder.PRIORITY#AFTER_DEFAULT} + * Normally all {@link org.atmosphere.runtime.AtmosphereInterceptor} are installed using the {@link InvokationOrder.PRIORITY#AFTER_DEFAULT} * * @author Jeanfrancois Arcand */ @@ -32,7 +32,7 @@ enum PRIORITY { AFTER_DEFAULT, /** * The AtmosphereInterceptor must be executed before the default set of AtmosphereInterceptor. You can only - * add one instance per {@link org.atmosphere.cpr.AtmosphereInterceptor} + * add one instance per {@link org.atmosphere.runtime.AtmosphereInterceptor} */ BEFORE_DEFAULT, /** diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java index b827c20be09..011ad8d7c13 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/JSONPAtmosphereInterceptor.java @@ -15,16 +15,16 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.StringEscapeUtils; import org.atmosphere.util.Utils; import org.slf4j.Logger; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java index a40065c3738..114adbd27e7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/JavaScriptProtocol.java @@ -16,19 +16,19 @@ package org.atmosphere.interceptor; import org.atmosphere.client.TrackMessageSizeFilter; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,9 +36,9 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnSuspend; -import static org.atmosphere.cpr.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnSuspend; +import static org.atmosphere.runtime.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_ERROR; /** *

    diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java similarity index 88% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java index 0513a27946b..2510589f4c2 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/NginxInterceptor.java @@ -15,10 +15,9 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereResource; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/OldBrowserPaddingInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/OldBrowserPaddingInterceptor.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/OldBrowserPaddingInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/OldBrowserPaddingInterceptor.java diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java index 0e8a7835c18..0497324de04 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/OnDisconnectInterceptor.java @@ -15,14 +15,14 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEventImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEventImpl; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java index 5ff630d641e..2417075efce 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/PaddingAtmosphereInterceptor.java @@ -15,26 +15,26 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResource.TRANSPORT; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource.TRANSPORT; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.FrameworkConfig; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import static org.atmosphere.cpr.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; +import static org.atmosphere.runtime.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; /** * Padding interceptor for Browser that needs whitespace when streaming is used. diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java index 4488b2515b1..903ab294db4 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/SSEAtmosphereInterceptor.java @@ -15,17 +15,17 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResponse; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,10 +35,10 @@ import java.io.OutputStream; import java.io.PrintWriter; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnPreSuspend; -import static org.atmosphere.cpr.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL; -import static org.atmosphere.cpr.FrameworkConfig.CONTAINER_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_USE_STREAM; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnPreSuspend; +import static org.atmosphere.runtime.FrameworkConfig.CALLBACK_JAVASCRIPT_PROTOCOL; +import static org.atmosphere.runtime.FrameworkConfig.CONTAINER_RESPONSE; /** * HTML 5 Server-Sent Events implementation. diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java index 543b4cb896c..f369587a20b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/SessionCreationInterceptor.java @@ -15,9 +15,9 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereResource; import org.atmosphere.util.Utils; import java.util.concurrent.ConcurrentLinkedQueue; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java index b206fd7ccf2..9d71591aa22 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/ShiroInterceptor.java @@ -21,11 +21,11 @@ import org.apache.shiro.web.env.WebEnvironment; import org.apache.shiro.web.subject.WebSubject; import org.apache.shiro.web.util.WebUtils; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResource.TRANSPORT; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource.TRANSPORT; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java index 856e6c72497..c0256384442 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/SimpleRestInterceptor.java @@ -27,24 +27,24 @@ import javax.servlet.ServletException; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOInterceptor; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.CompletionAware; -import org.atmosphere.cpr.DefaultBroadcaster; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOInterceptor; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.CompletionAware; +import org.atmosphere.runtime.DefaultBroadcaster; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.util.ChunkConcatReaderPool; import org.atmosphere.util.IOUtils; import org.slf4j.Logger; diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java similarity index 79% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java index 0c5a981b467..a29a6849700 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/SuspendTrackerInterceptor.java @@ -15,14 +15,14 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,8 +32,8 @@ import java.util.Set; /** - * An interceptor that keep track of {@link AtmosphereResource#uuid()} and disable invocation of {@link org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter#onSuspend(org.atmosphere.cpr.AtmosphereResourceEvent)} - * and {@link org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter#onPreSuspend(org.atmosphere.cpr.AtmosphereResourceEvent)} + * An interceptor that keep track of {@link AtmosphereResource#uuid()} and disable invocation of {@link org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter#onSuspend(org.atmosphere.runtime.AtmosphereResourceEvent)} + * and {@link org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter#onPreSuspend(org.atmosphere.runtime.AtmosphereResourceEvent)} *

    * When used, the onSuspend will be only called ONCE for every transport, when the first request is made. * diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java similarity index 82% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java index 7c78f9e7e5c..b93d3071c90 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/TrackMessageSizeB64Interceptor.java @@ -15,17 +15,17 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOInterceptorAdapter; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOInterceptorAdapter; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,10 +36,10 @@ import java.util.Arrays; import java.util.HashSet; -import static org.atmosphere.cpr.ApplicationConfig.EXCLUDED_CONTENT_TYPES; +import static org.atmosphere.runtime.ApplicationConfig.EXCLUDED_CONTENT_TYPES; /** - * An {@link org.atmosphere.cpr.AtmosphereInterceptor} that adds message size and delimiter, and encodes the message in Base64. + * An {@link org.atmosphere.runtime.AtmosphereInterceptor} that adds message size and delimiter, and encodes the message in Base64. * This allows for broadcasting of messages containing the delimiter character. *

    * You can configure this class to exclude some response's content-type by using the {@link ApplicationConfig#EXCLUDED_CONTENT_TYPES} diff --git a/modules/cpr/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java similarity index 82% rename from modules/cpr/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java index 3d6bfbe8607..b503c06d6df 100644 --- a/modules/cpr/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/interceptor/WebSocketMessageSuspendInterceptor.java @@ -15,11 +15,10 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.util.Utils; /** diff --git a/modules/cpr/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java b/modules/runtime/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java rename to modules/runtime/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java index d87ab28b557..d54d31d4362 100644 --- a/modules/cpr/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/lifecycle/BroadcasterLifecyclePolicyHandler.java @@ -15,10 +15,10 @@ */ package org.atmosphere.lifecycle; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterListenerAdapter; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterListenerAdapter; +import org.atmosphere.runtime.DefaultBroadcaster; public class BroadcasterLifecyclePolicyHandler extends BroadcasterListenerAdapter { diff --git a/modules/cpr/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java b/modules/runtime/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java rename to modules/runtime/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java index fd17b51cb4f..5193e007f0b 100644 --- a/modules/cpr/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/lifecycle/LifecycleHandler.java @@ -15,12 +15,12 @@ */ package org.atmosphere.lifecycle; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterConfig; -import org.atmosphere.cpr.BroadcasterLifeCyclePolicy; -import org.atmosphere.cpr.BroadcasterLifeCyclePolicyListener; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterConfig; +import org.atmosphere.runtime.BroadcasterLifeCyclePolicy; +import org.atmosphere.runtime.BroadcasterLifeCyclePolicyListener; +import org.atmosphere.runtime.DefaultBroadcaster; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,11 +28,11 @@ import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY_DESTROY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_RESUME; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY_DESTROY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_RESUME; public class LifecycleHandler { private static final Logger logger = LoggerFactory.getLogger(LifecycleHandler.class); diff --git a/modules/cpr/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java b/modules/runtime/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java similarity index 85% rename from modules/cpr/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java rename to modules/runtime/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java index d40e46eb1d9..722a0a0dd14 100644 --- a/modules/cpr/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java +++ b/modules/runtime/src/main/java/org/atmosphere/pool/BoundedApachePoolableProvider.java @@ -15,18 +15,18 @@ */ package org.atmosphere.pool; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.DefaultBroadcaster; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_FACTORY_POOL_SIZE; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_FACTORY_POOL_SIZE; /** - * An Bounder Broadcaster Pool Provider of {@link org.atmosphere.cpr.Broadcaster}. The default size is 200. + * An Bounder Broadcaster Pool Provider of {@link org.atmosphere.runtime.Broadcaster}. The default size is 200. * * @author Jean-Francois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java b/modules/runtime/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java rename to modules/runtime/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java index 093dd18835d..ba6f6bcf52b 100755 --- a/modules/cpr/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/pool/PoolableBroadcasterFactory.java @@ -16,10 +16,10 @@ package org.atmosphere.pool; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcasterFactory; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.DefaultBroadcasterFactory; import org.atmosphere.util.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,18 +27,18 @@ import java.util.Collection; import java.util.Collections; -import static org.atmosphere.cpr.ApplicationConfig.POOLEABLE_PROVIDER; -import static org.atmosphere.cpr.ApplicationConfig.SUPPORT_TRACKED_BROADCASTER; +import static org.atmosphere.runtime.ApplicationConfig.POOLEABLE_PROVIDER; +import static org.atmosphere.runtime.ApplicationConfig.SUPPORT_TRACKED_BROADCASTER; /** * This class uses a {@link org.atmosphere.pool.PoolableProvider} to retrieve instance of {@link Broadcaster}. This class * doesn't validate the id of the Broadcaster [{@link Broadcaster#setID(String)}] and can return a Broadcaster - * with was already created under that name. Set {@link #trackPooledBroadcaster(boolean)} or {@link org.atmosphere.cpr.ApplicationConfig#SUPPORT_TRACKED_BROADCASTER} to true to track duplication but - * be aware it can significantly reduce performance. Use the {@link org.atmosphere.cpr.DefaultBroadcasterFactory} is recommended + * with was already created under that name. Set {@link #trackPooledBroadcaster(boolean)} or {@link org.atmosphere.runtime.ApplicationConfig#SUPPORT_TRACKED_BROADCASTER} to true to track duplication but + * be aware it can significantly reduce performance. Use the {@link org.atmosphere.runtime.DefaultBroadcasterFactory} is recommended * under that scenario. *

    * By default, this factory doesn't keep trace of created Broadcasters hence a new pooled Broadcaster will always - * be returned unless {@link #trackPooledBroadcaster(boolean)} or {@link org.atmosphere.cpr.ApplicationConfig#SUPPORT_TRACKED_BROADCASTER} + * be returned unless {@link #trackPooledBroadcaster(boolean)} or {@link org.atmosphere.runtime.ApplicationConfig#SUPPORT_TRACKED_BROADCASTER} * is set to true. *

    * This Factory has been designed for application. @@ -147,9 +147,9 @@ public Broadcaster createBroadcaster() { } /** - * Set to true to enable tracking of {@link org.atmosphere.cpr.Broadcaster#getID()} duplication. Enabling this + * Set to true to enable tracking of {@link org.atmosphere.runtime.Broadcaster#getID()} duplication. Enabling this * feature will significantly reduce the performance of the {@link org.atmosphere.pool.PoolableProvider}. Use the - * {@link org.atmosphere.cpr.DefaultBroadcasterFactory} if you need to track's duplication. + * {@link org.atmosphere.runtime.DefaultBroadcasterFactory} if you need to track's duplication. * * @param trackPooledBroadcaster * @return diff --git a/modules/cpr/src/main/java/org/atmosphere/pool/PoolableProvider.java b/modules/runtime/src/main/java/org/atmosphere/pool/PoolableProvider.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/pool/PoolableProvider.java rename to modules/runtime/src/main/java/org/atmosphere/pool/PoolableProvider.java index 075383a72e0..bac53fc2c40 100644 --- a/modules/cpr/src/main/java/org/atmosphere/pool/PoolableProvider.java +++ b/modules/runtime/src/main/java/org/atmosphere/pool/PoolableProvider.java @@ -15,27 +15,27 @@ */ package org.atmosphere.pool; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.Broadcaster; import org.atmosphere.inject.AtmosphereConfigAware; /** * Implements this interface for provisioning the {@link org.atmosphere.pool.PoolableBroadcasterFactory} - * with {@link org.atmosphere.cpr.Broadcaster} + * with {@link org.atmosphere.runtime.Broadcaster} * * @author Jeanfrancois Arcand */ public interface PoolableProvider extends AtmosphereConfigAware { /** - * Return a {@link org.atmosphere.cpr.Broadcaster} + * Return a {@link org.atmosphere.runtime.Broadcaster} * @param id the name of the Broadcaster - * @return {@link org.atmosphere.cpr.Broadcaster} + * @return {@link org.atmosphere.runtime.Broadcaster} */ T borrowBroadcaster(Object id); /** * Return a destroyed {@link Broadcaster} instance. - * @param b {@link org.atmosphere.cpr.Broadcaster} + * @param b {@link org.atmosphere.runtime.Broadcaster} * @return this */ PoolableProvider returnBroadcaster(T b); diff --git a/modules/cpr/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java b/modules/runtime/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java rename to modules/runtime/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java index 17c366f8cc8..14174ce23f7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java +++ b/modules/runtime/src/main/java/org/atmosphere/pool/UnboundedApachePoolableProvider.java @@ -21,9 +21,9 @@ import org.apache.commons.pool2.impl.DefaultPooledObject; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.DefaultBroadcaster; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.DefaultBroadcaster; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Action.java b/modules/runtime/src/main/java/org/atmosphere/runtime/Action.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/Action.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/Action.java index 666fef11fb7..5035d7173e8 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Action.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/Action.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * An Action is used by {@link AtmosphereInterceptor}, {@link AsyncSupport} and {@link AtmosphereFramework} to determine @@ -37,7 +37,7 @@ public enum TYPE { */ RESUME, /** - * Timeout the underlying connection/response and invoke the {@link org.atmosphere.cpr.AtmosphereResource#resume()}. + * Timeout the underlying connection/response and invoke the {@link org.atmosphere.runtime.AtmosphereResource#resume()}. * The request will be dispatched to framework/container via {@link AtmosphereHandler#onStateChange(AtmosphereResourceEvent)} */ TIMEOUT, diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationHandler.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationHandler.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationHandler.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationHandler.java index 948bb59fe89..36738342bdd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationHandler.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.annotation.Processor; import org.atmosphere.config.AtmosphereAnnotation; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationProcessor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationProcessor.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationProcessor.java index 999bb15776f..9e855355700 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationProcessor.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.inject.AtmosphereConfigAware; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationScanningServletContainerInitializer.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationScanningServletContainerInitializer.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationScanningServletContainerInitializer.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationScanningServletContainerInitializer.java index 557c2afdc34..268cf10945d 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AnnotationScanningServletContainerInitializer.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AnnotationScanningServletContainerInitializer.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AsyncSupportListenerService; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/ApplicationConfig.java b/modules/runtime/src/main/java/org/atmosphere/runtime/ApplicationConfig.java similarity index 70% rename from modules/cpr/src/main/java/org/atmosphere/cpr/ApplicationConfig.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/ApplicationConfig.java index 796c7aaea63..7895f710986 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/ApplicationConfig.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/ApplicationConfig.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Web.xml init-param configuration supported by Atmosphere. @@ -28,20 +28,6 @@ public interface ApplicationConfig { * Value: org.atmosphere.atmosphereDotXml */ String PROPERTY_ATMOSPHERE_XML = "org.atmosphere.atmosphereDotXml"; - /** - * The path that will be used to map request to Jersey. - *

    - * Default: ""
    - * Value: org.atmosphere.jersey.servlet-mapping - */ - String PROPERTY_SERVLET_MAPPING = "org.atmosphere.jersey.servlet-mapping"; - /** - * Set Atmosphere to use the {@link org.atmosphere.container.BlockingIOCometSupport}, e.g blocking I/O. - *

    - * Default: false
    - *

    Value: org.atmosphere.useBlocking - */ - String PROPERTY_BLOCKING_COMETSUPPORT = "org.atmosphere.useBlocking"; /** * Set Atmosphere to throw exception on cloned request *

    @@ -78,56 +64,56 @@ public interface ApplicationConfig { */ String PROPERTY_USE_STREAM = "org.atmosphere.useStream"; /** - * The default {@link org.atmosphere.cpr.BroadcasterFactory} class. + * The default {@link org.atmosphere.runtime.BroadcasterFactory} class. *

    - * Default: org.atmosphere.cpr.DefaultBroadcasterFactory
    - * Value: org.atmosphere.cpr.broadcasterFactory + * Default: org.atmosphere.runtime.DefaultBroadcasterFactory
    + * Value: org.atmosphere.runtime.broadcasterFactory */ - String BROADCASTER_FACTORY = "org.atmosphere.cpr.broadcasterFactory"; + String BROADCASTER_FACTORY = "org.atmosphere.runtime.broadcasterFactory"; /** - * The default {@link org.atmosphere.cpr.Broadcaster} class. + * The default {@link org.atmosphere.runtime.Broadcaster} class. *

    - * Default: org.atmosphere.cpr.DefaultBroadcaster
    - * Value: org.atmosphere.cpr.broadcasterClass + * Default: org.atmosphere.runtime.DefaultBroadcaster
    + * Value: org.atmosphere.runtime.broadcasterClass */ - String BROADCASTER_CLASS = "org.atmosphere.cpr.broadcasterClass"; + String BROADCASTER_CLASS = "org.atmosphere.runtime.broadcasterClass"; /** - * The default {@link org.atmosphere.cpr.BroadcasterCache} class. + * The default {@link org.atmosphere.runtime.BroadcasterCache} class. *

    * Default: org.atmosphere.cache.DefaultBroadcasterCache (Doing nothing, not caching anything)
    - * Value: org.atmosphere.cpr.broadcasterCacheClass + * Value: org.atmosphere.runtime.broadcasterCacheClass */ - String BROADCASTER_CACHE = "org.atmosphere.cpr.broadcasterCacheClass"; + String BROADCASTER_CACHE = "org.atmosphere.runtime.broadcasterCacheClass"; /** * Tell Atmosphere which {@link AsyncSupport} implementation to use. *

    * Default: "" (Auto detected by Atmosphere)
    - * Value: org.atmosphere.cpr.asyncSupport + * Value: org.atmosphere.runtime.asyncSupport */ - String PROPERTY_COMET_SUPPORT = "org.atmosphere.cpr.asyncSupport"; + String PROPERTY_COMET_SUPPORT = "org.atmosphere.runtime.asyncSupport"; /** * Tell Atmosphere to use {@link javax.servlet.http.HttpSession}. *

    * Default: false
    - * Value: org.atmosphere.cpr.sessionSupport + * Value: org.atmosphere.runtime.sessionSupport */ - String PROPERTY_SESSION_SUPPORT = "org.atmosphere.cpr.sessionSupport"; + String PROPERTY_SESSION_SUPPORT = "org.atmosphere.runtime.sessionSupport"; /** * Tell Atmosphere to create a new {@link javax.servlet.http.HttpSession} when starting and when {@link #PROPERTY_SESSION_SUPPORT} is set to true. *

    * Default: true
    - * Value: org.atmosphere.cpr.sessionCreate + * Value: org.atmosphere.runtime.sessionCreate */ - String PROPERTY_SESSION_CREATE = "org.atmosphere.cpr.sessionCreate"; + String PROPERTY_SESSION_CREATE = "org.atmosphere.runtime.sessionCreate"; /** * Tell Atmosphere to set session max inactive interval to -1 when an atmosphere connection exists. See {@link javax.servlet.http.HttpSession#setMaxInactiveInterval(int)} *

    * Default: true
    - * Value: org.atmosphere.cpr.removeSessionTimeout + * Value: org.atmosphere.runtime.removeSessionTimeout */ - String PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL = "org.atmosphere.cpr.removeSessionTimeout"; + String PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL = "org.atmosphere.runtime.removeSessionTimeout"; /** - * Force Atmosphere to invoke {@link AtmosphereResource#resume()} after the first {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} invocation. + * Force Atmosphere to invoke {@link AtmosphereResource#resume()} after the first {@link org.atmosphere.runtime.Broadcaster#broadcast(Object)} invocation. *

    * Default: false
    * Value: org.atmosphere.resumeOnBroadcast @@ -144,23 +130,23 @@ public interface ApplicationConfig { * Tell Atmosphere to not write the no-cache header. Default is false, e.g Atmosphere will write them. *

    * Default: false
    - * Value: org.atmosphere.cpr.noCacheHeaders + * Value: org.atmosphere.runtime.noCacheHeaders */ - String NO_CACHE_HEADERS = "org.atmosphere.cpr.noCacheHeaders"; + String NO_CACHE_HEADERS = "org.atmosphere.runtime.noCacheHeaders"; /** * Tell Atmosphere to not write the access-control header. Default is false, e.g Atmosphere will write them. *

    * Default: false
    - * Value: org.atmosphere.cpr.dropAccessControlAllowOriginHeader + * Value: org.atmosphere.runtime.dropAccessControlAllowOriginHeader */ - String DROP_ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "org.atmosphere.cpr.dropAccessControlAllowOriginHeader"; + String DROP_ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "org.atmosphere.runtime.dropAccessControlAllowOriginHeader"; /** - * The {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy} policy to use. + * The {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy} policy to use. *

    * Default: BroadcasterLifeCyclePolicy.NEVER
    - * Value: org.atmosphere.cpr.broadcasterLifeCyclePolicy + * Value: org.atmosphere.runtime.broadcasterLifeCyclePolicy */ - String BROADCASTER_LIFECYCLE_POLICY = "org.atmosphere.cpr.broadcasterLifeCyclePolicy"; + String BROADCASTER_LIFECYCLE_POLICY = "org.atmosphere.runtime.broadcasterLifeCyclePolicy"; /** * Tell Atmosphere the {@link org.atmosphere.websocket.WebSocketProcessor} to use. *

    @@ -259,27 +245,27 @@ public interface ApplicationConfig { /** * The {@link AtmosphereResource}. *

    - * Default: org.atmosphere.cpr.AtmosphereResourceImpl
    - * Value: org.atmosphere.cpr.AtmosphereResource + * Default: org.atmosphere.runtime.AtmosphereResourceImpl
    + * Value: org.atmosphere.runtime.AtmosphereResource */ - String ATMOSPHERE_RESOURCE = "org.atmosphere.cpr.AtmosphereResource"; + String ATMOSPHERE_RESOURCE = "org.atmosphere.runtime.AtmosphereResource"; /** * A list of {@link BroadcastFilter} separated by comma that will be added to every new {@link Broadcaster}. *

    * Default: ""
    - * Value: org.atmosphere.cpr.broadcastFilterClasses + * Value: org.atmosphere.runtime.broadcastFilterClasses */ - String BROADCAST_FILTER_CLASSES = "org.atmosphere.cpr.broadcastFilterClasses"; + String BROADCAST_FILTER_CLASSES = "org.atmosphere.runtime.broadcastFilterClasses"; /** * A request attribute telling a {@link AsyncSupport} if the AtmosphereResource was resumed on timeout or by an application. * This attribute is for WebServer that doesn't support time-outs (like Jetty 6) *

    * Default: false
    - * Value: org.atmosphere.cpr.AtmosphereServlet.resumedOnTimeout + * Value: org.atmosphere.runtime.AtmosphereServlet.resumedOnTimeout */ - String RESUMED_ON_TIMEOUT = "org.atmosphere.cpr.AtmosphereServlet.resumedOnTimeout"; + String RESUMED_ON_TIMEOUT = "org.atmosphere.runtime.AtmosphereServlet.resumedOnTimeout"; /** - * Disable invoking {@link org.atmosphere.cpr.AtmosphereHandler#onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)} when the connection times out or get cancelled. + * Disable invoking {@link org.atmosphere.runtime.AtmosphereHandler#onStateChange(org.atmosphere.runtime.AtmosphereResourceEvent)} when the connection times out or get cancelled. *

    * Default: false
    * Value: org.atmosphere.disableOnStateEvent @@ -290,16 +276,16 @@ public interface ApplicationConfig { * {@link org.atmosphere.interceptor.IdleResourceInterceptor}, e.g you must install that interceptor in order to use the property. *

    * Default: -1 (not enabled)
    - * Value: org.atmosphere.cpr.CometSupport.maxInactiveActivity + * Value: org.atmosphere.runtime.CometSupport.maxInactiveActivity */ - String MAX_INACTIVE = "org.atmosphere.cpr.CometSupport.maxInactiveActivity"; + String MAX_INACTIVE = "org.atmosphere.runtime.CometSupport.maxInactiveActivity"; /** * Allow query string as set as request's header. *

    * Default: true
    - * Value: org.atmosphere.cpr.allowQueryStreamAsPostOrGet + * Value: org.atmosphere.runtime.allowQueryStreamAsPostOrGet */ - String ALLOW_QUERYSTRING_AS_REQUEST = "org.atmosphere.cpr.allowQueryStreamAsPostOrGet"; + String ALLOW_QUERYSTRING_AS_REQUEST = "org.atmosphere.runtime.allowQueryStreamAsPostOrGet"; /** * Disallow Atmosphere to modify the query string of incoming connections. *

    @@ -308,116 +294,80 @@ public interface ApplicationConfig { * at least WebSocket draft-00 / hixie-76, but by setting this value to true the query string is never modified by Atmosphere. *

    * Default: false
    - * Value: org.atmosphere.cpr.disallowModifyQueryString + * Value: org.atmosphere.runtime.disallowModifyQueryString */ - String DISALLOW_MODIFY_QUERYSTRING = "org.atmosphere.cpr.disallowModifyQueryString"; + String DISALLOW_MODIFY_QUERYSTRING = "org.atmosphere.runtime.disallowModifyQueryString"; /** * Configure {@link Broadcaster} to share the same {@link java.util.concurrent.ExecutorService} among them. *

    * Default: true
    - * Value: org.atmosphere.cpr.broadcaster.shareableThreadPool + * Value: org.atmosphere.runtime.broadcaster.shareableThreadPool */ - String BROADCASTER_SHARABLE_THREAD_POOLS = "org.atmosphere.cpr.broadcaster.shareableThreadPool"; + String BROADCASTER_SHARABLE_THREAD_POOLS = "org.atmosphere.runtime.broadcaster.shareableThreadPool"; /** * The maximum number of Thread created when processing broadcast operations {@link BroadcasterConfig#setExecutorService(java.util.concurrent.ExecutorService)}. *

    * Default: unlimited
    - * Value: org.atmosphere.cpr.broadcaster.maxProcessingThreads + * Value: org.atmosphere.runtime.broadcaster.maxProcessingThreads */ - String BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE = "org.atmosphere.cpr.broadcaster.maxProcessingThreads"; + String BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE = "org.atmosphere.runtime.broadcaster.maxProcessingThreads"; /** * The maximum number of Thread created when writing requests {@link BroadcasterConfig#setAsyncWriteService(java.util.concurrent.ExecutorService)}. *

    * Default: 200
    - * Value: org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads + * Value: org.atmosphere.runtime.broadcaster.maxAsyncWriteThreads */ - String BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE = "org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads"; + String BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE = "org.atmosphere.runtime.broadcaster.maxAsyncWriteThreads"; /** * Time out threads created by the {@link org.atmosphere.util.ExecutorsFactory}. *

    * Default: true}
    - * Value: org.atmosphere.cpr.allowCoreThreadTimeOut + * Value: org.atmosphere.runtime.allowCoreThreadTimeOut * #see {@link java.util.concurrent.ThreadPoolExecutor#allowCoreThreadTimeOut} */ - String ALLOW_CORE_THREAD_TIMEOUT = "org.atmosphere.cpr.allowCoreThreadTimeOut"; + String ALLOW_CORE_THREAD_TIMEOUT = "org.atmosphere.runtime.allowCoreThreadTimeOut"; /** * The maximum number of Thread created by the {@link org.atmosphere.util.ExecutorsFactory#getScheduler(AtmosphereConfig)}. *

    * Default: {@link Runtime#availableProcessors()}
    - * Value: org.atmosphere.cpr.maxSchedulerThread + * Value: org.atmosphere.runtime.maxSchedulerThread */ - String SCHEDULER_THREADPOOL_MAXSIZE = "org.atmosphere.cpr.maxSchedulerThread"; + String SCHEDULER_THREADPOOL_MAXSIZE = "org.atmosphere.runtime.maxSchedulerThread"; /** * BroadcasterLifecycle max idle time before executing. *

    * Default: 5 minutes
    - * Value: org.atmosphere.cpr.maxBroadcasterLifeCyclePolicyIdleTime + * Value: org.atmosphere.runtime.maxBroadcasterLifeCyclePolicyIdleTime */ - String BROADCASTER_LIFECYCLE_POLICY_IDLETIME = "org.atmosphere.cpr.maxBroadcasterLifeCyclePolicyIdleTime"; + String BROADCASTER_LIFECYCLE_POLICY_IDLETIME = "org.atmosphere.runtime.maxBroadcasterLifeCyclePolicyIdleTime"; /** * Recover from a {@link Broadcaster} that has been destroyed. *

    * Default: true
    - * Value: org.atmosphere.cpr.recoverFromDestroyedBroadcaster + * Value: org.atmosphere.runtime.recoverFromDestroyedBroadcaster */ - String RECOVER_DEAD_BROADCASTER = "org.atmosphere.cpr.recoverFromDestroyedBroadcaster"; + String RECOVER_DEAD_BROADCASTER = "org.atmosphere.runtime.recoverFromDestroyedBroadcaster"; /** * Tell Atmosphere which AtmosphereHandler should be used. You can do the same using atmosphere.xml *

    * Default: ""
    - * Value: org.atmosphere.cpr.AtmosphereHandler + * Value: org.atmosphere.runtime.AtmosphereHandler */ - String ATMOSPHERE_HANDLER = "org.atmosphere.cpr.AtmosphereHandler"; + String ATMOSPHERE_HANDLER = "org.atmosphere.runtime.AtmosphereHandler"; /** * The AtmosphereHandler defined using the property will be mapped to that value. Same as atmosphere.xml *

    * Default: true
    - * Value: org.atmosphere.cpr.AtmosphereHandler.contextRoot - */ - String ATMOSPHERE_HANDLER_MAPPING = "org.atmosphere.cpr.AtmosphereHandler.contextRoot"; - /** - * The Servlet's name where {@link Meteor} will be available. - *

    - * Default: ""
    - * Value: org.atmosphere.servlet - */ - String SERVLET_CLASS = "org.atmosphere.servlet"; - /** - * The Filter's name where {@link Meteor} will be available. - *

    - * Default: ""
    - * Value: org.atmosphere.filter - */ - String FILTER_CLASS = "org.atmosphere.filter"; - /** - * The Servlet's mapping value to the SERVLET_CLASS. - *

    - * Default: ""
    - * Value: org.atmosphere.mapping - */ - String MAPPING = "org.atmosphere.mapping"; - /** - * The Servlet's mapping value to the FILTER_CLASS. - *

    - * Default: ""
    - * Value: org.atmosphere.filter.name + * Value: org.atmosphere.runtime.AtmosphereHandler.contextRoot */ - String FILTER_NAME = "org.atmosphere.filter.name"; + String ATMOSPHERE_HANDLER_MAPPING = "org.atmosphere.runtime.AtmosphereHandler.contextRoot"; /** * Define when a broadcasted message is cached. Value can be 'beforeFilter' or 'afterFilter'. *

    * Default: afterFilter
    - * Value: org.atmosphere.cpr.BroadcasterCache.strategy + * Value: org.atmosphere.runtime.BroadcasterCache.strategy */ - String BROADCASTER_CACHE_STRATEGY = "org.atmosphere.cpr.BroadcasterCache.strategy"; - /** - * Support the Jersey location header for resuming. WARNING: this can cause memory leak if the connection is never - * resumed. - *

    - * Default: false
    - * Value: org.atmosphere.jersey.supportLocationHeader - */ - String SUPPORT_LOCATION_HEADER = "org.atmosphere.jersey.supportLocationHeader"; + String BROADCASTER_CACHE_STRATEGY = "org.atmosphere.runtime.BroadcasterCache.strategy"; /** * WebSocket version to exclude and downgrade to comet. Versions are separated by comma. *

    @@ -445,23 +395,16 @@ public interface ApplicationConfig { * a Container. *

    * Default: false
    - * Value: org.atmosphere.cpr.recycleAtmosphereRequestResponse + * Value: org.atmosphere.runtime.recycleAtmosphereRequestResponse */ - String RECYCLE_ATMOSPHERE_REQUEST_RESPONSE = "org.atmosphere.cpr.recycleAtmosphereRequestResponse"; + String RECYCLE_ATMOSPHERE_REQUEST_RESPONSE = "org.atmosphere.runtime.recycleAtmosphereRequestResponse"; /** * The location of classes implementing the {@link AtmosphereHandler} interface. *

    * Default: "/WEB-INF/classes".
    - * Value: org.atmosphere.cpr.atmosphereHandlerPath - */ - String ATMOSPHERE_HANDLER_PATH = "org.atmosphere.cpr.atmosphereHandlerPath"; - /** - * Jersey's ContainerResponseWriter. - *

    - * Default: ""
    - * Value: org.atmosphere.jersey.containerResponseWriterClass + * Value: org.atmosphere.runtime.atmosphereHandlerPath */ - String JERSEY_CONTAINER_RESPONSE_WRITER_CLASS = "org.atmosphere.jersey.containerResponseWriterClass"; + String ATMOSPHERE_HANDLER_PATH = "org.atmosphere.runtime.atmosphereHandlerPath"; /** * Execute the {@link org.atmosphere.websocket.WebSocketProtocol#onMessage(org.atmosphere.websocket.WebSocket, byte[], int, int)}. *

    @@ -469,36 +412,21 @@ public interface ApplicationConfig { * Value: org.atmosphere.websocket.WebSocketProtocol.executeAsync */ String WEBSOCKET_PROTOCOL_EXECUTION = "org.atmosphere.websocket.WebSocketProtocol.executeAsync"; - /** - * Suppress the detection of JSR356 support. In Atmosphere 2.4.0 and newer, JSR356 has the - * precedence over container specific providers. This option can be used to suppress this ordering. - *

    - * Default: false
    - * Value: org.atmosphere.websocket.suppressJSR356 - */ - String WEBSOCKET_SUPPRESS_JSR356 = "org.atmosphere.websocket.suppressJSR356"; - /** - * The default content-type value used when Atmosphere requires one. - *

    - * Default: "text/plain"
    - * Value: org.atmosphere.cpr.defaultContentType - */ - String DEFAULT_CONTENT_TYPE = "org.atmosphere.cpr.defaultContentType"; /** * A list of {@link AtmosphereInterceptor} class name that will be invoked before the {@link AtmosphereResource} * gets delivered to an application or framework. *

    * Default: ""
    - * Value: org.atmosphere.cpr.AtmosphereInterceptor + * Value: org.atmosphere.runtime.AtmosphereInterceptor */ - String ATMOSPHERE_INTERCEPTORS = "org.atmosphere.cpr.AtmosphereInterceptor"; + String ATMOSPHERE_INTERCEPTORS = "org.atmosphere.runtime.AtmosphereInterceptor"; /** * Regex pattern for excluding file from being serviced by {@link AtmosphereFilter}. *

    * Default: {@link AtmosphereFilter#EXCLUDE_FILES}
    - * Value: org.atmosphere.cpr.AtmosphereFilter.excludes + * Value: org.atmosphere.runtime.AtmosphereFilter.excludes */ - String ATMOSPHERE_EXCLUDED_FILE = "org.atmosphere.cpr.AtmosphereFilter.excludes"; + String ATMOSPHERE_EXCLUDED_FILE = "org.atmosphere.runtime.AtmosphereFilter.excludes"; /** * The token used to separate broadcasted messages. This value is used by the client to parse several messages * received in one chunk. @@ -527,9 +455,9 @@ public interface ApplicationConfig { * Disable au-discovery of pre-installed {@link AtmosphereInterceptor}s. *

    * Default: false
    - * Value: org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults + * Value: org.atmosphere.runtime.AtmosphereInterceptor.disableDefaults */ - String DISABLE_ATMOSPHEREINTERCEPTOR = "org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults"; + String DISABLE_ATMOSPHEREINTERCEPTOR = "org.atmosphere.runtime.AtmosphereInterceptor.disableDefaults"; /** * Set to true if Atmosphere is used as a library and you don't want to destroy associated static factory when undeploying. *

    @@ -541,38 +469,38 @@ public interface ApplicationConfig { * The suspended UUID of the suspended connection which is the same as {@link HeaderConfig#X_ATMOSPHERE_TRACKING_ID} * but available to all transport. *

    - * Value: org.atmosphere.cpr.AtmosphereResource.suspended.uuid + * Value: org.atmosphere.runtime.AtmosphereResource.suspended.uuid */ - String SUSPENDED_ATMOSPHERE_RESOURCE_UUID = "org.atmosphere.cpr.AtmosphereResource.suspended.uuid"; + String SUSPENDED_ATMOSPHERE_RESOURCE_UUID = "org.atmosphere.runtime.AtmosphereResource.suspended.uuid"; /** * Use a unique UUID for all WebSocket message delivered on the same connection. *

    * Default: true
    - * Value: org.atmosphere.cpr.AtmosphereResource.uniqueUUID + * Value: org.atmosphere.runtime.AtmosphereResource.uniqueUUID */ - String UNIQUE_UUID_WEBSOCKET = "org.atmosphere.cpr.AtmosphereResource.uniqueUUID"; + String UNIQUE_UUID_WEBSOCKET = "org.atmosphere.runtime.AtmosphereResource.uniqueUUID"; /** * Set to true if order of message delivered to the client is not important. *

    * Default: false
    - * Value: org.atmosphere.cpr.Broadcaster.supportOutOfOrderBroadcast + * Value: org.atmosphere.runtime.Broadcaster.supportOutOfOrderBroadcast */ - String OUT_OF_ORDER_BROADCAST = "org.atmosphere.cpr.Broadcaster.supportOutOfOrderBroadcast"; + String OUT_OF_ORDER_BROADCAST = "org.atmosphere.runtime.Broadcaster.supportOutOfOrderBroadcast"; /** * The write operation timeout, in millisecond, when using the {@link DefaultBroadcaster}. When the timeout occurs, the calling thread gets interrupted. *

    * Default: 5 * 60 * 1000 (5 minutes)
    - * Value: org.atmosphere.cpr.Broadcaster.writeTimeout + * Value: org.atmosphere.runtime.Broadcaster.writeTimeout */ - String WRITE_TIMEOUT = "org.atmosphere.cpr.Broadcaster.writeTimeout"; + String WRITE_TIMEOUT = "org.atmosphere.runtime.Broadcaster.writeTimeout"; /** * The sleep time, in millisecond, before the {@link DefaultBroadcaster} release its reactive thread for pushing message * and execute async write. Setting this value too high may create too many threads. *

    * Default: 1000
    - * Value: org.atmosphere.cpr.Broadcaster.threadWaitTime + * Value: org.atmosphere.runtime.Broadcaster.threadWaitTime */ - String BROADCASTER_WAIT_TIME = "org.atmosphere.cpr.Broadcaster.threadWaitTime"; + String BROADCASTER_WAIT_TIME = "org.atmosphere.runtime.Broadcaster.threadWaitTime"; /** * Before 1.0.12, WebSocket's AtmosphereResource manually added to {@link Broadcaster} were added without checking * if the parent, e.g the AtmosphereResource's created on the first request was already added to the Broadcaster. That caused @@ -586,23 +514,23 @@ public interface ApplicationConfig { * A list, separated by comma, of package name to scan when looking for Atmosphere's component annotated with Atmosphere's annotation. *

    * Default: ""
    - * Value: org.atmosphere.cpr.packages + * Value: org.atmosphere.runtime.packages */ - String ANNOTATION_PACKAGE = "org.atmosphere.cpr.packages"; + String ANNOTATION_PACKAGE = "org.atmosphere.runtime.packages"; /** * The annotation processor. *

    - * Default: org.atmosphere.cpr.DefaultAnnotationProcessor
    - * Value: org.atmosphere.cpr.AnnotationProcessor + * Default: org.atmosphere.runtime.DefaultAnnotationProcessor
    + * Value: org.atmosphere.runtime.AnnotationProcessor */ - String ANNOTATION_PROCESSOR = "org.atmosphere.cpr.AnnotationProcessor"; + String ANNOTATION_PROCESSOR = "org.atmosphere.runtime.AnnotationProcessor"; /** * Define an implementation of the {@link org.atmosphere.util.EndpointMapper}. *

    - * Default: org.atmosphere.cpr.DefaultEndpointMapper
    - * Value: org.atmosphere.cpr.EndpointMapper + * Default: org.atmosphere.runtime.DefaultEndpointMapper
    + * Value: org.atmosphere.runtime.EndpointMapper */ - String ENDPOINT_MAPPER = "org.atmosphere.cpr.EndpointMapper"; + String ENDPOINT_MAPPER = "org.atmosphere.runtime.EndpointMapper"; /** * The list of content-type to exclude when delimiting message. *

    @@ -611,26 +539,26 @@ public interface ApplicationConfig { */ String EXCLUDED_CONTENT_TYPES = "org.atmosphere.client.TrackMessageSizeInterceptor.excludedContentType"; /** - * Allow defining the Broadcaster's Suspend Policy {@link Broadcaster#setSuspendPolicy(long, org.atmosphere.cpr.Broadcaster.POLICY)}. + * Allow defining the Broadcaster's Suspend Policy {@link Broadcaster#setSuspendPolicy(long, org.atmosphere.runtime.Broadcaster.POLICY)}. *

    * Default: FIFO
    - * Value: org.atmosphere.cpr.Broadcaster.POLICY + * Value: org.atmosphere.runtime.Broadcaster.POLICY */ - String BROADCASTER_POLICY = "org.atmosphere.cpr.Broadcaster.POLICY"; + String BROADCASTER_POLICY = "org.atmosphere.runtime.Broadcaster.POLICY"; /** - * Allow defining the Broadcaster's maximum Suspended Atmosphere Policy {@link Broadcaster#setSuspendPolicy(long, org.atmosphere.cpr.Broadcaster.POLICY)}. + * Allow defining the Broadcaster's maximum Suspended Atmosphere Policy {@link Broadcaster#setSuspendPolicy(long, org.atmosphere.runtime.Broadcaster.POLICY)}. *

    * Default: -1 (unlimited)
    - * Value: org.atmosphere.cpr.Broadcaster.POLICY.maximumSuspended + * Value: org.atmosphere.runtime.Broadcaster.POLICY.maximumSuspended */ - String BROADCASTER_POLICY_TIMEOUT = "org.atmosphere.cpr.Broadcaster.POLICY.maximumSuspended"; + String BROADCASTER_POLICY_TIMEOUT = "org.atmosphere.runtime.Broadcaster.POLICY.maximumSuspended"; /** * Change the default regex used when mapping AtmosphereHandler. Default: {@link AtmosphereFramework#MAPPING_REGEX} *

    * Default: "[a-zA-Z0-9-&.*_=@;\?]+"
    * Value: org.atmosphere.client.ApplicationConfig.mappingRegex */ - String HANDLER_MAPPING_REGEX = "org.atmosphere.cpr.mappingRegex"; + String HANDLER_MAPPING_REGEX = "org.atmosphere.runtime.mappingRegex"; /** * The timeout, in milliseconds, before an {@link AtmosphereResource}'s state get discarded. *

    @@ -641,9 +569,9 @@ public interface ApplicationConfig { /** * jsr356 Path mapping length for add(ServerEndpointConfig.Builder.create(JSR356Endpoint.class, "/{path}/{path/...}"). * Default: 5 - * Value: MUST be set using System's properties: org.atmosphere.cpr.jsr356.pathMappingLength" + * Value: MUST be set using System's properties: org.atmosphere.runtime.jsr356.pathMappingLength" */ - String JSR356_PATH_MAPPING_LENGTH = "org.atmosphere.cpr.jsr356.pathMappingLength"; + String JSR356_PATH_MAPPING_LENGTH = "org.atmosphere.runtime.jsr356.pathMappingLength"; /** * Default Server-Sent Event content type. * Default: text/event-stream @@ -661,31 +589,31 @@ public interface ApplicationConfig { * Set to false if you want Atmosphere to scan the entire classpath looking for annotation. *

    * Default: true
    - * Value: org.atmosphere.cpr.scanClassPath + * Value: org.atmosphere.runtime.scanClassPath */ - String SCAN_CLASSPATH = "org.atmosphere.cpr.scanClassPath"; + String SCAN_CLASSPATH = "org.atmosphere.runtime.scanClassPath"; /** * Use a build in {@link javax.servlet.http.HttpSession} when using native WebSocket implementation. *

    * Default: false
    - * Value: org.atmosphere.cpr.useBuildInSession + * Value: org.atmosphere.runtime.useBuildInSession */ - String BUILT_IN_SESSION = "org.atmosphere.cpr.useBuildInSession"; + String BUILT_IN_SESSION = "org.atmosphere.runtime.useBuildInSession"; /** * The default {@link AtmosphereObjectFactory} class. *

    * Default: DefaultAtmosphereObjectFactory (calls newInstance() on class)
    - * Value: org.atmosphere.cpr.objectFactory + * Value: org.atmosphere.runtime.objectFactory */ - String OBJECT_FACTORY = "org.atmosphere.cpr.objectFactory"; + String OBJECT_FACTORY = "org.atmosphere.runtime.objectFactory"; /** * The maximum number of time, in seconds, thread will be stay alive when created with {@link org.atmosphere.util.ExecutorsFactory}. Those {@link java.util.concurrent.Executor}. * are used by the {@link DefaultBroadcaster}'s Thread Pool. See also {@link #BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE} and {@link #BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE} *

    * Default: 10 seconds
    - * Value: org.atmosphere.cpr.threadPool.maxKeepAliveThreads + * Value: org.atmosphere.runtime.threadPool.maxKeepAliveThreads */ - String EXECUTORFACTORY_KEEP_ALIVE = "org.atmosphere.cpr.threadPool.maxKeepAliveThreads"; + String EXECUTORFACTORY_KEEP_ALIVE = "org.atmosphere.runtime.threadPool.maxKeepAliveThreads"; /** * In Memory WebSocket buffered message size; *

    @@ -697,16 +625,16 @@ public interface ApplicationConfig { * Scan the classpath to find {@link Broadcaster} *

    * Default: true)
    - * Value: org.atmosphere.cpr.Broadcaster.scanClassPath + * Value: org.atmosphere.runtime.Broadcaster.scanClassPath */ - String AUTODETECT_BROADCASTER = "org.atmosphere.cpr.Broadcaster.scanClassPath"; + String AUTODETECT_BROADCASTER = "org.atmosphere.runtime.Broadcaster.scanClassPath"; /** * Disables the list of {@link AtmosphereInterceptor}s. *

    * Default: false
    - * Value: org.atmosphere.cpr.AtmosphereInterceptor.disable + * Value: org.atmosphere.runtime.AtmosphereInterceptor.disable */ - String DISABLE_ATMOSPHEREINTERCEPTORS = "org.atmosphere.cpr.AtmosphereInterceptor.disable"; + String DISABLE_ATMOSPHEREINTERCEPTORS = "org.atmosphere.runtime.AtmosphereInterceptor.disable"; /** * The JSR 356 WebSocket root path. Use this property if more than one AtmosphereServlet gets deployed inside * the same application, and the guessed mapping path is not the one expected. @@ -719,17 +647,17 @@ public interface ApplicationConfig { * The default {@link javax.servlet.http.HttpSession#setMaxInactiveInterval(int)} *

    * Default: -1
    - * Value: org.atmosphere.cpr.session.maxInactiveInterval + * Value: org.atmosphere.runtime.session.maxInactiveInterval */ - String SESSION_MAX_INACTIVE_INTERVAL = "org.atmosphere.cpr.session.maxInactiveInterval"; + String SESSION_MAX_INACTIVE_INTERVAL = "org.atmosphere.runtime.session.maxInactiveInterval"; /** * Wait X milliseconds before considering the {@link AtmosphereResource} closed. This is useful when {@link org.atmosphere.util.Utils#atmosphereProtocol(AtmosphereRequest r))} * return true, and let the client send the {@link HeaderConfig#DISCONNECT_TRANSPORT_MESSAGE} message. *

    * Default: 500
    - * Value: org.atmosphere.cpr.session.delayClosingTime + * Value: org.atmosphere.runtime.session.delayClosingTime */ - String CLOSED_ATMOSPHERE_THINK_TIME = "org.atmosphere.cpr.delayClosingTime"; + String CLOSED_ATMOSPHERE_THINK_TIME = "org.atmosphere.runtime.delayClosingTime"; /** * The maximum time, in seconds, for a message to stay cached when using the {@link org.atmosphere.cache.UUIDBroadcasterCache} *

    @@ -796,45 +724,45 @@ public interface ApplicationConfig { String RESUME_ON_HEARTBEAT = "org.atmosphere.interceptor.HeartbeatInterceptor.resumeOnHeartbeat"; /** - * Set the default {@link org.atmosphere.cpr.Serializer} implementation {@link org.atmosphere.cpr.AtmosphereResource}s use + * Set the default {@link org.atmosphere.runtime.Serializer} implementation {@link org.atmosphere.runtime.AtmosphereResource}s use * to serialize broadcasted objects. *

    * Default: empty (no Serialize class used)
    - * Value: org.atmosphere.cpr.AtmosphereResource.defaultSerializer + * Value: org.atmosphere.runtime.AtmosphereResource.defaultSerializer */ - String DEFAULT_SERIALIZER = "org.atmosphere.cpr.AtmosphereResource.defaultSerializer"; + String DEFAULT_SERIALIZER = "org.atmosphere.runtime.AtmosphereResource.defaultSerializer"; /** * Disable container managed framework auto initialization during startup lifecycle (Servlet 3.0). * This is useful e.g. if special initialization or framework extensions are needed. *

    * Default: false (Auto initialization enabled)
    - * Value: org.atmosphere.cpr.AtmosphereInitializer.disabled + * Value: org.atmosphere.runtime.AtmosphereInitializer.disabled *

    *

    * Example init-param: *

          *
          * <init-param>
    -     * <param-name>org.atmosphere.cpr.AtmosphereInitializer.disabled</param-name>
    +     * <param-name>org.atmosphere.runtime.AtmosphereInitializer.disabled</param-name>
          * <param-value>true</param-value>
          * </init-param>
          * 
    * * @see {@see https://github.com/Atmosphere/atmosphere/issues/1695} */ - String DISABLE_ATMOSPHERE_INITIALIZER = "org.atmosphere.cpr.AtmosphereInitializer.disabled"; + String DISABLE_ATMOSPHERE_INITIALIZER = "org.atmosphere.runtime.AtmosphereInitializer.disabled"; /** * Disable Google Analytics. * Default: true (enabled)
    - * Value: org.atmosphere.cpr.AtmosphereFramework.analytics + * Value: org.atmosphere.runtime.AtmosphereFramework.analytics */ - String ANALYTICS = "org.atmosphere.cpr.AtmosphereFramework.analytics"; + String ANALYTICS = "org.atmosphere.runtime.AtmosphereFramework.analytics"; /** * For use of (@link BytecodeBasedAnnotationProcessor} * Default: false - * Value: org.atmosphere.cpr.annotation.useBytecodeProcessor + * Value: org.atmosphere.runtime.annotation.useBytecodeProcessor */ - String BYTECODE_PROCESSOR = "org.atmosphere.cpr.annotation.useBytecodeProcessor"; + String BYTECODE_PROCESSOR = "org.atmosphere.runtime.annotation.useBytecodeProcessor"; /** * The web.xml servlet-name. * Default: AtmosphereServlet
    @@ -852,9 +780,9 @@ public interface ApplicationConfig { * When the server buffer the bytes, the bytes may or may not been properly written to the client and those will be lost if you set that * value to false. If the bytes where properly written, the bytes may be cached and may be sent twice to the client. * Default: true
    - * Value: org.atmosphere.cpr.Broadcaster.cacheOnIOFlushException + * Value: org.atmosphere.runtime.Broadcaster.cacheOnIOFlushException */ - String CACHE_MESSAGE_ON_IO_FLUSH_EXCEPTION = "org.atmosphere.cpr.Broadcaster.cacheOnIOFlushException"; + String CACHE_MESSAGE_ON_IO_FLUSH_EXCEPTION = "org.atmosphere.runtime.Broadcaster.cacheOnIOFlushException"; /** * Share between Broadcaster the same List of {@link BroadcasterListener} and {@link BroadcasterLifeCyclePolicyListener}. * Setting the value to true may significantly reduce the memory used by those listeners if a lot of Broadcaster are created. @@ -862,12 +790,12 @@ public interface ApplicationConfig { * Listeners MUST be Thread-Safe to use that feature. *

    * Default: false
    - * Value: org.atmosphere.cpr.Broadcaster.sharedListenersList + * Value: org.atmosphere.runtime.Broadcaster.sharedListenersList */ - String BROADCASTER_SHAREABLE_LISTENERS = "org.atmosphere.cpr.Broadcaster.sharedListenersList"; + String BROADCASTER_SHAREABLE_LISTENERS = "org.atmosphere.runtime.Broadcaster.sharedListenersList"; /** * When the {@link org.atmosphere.pool.PoolableBroadcasterFactory} is enabled, set to true - * for tracking created {@link org.atmosphere.cpr.Broadcaster} and their associated id, preventing duplicate. + * for tracking created {@link org.atmosphere.runtime.Broadcaster} and their associated id, preventing duplicate. *

    * Default: false * Value:org.atmosphere.pool.trackPooledBroadcaster @@ -896,24 +824,24 @@ public interface ApplicationConfig { */ String BROADCASTER_FACTORY_EMPTY_WAIT_TIME_IN_SECONDS = "org.atmosphere.pool.BoundedApachePoolableProvider.waitingTime"; /** - * The path to the org.atmosphere.cpr.AtmosphereFramework configuration file + * The path to the org.atmosphere.runtime.AtmosphereFramework configuration file * Default: META-INF/services - * Value: org.atmosphere.cpr.metaServicePath + * Value: org.atmosphere.runtime.metaServicePath */ - String META_SERVICE_PATH = "org.atmosphere.cpr.metaServicePath"; + String META_SERVICE_PATH = "org.atmosphere.runtime.metaServicePath"; /** - * Close the {@link AtmosphereResponseImpl#getOutputStream()} when {@link org.atmosphere.cpr.AtmosphereResource#close()} + * Close the {@link AtmosphereResponseImpl#getOutputStream()} when {@link org.atmosphere.runtime.AtmosphereResource#close()} * gets invoked, or when the underlying server close the connection. * Default: false - * Value: org.atmosphere.cpr.AsynchronousProcessor.closeOnCancel + * Value: org.atmosphere.runtime.AsynchronousProcessor.closeOnCancel */ - String CLOSE_STREAM_ON_CANCEL = "org.atmosphere.cpr.AsynchronousProcessor.closeOnCancel"; + String CLOSE_STREAM_ON_CANCEL = "org.atmosphere.runtime.AsynchronousProcessor.closeOnCancel"; /** * Use init parameters specified for servlet context in addition to servlet config * Default: false - * Value: org.atmosphere.cpr.AtmosphereConfig.getInitParameter + * Value: org.atmosphere.runtime.AtmosphereConfig.getInitParameter */ - String USE_SERVLET_CONTEXT_PARAMETERS = "org.atmosphere.cpr.AtmosphereConfig.getInitParameter"; + String USE_SERVLET_CONTEXT_PARAMETERS = "org.atmosphere.runtime.AtmosphereConfig.getInitParameter"; /** * Use {@link ForkJoinPool} for dispatching messages and executing async I/O) operation * Default: true @@ -926,14 +854,14 @@ public interface ApplicationConfig { *

    * Default: false */ - String RESPONSE_COMPLETION_AWARE = "org.atmosphere.cpr.ResponseCompletionAware"; + String RESPONSE_COMPLETION_AWARE = "org.atmosphere.runtime.ResponseCompletionAware"; /** * The completion status of AtmosphereResponse is reset after each completion so that the subsequent write operations * are handled as a series of new write operations. *

    * Default: false */ - String RESPONSE_COMPLETION_RESET = "org.atmosphere.cpr.ResponseCompletionReset"; + String RESPONSE_COMPLETION_RESET = "org.atmosphere.runtime.ResponseCompletionReset"; /** * Writes the given data to the given outputstream in two steps with extra flushes to make servers notice if the connection has been closed. * This enables caching the message instead of losing it, if the client is in the progress of reconnecting via a Proxy where @@ -942,18 +870,18 @@ public interface ApplicationConfig { * This value only apply to LONG-POLLING transport *

    * Default: false - * Value: org.atmosphere.cpr.AbstractReflectorAtmosphereHandler.twoStepsWrite + * Value: org.atmosphere.runtime.AbstractReflectorAtmosphereHandler.twoStepsWrite */ - String TWO_STEPS_WRITE = "org.atmosphere.cpr.AbstractReflectorAtmosphereHandler.twoStepsWrite"; + String TWO_STEPS_WRITE = "org.atmosphere.runtime.AbstractReflectorAtmosphereHandler.twoStepsWrite"; /** * How many times the {@link org.atmosphere.inject.InjectableObjectFactory} will try to construct and inject an object * from an {@link org.atmosphere.inject.Injectable}. This happens when an Injectable returns null instead of the * expected Injection *

    * Default: 5 - * Value: org.atmosphere.cpr.InjectableObjectFactory.maxTry + * Value: org.atmosphere.runtime.InjectableObjectFactory.maxTry */ - String INJECTION_TRY = "org.atmosphere.cpr.InjectableObjectFactory.maxTry"; + String INJECTION_TRY = "org.atmosphere.runtime.InjectableObjectFactory.maxTry"; /** * {@link org.atmosphere.inject.InjectableObjectFactory} listeners. *

    diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptor.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptor.java index 8aca25aca01..7b1ecb68b00 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptor.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.io.IOException; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptorAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptorAdapter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptorAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptorAdapter.java index 4e116e16452..41129671310 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOInterceptorAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOInterceptorAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.io.IOException; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriter.java index def740ed344..4c1557bdb78 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.io.IOException; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriterAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriterAdapter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriterAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriterAdapter.java index 1dec1f2e586..8e8e243a598 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncIOWriterAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncIOWriterAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.io.IOException; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupport.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupport.java similarity index 72% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupport.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupport.java index 3ce82fed7fa..9d6f66ec9fe 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupport.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupport.java @@ -13,28 +13,14 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import java.awt.event.ActionEvent; import java.io.IOException; -/** - * Atmosphere's supported WebServer must implement this interface in order to be auto detected by the - * {@link AtmosphereFramework}. If the {@link AtmosphereFramework} fail to detect the {@link AsyncSupport}, it will - * use a blocking thread approach to emulate Comet using the {@link BlockingIOCometSupport}. - *

    - * Framework designers or Atmosphere application developers can also add their own implementation of that class by - * referencing their class within the atmosphere.xml file: - *

    
    - * <<atmosphere-handler ... comet-support="your.class.name">
    - * 

    - * - * @author Jeanfrancois Arcand - */ public interface AsyncSupport { /** @@ -79,8 +65,8 @@ public interface AsyncSupport { public boolean supportWebSocket(); /** - * Complete and close the connection associated with an implementation of {@link org.atmosphere.cpr.AtmosphereResource} - * @param r {@link org.atmosphere.cpr.AtmosphereResource} + * Complete and close the connection associated with an implementation of {@link org.atmosphere.runtime.AtmosphereResource} + * @param r {@link org.atmosphere.runtime.AtmosphereResource} * @return this */ public AsyncSupport complete(E r); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListener.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListener.java index 1dc2aa29403..f43ac9edf5e 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListener.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * A listener that can be used to track {@link AsyncSupport} events like SUSPEND, RESUME, TIMEOUT, DESTROYED and CLOSED diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListenerAdapter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListenerAdapter.java index 9ca67cc9c9e..1682f673915 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportListenerAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportResolver.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportResolver.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportResolver.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportResolver.java index d64a380e7b7..7de1b658f71 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsyncSupportResolver.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsyncSupportResolver.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * This interface is used by {@link AtmosphereFramework} to determine which AsyncSupport instance should be used diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AsynchronousProcessor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AsynchronousProcessor.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AsynchronousProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AsynchronousProcessor.java index a0973f07227..676ccbb39c3 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AsynchronousProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AsynchronousProcessor.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.util.EndpointMapper; @@ -33,13 +33,13 @@ import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; -import static org.atmosphere.cpr.Action.TYPE.SKIP_ATMOSPHEREHANDLER; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; -import static org.atmosphere.cpr.AtmosphereFramework.AtmosphereHandlerWrapper; -import static org.atmosphere.cpr.FrameworkConfig.ATMOSPHERE_HANDLER_WRAPPER; -import static org.atmosphere.cpr.FrameworkConfig.ATMOSPHERE_RESOURCE; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRANSPORT; +import static org.atmosphere.runtime.Action.TYPE.SKIP_ATMOSPHEREHANDLER; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_SESSION_CREATE; +import static org.atmosphere.runtime.AtmosphereFramework.AtmosphereHandlerWrapper; +import static org.atmosphere.runtime.FrameworkConfig.ATMOSPHERE_HANDLER_WRAPPER; +import static org.atmosphere.runtime.FrameworkConfig.ATMOSPHERE_RESOURCE; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_ERROR; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRANSPORT; /** * Base class which implement the semantics of suspending and resuming of a Comet/WebSocket Request. @@ -47,7 +47,7 @@ * @author Jeanfrancois Arcand */ public abstract class - AsynchronousProcessor implements AsyncSupport { +AsynchronousProcessor implements AsyncSupport { private static final Logger logger = LoggerFactory.getLogger(AsynchronousProcessor.class); protected static final Action timedoutAction = new Action(Action.TYPE.TIMEOUT); @@ -161,7 +161,7 @@ Action action(AtmosphereRequest req, AtmosphereResponse res) throws IOException, if (s != null && s.isNew()) { s.setAttribute(FrameworkConfig.BROADCASTER_FACTORY, config.getBroadcasterFactory()); } - } catch(IllegalStateException ex) { + } catch (IllegalStateException ex) { AtmosphereResourceImpl r = AtmosphereResourceImpl.class.cast(req.resource()); logger.warn("Session Expired for {}. Closing the connection", req.uuid(), ex); if (r != null) { @@ -226,8 +226,8 @@ Action action(AtmosphereRequest req, AtmosphereResponse res) throws IOException, throw t; } } - } finally{ - postInterceptors(handlerWrapper != null? handlerWrapper.interceptors: invokedInterceptors, resource); + } finally { + postInterceptors(handlerWrapper != null ? handlerWrapper.interceptors : invokedInterceptors, resource); } Action action = resource.action(); @@ -523,40 +523,35 @@ public boolean completeLifecycle(final AtmosphereResource r, boolean cancelled) * @throws IOException */ protected void invokeAtmosphereHandler(AtmosphereResourceImpl r) throws IOException { - AtmosphereRequest req = r.getRequest(false); - try { - // Rely on isInScope instead of synchronization https://github.com/Atmosphere/atmosphere/issues/1865 - if (r.isInScope()) { - String disableOnEvent = r.getAtmosphereConfig().getInitParameter(ApplicationConfig.DISABLE_ONSTATE_EVENT); - r.getAtmosphereResourceEvent().setMessage(r.writeOnTimeout()); - try { - if (disableOnEvent == null || !disableOnEvent.equals(String.valueOf(true))) { - AtmosphereHandler atmosphereHandler = r.getAtmosphereHandler(); - - if (atmosphereHandler != null && r.isInScope()) { + // Rely on isInScope instead of synchronization https://github.com/Atmosphere/atmosphere/issues/1865 + if (r.isInScope()) { + String disableOnEvent = r.getAtmosphereConfig().getInitParameter(ApplicationConfig.DISABLE_ONSTATE_EVENT); + r.getAtmosphereResourceEvent().setMessage(r.writeOnTimeout()); + try { + if (disableOnEvent == null || !disableOnEvent.equals(String.valueOf(true))) { + AtmosphereHandler atmosphereHandler = r.getAtmosphereHandler(); - try { - Utils.inject(r); - } catch (IllegalAccessException e) { - logger.warn("",e); - } + if (atmosphereHandler != null && r.isInScope()) { - atmosphereHandler.onStateChange(r.getAtmosphereResourceEvent()); + try { + Utils.inject(r); + } catch (IllegalAccessException e) { + logger.warn("", e); } + + atmosphereHandler.onStateChange(r.getAtmosphereResourceEvent()); } - } catch (IOException ex) { - try { - r.onThrowable(ex); - } catch (Throwable t) { - logger.warn("failed calling onThrowable()", ex); - } } - } else { - logger.trace("AtmosphereResource out of scope {}", r.uuid()); - return; + } catch (IOException ex) { + try { + r.onThrowable(ex); + } catch (Throwable t) { + logger.warn("failed calling onThrowable()", ex); + } } - } finally { - Utils.destroyMeteor(req); + } else { + logger.trace("AtmosphereResource out of scope {}", r.uuid()); + return; } } diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereConfig.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereConfig.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereConfig.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereConfig.java index bddbec39504..560ca7811e3 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereConfig.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereConfig.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.config.AtmosphereHandlerConfig; import org.atmosphere.util.UUIDProvider; @@ -95,9 +95,9 @@ public String getWebServerName() { } /** - * Return the list of {@link org.atmosphere.cpr.AtmosphereFramework.AtmosphereHandlerWrapper}s. + * Return the list of {@link org.atmosphere.runtime.AtmosphereFramework.AtmosphereHandlerWrapper}s. * - * @return the list of {@link org.atmosphere.cpr.AtmosphereFramework.AtmosphereHandlerWrapper} + * @return the list of {@link org.atmosphere.runtime.AtmosphereFramework.AtmosphereHandlerWrapper} */ public Map handlers() { return framework.getAtmosphereHandlers(); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFilter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFilter.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFilter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFilter.java index a71d9bb9eb0..41995cac369 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFilter.java @@ -14,9 +14,8 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,12 +32,6 @@ import java.io.IOException; import java.util.Enumeration; -/** - * Atmosphere has support for {@link Filter}s, delegating all work to {@link AtmosphereServlet}. This {@link Filter} - * only works with Jetty and Grizzly/GlassFish. With other containers it will use its {@link BlockingIOCometSupport}. - * - * @author Jeanfrancois Arcand - */ public class AtmosphereFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(AtmosphereFilter.class); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFramework.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFramework.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFramework.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFramework.java index ca3dc2423c9..66fb3e816a1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFramework.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFramework.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.annotation.Processor; import org.atmosphere.cache.BroadcasterCacheInspector; @@ -23,9 +23,6 @@ import org.atmosphere.config.AtmosphereHandlerConfig; import org.atmosphere.config.AtmosphereHandlerProperty; import org.atmosphere.config.FrameworkConfiguration; -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.container.Tomcat7BIOSupportWithWebSocket; -import org.atmosphere.container.WebLogicServlet30WithWebSocket; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; import org.atmosphere.handler.ReflectorServletProcessor; import org.atmosphere.inject.InjectableObjectFactory; @@ -103,52 +100,50 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.ApplicationConfig.ALLOW_QUERYSTRING_AS_REQUEST; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERE_HANDLER; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERE_HANDLER_MAPPING; -import static org.atmosphere.cpr.ApplicationConfig.ATMOSPHERE_HANDLER_PATH; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_CACHE; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_CLASS; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_FACTORY; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_LIFECYCLE_POLICY; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_SHAREABLE_LISTENERS; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_WAIT_TIME; -import static org.atmosphere.cpr.ApplicationConfig.BROADCAST_FILTER_CLASSES; -import static org.atmosphere.cpr.ApplicationConfig.DISABLE_ONSTATE_EVENT; -import static org.atmosphere.cpr.ApplicationConfig.META_SERVICE_PATH; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_ATMOSPHERE_XML; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_BLOCKING_COMETSUPPORT; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_COMET_SUPPORT; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SERVLET_MAPPING; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_SUPPORT; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_THROW_EXCEPTION_ON_CLONED_REQUEST; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.ApplicationConfig.USE_SERVLET_CONTEXT_PARAMETERS; -import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_PROCESSOR; -import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_PROTOCOL; -import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_SUPPORT; -import static org.atmosphere.cpr.Broadcaster.ROOT_MASTER; -import static org.atmosphere.cpr.FrameworkConfig.ATMOSPHERE_CONFIG; -import static org.atmosphere.cpr.FrameworkConfig.CDI_INJECTOR; -import static org.atmosphere.cpr.FrameworkConfig.GUICE_INJECTOR; -import static org.atmosphere.cpr.FrameworkConfig.HAZELCAST_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.INJECT_LIBARY; -import static org.atmosphere.cpr.FrameworkConfig.JERSEY_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.JERSEY_CONTAINER; -import static org.atmosphere.cpr.FrameworkConfig.JGROUPS_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.JMS_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.KAFKA_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.RABBITMQ_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.REDIS_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.RMI_BROADCASTER; -import static org.atmosphere.cpr.FrameworkConfig.SPRING_INJECTOR; -import static org.atmosphere.cpr.FrameworkConfig.THROW_EXCEPTION_ON_CLONED_REQUEST; -import static org.atmosphere.cpr.FrameworkConfig.XMPP_BROADCASTER; -import static org.atmosphere.cpr.HeaderConfig.ATMOSPHERE_POST_BODY; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRACKING_ID; +import static org.atmosphere.runtime.ApplicationConfig.ALLOW_QUERYSTRING_AS_REQUEST; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERE_HANDLER; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERE_HANDLER_MAPPING; +import static org.atmosphere.runtime.ApplicationConfig.ATMOSPHERE_HANDLER_PATH; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_CACHE; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_CLASS; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_FACTORY; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_LIFECYCLE_POLICY; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_SHAREABLE_LISTENERS; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_WAIT_TIME; +import static org.atmosphere.runtime.ApplicationConfig.BROADCAST_FILTER_CLASSES; +import static org.atmosphere.runtime.ApplicationConfig.DISABLE_ONSTATE_EVENT; +import static org.atmosphere.runtime.ApplicationConfig.META_SERVICE_PATH; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_ATMOSPHERE_XML; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_COMET_SUPPORT; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_SESSION_SUPPORT; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_THROW_EXCEPTION_ON_CLONED_REQUEST; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_USE_STREAM; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.ApplicationConfig.USE_SERVLET_CONTEXT_PARAMETERS; +import static org.atmosphere.runtime.ApplicationConfig.WEBSOCKET_PROCESSOR; +import static org.atmosphere.runtime.ApplicationConfig.WEBSOCKET_PROTOCOL; +import static org.atmosphere.runtime.ApplicationConfig.WEBSOCKET_SUPPORT; +import static org.atmosphere.runtime.Broadcaster.ROOT_MASTER; +import static org.atmosphere.runtime.FrameworkConfig.ATMOSPHERE_CONFIG; +import static org.atmosphere.runtime.FrameworkConfig.CDI_INJECTOR; +import static org.atmosphere.runtime.FrameworkConfig.GUICE_INJECTOR; +import static org.atmosphere.runtime.FrameworkConfig.HAZELCAST_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.INJECT_LIBARY; +import static org.atmosphere.runtime.FrameworkConfig.JERSEY_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.JERSEY_CONTAINER; +import static org.atmosphere.runtime.FrameworkConfig.JGROUPS_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.JMS_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.KAFKA_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.RABBITMQ_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.REDIS_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.RMI_BROADCASTER; +import static org.atmosphere.runtime.FrameworkConfig.SPRING_INJECTOR; +import static org.atmosphere.runtime.FrameworkConfig.THROW_EXCEPTION_ON_CLONED_REQUEST; +import static org.atmosphere.runtime.FrameworkConfig.XMPP_BROADCASTER; +import static org.atmosphere.runtime.HeaderConfig.ATMOSPHERE_POST_BODY; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRACKING_ID; import static org.atmosphere.util.IOUtils.realPath; import static org.atmosphere.websocket.WebSocket.WEBSOCKET_SUSPEND; @@ -214,7 +209,7 @@ public class AtmosphereFramework { protected String metaServicePath = META_SERVICE; protected final LinkedList interceptors = new LinkedList(); protected boolean scanDone; - protected String annotationProcessorClassName = "org.atmosphere.cpr.DefaultAnnotationProcessor"; + protected String annotationProcessorClassName = "org.atmosphere.runtime.DefaultAnnotationProcessor"; protected final List broadcasterListeners = Collections.synchronizedList(new ArrayList()); protected String webSocketProcessorClassName = DefaultWebSocketProcessor.class.getName(); protected boolean webSocketProtocolInitialized; @@ -451,39 +446,39 @@ private static class InstallMetaServiceProcedure implements MetaServiceProcedure @Override public void apply(final AtmosphereFramework fwk, final Class c) throws Exception { if (AtmosphereInterceptor.class.isAssignableFrom(c)) { - fwk.interceptor(fwk.newClassInstance(AtmosphereInterceptor.class, (Class)c)); + fwk.interceptor(fwk.newClassInstance(AtmosphereInterceptor.class, (Class) c)); } else if (Broadcaster.class.isAssignableFrom(c)) { fwk.setDefaultBroadcasterClassName(c.getName()); } else if (BroadcasterListener.class.isAssignableFrom(c)) { - fwk.addBroadcasterListener(fwk.newClassInstance(BroadcasterListener.class, (Class)c)); + fwk.addBroadcasterListener(fwk.newClassInstance(BroadcasterListener.class, (Class) c)); } else if (BroadcasterCache.class.isAssignableFrom(c)) { fwk.setBroadcasterCacheClassName(c.getName()); } else if (BroadcastFilter.class.isAssignableFrom(c)) { fwk.broadcasterFilters.add(c.getName()); } else if (BroadcasterCacheInspector.class.isAssignableFrom(c)) { - fwk.inspectors.add(fwk.newClassInstance(BroadcasterCacheInspector.class, (Class)c)); + fwk.inspectors.add(fwk.newClassInstance(BroadcasterCacheInspector.class, (Class) c)); } else if (AsyncSupportListener.class.isAssignableFrom(c)) { - fwk.asyncSupportListeners.add(fwk.newClassInstance(AsyncSupportListener.class, (Class)c)); + fwk.asyncSupportListeners.add(fwk.newClassInstance(AsyncSupportListener.class, (Class) c)); } else if (AsyncSupport.class.isAssignableFrom(c)) { - fwk.setAsyncSupport(fwk.newClassInstance(AsyncSupport.class, (Class)c)); + fwk.setAsyncSupport(fwk.newClassInstance(AsyncSupport.class, (Class) c)); } else if (BroadcasterCacheListener.class.isAssignableFrom(c)) { - fwk.broadcasterCacheListeners.add(fwk.newClassInstance(BroadcasterCacheListener.class, (Class)c)); + fwk.broadcasterCacheListeners.add(fwk.newClassInstance(BroadcasterCacheListener.class, (Class) c)); } else if (BroadcasterConfig.FilterManipulator.class.isAssignableFrom(c)) { - fwk.filterManipulators.add(fwk.newClassInstance(BroadcasterConfig.FilterManipulator.class, (Class)c)); + fwk.filterManipulators.add(fwk.newClassInstance(BroadcasterConfig.FilterManipulator.class, (Class) c)); } else if (WebSocketProtocol.class.isAssignableFrom(c)) { fwk.webSocketProtocolClassName = c.getName(); } else if (WebSocketProcessor.class.isAssignableFrom(c)) { fwk.webSocketProcessorClassName = c.getName(); } else if (AtmosphereResourceFactory.class.isAssignableFrom(c)) { - fwk.setAndConfigureAtmosphereResourceFactory(fwk.newClassInstance(AtmosphereResourceFactory.class, (Class)c)); + fwk.setAndConfigureAtmosphereResourceFactory(fwk.newClassInstance(AtmosphereResourceFactory.class, (Class) c)); } else if (AtmosphereFrameworkListener.class.isAssignableFrom(c)) { - fwk.frameworkListener(fwk.newClassInstance(AtmosphereFrameworkListener.class, (Class)c)); + fwk.frameworkListener(fwk.newClassInstance(AtmosphereFrameworkListener.class, (Class) c)); } else if (WebSocketFactory.class.isAssignableFrom(c)) { - fwk.webSocketFactory(fwk.newClassInstance(WebSocketFactory.class, (Class)c)); + fwk.webSocketFactory(fwk.newClassInstance(WebSocketFactory.class, (Class) c)); } else if (AtmosphereFramework.class.isAssignableFrom(c)) { // No OPS } else if (EndpointMapper.class.isAssignableFrom(c)) { - fwk.endPointMapper(fwk.newClassInstance(EndpointMapper.class, (Class)c)); + fwk.endPointMapper(fwk.newClassInstance(EndpointMapper.class, (Class) c)); } else { logger.warn("{} is not a framework service that could be installed", c.getName()); } @@ -564,7 +559,7 @@ public AtmosphereFramework(boolean isFilter, boolean autoDetectHandlers) { } /** - * Create an instance of {@link org.atmosphere.cpr.AtmosphereConfig} + * Create an instance of {@link org.atmosphere.runtime.AtmosphereConfig} */ protected AtmosphereConfig newAtmosphereConfig() { return new AtmosphereConfig(this); @@ -610,7 +605,7 @@ public AtmosphereFramework addAtmosphereHandler(String mapping, AtmosphereHandle if (!isInit) { logger.info("Installed AtmosphereHandler {} mapped to context-path: {}", h.getClass().getName(), mapping); logger.info("Installed the following AtmosphereInterceptor mapped to AtmosphereHandler {}", h.getClass().getName()); - if ( !l.isEmpty() ) { + if (!l.isEmpty()) { for (AtmosphereInterceptor s : l) { logger.info("\t{} : {}", s.getClass().getName(), s); } @@ -799,11 +794,6 @@ protected void readSystemProperties() { isCometSupportSpecified = true; } - if (System.getProperty(PROPERTY_BLOCKING_COMETSUPPORT) != null) { - useBlockingImplementation = Boolean - .parseBoolean(System.getProperty(PROPERTY_BLOCKING_COMETSUPPORT)); - isCometSupportSpecified = true; - } atmosphereDotXmlPath = System.getProperty(PROPERTY_ATMOSPHERE_XML, atmosphereDotXmlPath); if (System.getProperty(DISABLE_ONSTATE_EVENT) != null) { @@ -958,11 +948,6 @@ public void run() { isInit = true; config.initComplete(); - // wlc 12.x - if (WebLogicServlet30WithWebSocket.class.isAssignableFrom(asyncSupport.getClass())) { - servletConfig.getServletContext().setAttribute(AtmosphereConfig.class.getName(), config); - } - onPostInit(); return this; @@ -1447,11 +1432,6 @@ protected void doInitParams(ServletConfig sc, boolean reconfigure) { useNativeImplementation = Boolean.parseBoolean(s); if (useNativeImplementation) isCometSupportSpecified = true; } - s = sc.getInitParameter(PROPERTY_BLOCKING_COMETSUPPORT); - if (s != null) { - useBlockingImplementation = Boolean.parseBoolean(s); - if (useBlockingImplementation) isCometSupportSpecified = true; - } s = sc.getInitParameter(PROPERTY_USE_STREAM); if (s != null) { useStreamForFlushingComments = Boolean.parseBoolean(s); @@ -1616,13 +1596,11 @@ protected boolean detectSupportedFramework(ServletConfig sc) throws Exception { sessionSupport(false); initParams.put(DISABLE_ONSTATE_EVENT, "true"); - String mapping = sc.getInitParameter(PROPERTY_SERVLET_MAPPING); + String mapping = sc.getInitParameter(ATMOSPHERE_HANDLER_MAPPING); if (mapping == null) { - mapping = sc.getInitParameter(ATMOSPHERE_HANDLER_MAPPING); - if (mapping == null) { - mapping = Broadcaster.ROOT_MASTER; - } + mapping = Broadcaster.ROOT_MASTER; } + Class bc = (Class) IOUtils.loadClass(getClass(), broadcasterClassName); broadcasterFactory.destroy(); @@ -1736,7 +1714,7 @@ public void initAtmosphereHandler() throws ServletException { checkWebSocketSupportState(); } - public void checkWebSocketSupportState(){ + public void checkWebSocketSupportState() { if (atmosphereHandlers.isEmpty() && !SimpleHttpProtocol.class.isAssignableFrom(webSocketProtocol.getClass())) { logger.debug("Adding a void AtmosphereHandler mapped to /* to allow WebSocket application only"); addAtmosphereHandler(Broadcaster.ROOT_MASTER, new AbstractReflectorAtmosphereHandler() { @@ -1829,7 +1807,7 @@ public AtmosphereFramework destroy() { WebSocketProcessorFactory.getDefault().destroy(); ExecutorsFactory.reset(config); - + // Invoke ShutdownHook. config.destroy(); @@ -2027,7 +2005,7 @@ protected void loadAtmosphereDotXml(InputStream stream, URLClassLoader c) /** * Set the {@link AsyncSupport} implementation. Make sure you don't set an implementation that only works on - * some container. See {@link BlockingIOCometSupport} for an example. + * some container. * * @param asyncSupport */ @@ -2287,29 +2265,8 @@ public Action doCometSupport(AtmosphereRequest req, AtmosphereResponse res) thro configureRequestResponse(req, res); a = asyncSupport.service(req, res); } catch (IllegalStateException ex) { - boolean isJBoss = ex.getMessage() == null ? false : ex.getMessage().startsWith("JBoss failed"); - if (ex.getMessage() != null && (ex.getMessage().startsWith("Tomcat failed") || isJBoss)) { - if (!isFilter) { - logger.warn("Failed using comet support: {}, error: {} Is the NIO or APR Connector enabled?", asyncSupport.getClass().getName(), - ex.getMessage()); - } - logger.error("If you have more than one Connector enabled, make sure they both use the same protocol, " + - "e.g NIO/APR or HTTP for all. If not, {} will be used and cannot be changed.", BlockingIOCometSupport.class.getName(), ex); - - AsyncSupport current = asyncSupport; - asyncSupport = asyncSupport.supportWebSocket() && !isJBoss ? new Tomcat7BIOSupportWithWebSocket(config) : new BlockingIOCometSupport(config); - if (current instanceof AsynchronousProcessor) { - ((AsynchronousProcessor) current).shutdown(); - } - - asyncSupport.init(config.getServletConfig()); - logger.warn("Using " + asyncSupport.getClass().getName()); - - a = asyncSupport.service(req, res); - } else { - logger.error("AtmosphereFramework exception", ex); - throw ex; - } + logger.error("AtmosphereFramework exception", ex); + throw ex; } finally { if (a != null) { notify(a.type(), req, res); @@ -2414,16 +2371,16 @@ public AtmosphereFramework setBroadcasterFactory(final BroadcasterFactory broadc } /** - * Return the {@link org.atmosphere.cpr.BroadcasterCache} class name. + * Return the {@link org.atmosphere.runtime.BroadcasterCache} class name. * - * @return the {@link org.atmosphere.cpr.BroadcasterCache} class name + * @return the {@link org.atmosphere.runtime.BroadcasterCache} class name */ public String getBroadcasterCacheClassName() { return broadcasterCacheClassName; } /** - * Set the {@link org.atmosphere.cpr.BroadcasterCache} class name. + * Set the {@link org.atmosphere.runtime.BroadcasterCache} class name. * * @param broadcasterCacheClassName */ @@ -3275,7 +3232,7 @@ private AtmosphereFramework configureMetaBroadcaster() { } /** - * Get the default {@link org.atmosphere.cpr.Serializer} class name to use for {@link org.atmosphere.cpr.AtmosphereResource}s. + * Get the default {@link org.atmosphere.runtime.Serializer} class name to use for {@link org.atmosphere.runtime.AtmosphereResource}s. * * @return the class name as a string, might be null if not configured */ @@ -3284,7 +3241,7 @@ public String getDefaultSerializerClassName() { } /** - * Get the default {@link org.atmosphere.cpr.Serializer} class to use for {@link org.atmosphere.cpr.AtmosphereResource}s. + * Get the default {@link org.atmosphere.runtime.Serializer} class to use for {@link org.atmosphere.runtime.AtmosphereResource}s. * * @return the class, might be null if not configured */ @@ -3293,7 +3250,7 @@ public Class getDefaultSerializerClass() { } /** - * Set the default {@link org.atmosphere.cpr.Serializer} class name to use for {@link org.atmosphere.cpr.AtmosphereResource}s. + * Set the default {@link org.atmosphere.runtime.Serializer} class name to use for {@link org.atmosphere.runtime.AtmosphereResource}s. * * @param defaultSerializerClassName the class name to use * @return this @@ -3355,9 +3312,9 @@ public boolean isDestroyed() { } /** - * Add a {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * Add a {@link org.atmosphere.runtime.AtmosphereFrameworkListener} * - * @param l {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * @param l {@link org.atmosphere.runtime.AtmosphereFrameworkListener} * @return this; */ public AtmosphereFramework frameworkListener(AtmosphereFrameworkListener l) { @@ -3367,7 +3324,8 @@ public AtmosphereFramework frameworkListener(AtmosphereFrameworkListener l) { /** * Use {@link #atmosphereFrameworkListeners()} - * @return {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * + * @return {@link org.atmosphere.runtime.AtmosphereFrameworkListener} */ @Deprecated public List frameworkListeners() { @@ -3375,9 +3333,9 @@ public List frameworkListeners() { } /** - * Return the list of {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * Return the list of {@link org.atmosphere.runtime.AtmosphereFrameworkListener} * - * @return {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * @return {@link org.atmosphere.runtime.AtmosphereFrameworkListener} */ public Queue atmosphereFrameworkListeners() { return frameworkListeners; @@ -3424,18 +3382,18 @@ protected void onPostDestroy() { } /** - * Return the list of {@link org.atmosphere.cpr.AtmosphereResourceListener} + * Return the list of {@link org.atmosphere.runtime.AtmosphereResourceListener} * - * @return the list of {@link org.atmosphere.cpr.AtmosphereResourceListener} + * @return the list of {@link org.atmosphere.runtime.AtmosphereResourceListener} */ public List atmosphereResourceListeners() { return atmosphereResourceListeners; } /** - * Add a {@link org.atmosphere.cpr.AtmosphereResourceListener} + * Add a {@link org.atmosphere.runtime.AtmosphereResourceListener} * - * @param atmosphereResourceListener a {@link org.atmosphere.cpr.AtmosphereResourceListener} + * @param atmosphereResourceListener a {@link org.atmosphere.runtime.AtmosphereResourceListener} * @return this */ public AtmosphereFramework atmosphereResourceListener(AtmosphereResourceListener atmosphereResourceListener) { @@ -3488,6 +3446,7 @@ public AtmosphereFramework webSocketFactory(WebSocketFactory webSocketFactory) { /** * If a {@link ContainerInitializer} fail, log the excetion here. + * * @param initializationError */ public void initializationError(IllegalStateException initializationError) { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkInitializer.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkInitializer.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkInitializer.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkInitializer.java index 129f01431ca..ce25e26a142 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkInitializer.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkInitializer.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.IOUtils; import org.atmosphere.util.VoidServletConfig; @@ -25,8 +25,8 @@ import javax.servlet.ServletException; import java.util.Map; -import static org.atmosphere.cpr.ApplicationConfig.META_SERVICE_PATH; -import static org.atmosphere.cpr.AtmosphereFramework.META_SERVICE; +import static org.atmosphere.runtime.ApplicationConfig.META_SERVICE_PATH; +import static org.atmosphere.runtime.AtmosphereFramework.META_SERVICE; public class AtmosphereFrameworkInitializer { protected static final Logger logger = LoggerFactory.getLogger(AtmosphereFrameworkInitializer.class); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListener.java similarity index 76% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListener.java index e3412c2f8a5..51c55a75111 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListener.java @@ -13,10 +13,10 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** - * Lifecycle listener for {@link org.atmosphere.cpr.AtmosphereFramework} + * Lifecycle listener for {@link org.atmosphere.runtime.AtmosphereFramework} * * @author Jeanfrancois Arcand */ @@ -24,28 +24,28 @@ public interface AtmosphereFrameworkListener { /** * Invoked before {@link AtmosphereFramework#init()} gets invoked * - * @param f an {@link org.atmosphere.cpr.AtmosphereFramework} + * @param f an {@link org.atmosphere.runtime.AtmosphereFramework} */ void onPreInit(AtmosphereFramework f); /** * Invoked after {@link AtmosphereFramework#init()} gets invoked * - * @param f an {@link org.atmosphere.cpr.AtmosphereFramework} + * @param f an {@link org.atmosphere.runtime.AtmosphereFramework} */ void onPostInit(AtmosphereFramework f); /** * Invoked before {@link AtmosphereFramework#destroy()} gets invoked * - * @param f an {@link org.atmosphere.cpr.AtmosphereFramework} + * @param f an {@link org.atmosphere.runtime.AtmosphereFramework} */ void onPreDestroy(AtmosphereFramework f); /** * Invoked after {@link AtmosphereFramework#destroy()} gets invoked * - * @param f an {@link org.atmosphere.cpr.AtmosphereFramework} + * @param f an {@link org.atmosphere.runtime.AtmosphereFramework} */ void onPostDestroy(AtmosphereFramework f); } diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListenerAdapter.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListenerAdapter.java index 504d4dcfbc7..71435e365c1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFrameworkListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereFrameworkListenerAdapter.java @@ -13,10 +13,10 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** - * Adapter for {@link org.atmosphere.cpr.AtmosphereFrameworkListener} + * Adapter for {@link org.atmosphere.runtime.AtmosphereFrameworkListener} * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereHandler.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereHandler.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereHandler.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereHandler.java index 7b36c03758c..0dc003e0bf7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereHandler.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereHandler.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.io.IOException; @@ -23,7 +23,7 @@ * response can be suspended {@link AtmosphereResource#suspend()} and later resume via {@link AtmosphereResource#resume()}. * Messages can also be shared between suspended responses and their associated {@link AtmosphereHandler} using a * {@link Broadcaster}. Any invocation of {@link Broadcaster#broadcast(java.lang.Object)} will allow a suspended - * response to write the content of the message {@link AtmosphereHandler#onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)}. + * response to write the content of the message {@link AtmosphereHandler#onStateChange(org.atmosphere.runtime.AtmosphereResourceEvent)}. *

    * A class implementing {@link AtmosphereHandler} must be thread safe. *

    diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptor.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptor.java index 1c73784cb45..d043a85e05e 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptor.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.inject.AtmosphereConfigAware; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorAdapter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorAdapter.java index f783a31eec2..04ad528753e 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.interceptor.InvokationOrder; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorWriter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorWriter.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorWriter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorWriter.java index 535df762afb..d1df8cdabba 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereInterceptorWriter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereInterceptorWriter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereMappingException.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereMappingException.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereMappingException.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereMappingException.java index 7587fb1a10f..d0d420efdd1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereMappingException.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereMappingException.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Thrown when {@link AsynchronousProcessor} is unable to map the request to an {@link AtmosphereHandler}. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereObjectFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereObjectFactory.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereObjectFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereObjectFactory.java index c50a0b9765f..6046f25e304 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereObjectFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereObjectFactory.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.inject.AtmosphereConfigAware; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequest.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequest.java index 74ec344232e..f99dc2397ad 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequest.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import javax.servlet.AsyncContext; import javax.servlet.DispatcherType; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequestImpl.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequestImpl.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequestImpl.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequestImpl.java index 834d87b682c..5644e147c0d 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereRequestImpl.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereRequestImpl.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.FakeHttpSession; import org.atmosphere.util.QueryStringDecoder; @@ -24,6 +24,7 @@ import javax.servlet.AsyncContext; import javax.servlet.AsyncListener; import javax.servlet.DispatcherType; +import javax.servlet.ReadListener; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -35,6 +36,7 @@ import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; import javax.servlet.http.Part; import java.io.BufferedReader; @@ -61,7 +63,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE; /** * An Atmosphere request representation. An {@link AtmosphereRequest} is a two-way communication channel between the @@ -584,6 +586,20 @@ public ByteInputStream(byte[] data, int offset, int length) { public int read() throws IOException { return bis.read(); } + + @Override + public boolean isFinished() { + return bis.available() != 0; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + } } @Override @@ -1373,6 +1389,25 @@ public synchronized void reset() throws java.io.IOException { public boolean markSupported() { return innerStream.markSupported(); } + + @Override + public boolean isFinished() { + try { + return innerStream.available() == 0; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + + } } /** @@ -1562,6 +1597,11 @@ public Part getPart(String name) throws IOException, ServletException { return null; } + @Override + public T upgrade(Class aClass) throws IOException, ServletException { + return null; + } + @Override public Collection getParts() throws IOException, ServletException { return EMPTY_ENUM_PART; @@ -1612,6 +1652,11 @@ public HttpSession getSession() { return fake; } + @Override + public String changeSessionId() { + return ""; + } + @Override public HttpSession getSession(boolean create) { if (create && fake == null) { @@ -1698,6 +1743,11 @@ public int getContentLength() { return 0; } + @Override + public long getContentLengthLong() { + return 0; + } + @Override public String getContentType() { return "text/plain"; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResource.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResource.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResource.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResource.java index d391ea32302..14dd43d2eef 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResource.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResource.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import javax.servlet.http.HttpSession; import java.io.IOException; @@ -45,16 +45,16 @@ enum TRANSPORT {POLLING, LONG_POLLING, STREAMING, WEBSOCKET, JSONP, UNDEFINED, S AtmosphereResource resumeOnBroadcast(boolean resumeOnBroadcast); /** - * Return true if the {@link org.atmosphere.cpr.AtmosphereResource#suspend()} has been invoked. + * Return true if the {@link org.atmosphere.runtime.AtmosphereResource#suspend()} has been invoked. * - * @return true if the {@link org.atmosphere.cpr.AtmosphereResource#suspend()} has been invoked + * @return true if the {@link org.atmosphere.runtime.AtmosphereResource#suspend()} has been invoked */ boolean isSuspended(); /** * Return true if this AtmosphereResource is resumed after the first broadcast. * - * @see org.atmosphere.cpr.AtmosphereResource#resumeOnBroadcast() + * @see org.atmosphere.runtime.AtmosphereResource#resumeOnBroadcast() */ boolean resumeOnBroadcast(); @@ -152,14 +152,14 @@ enum TRANSPORT {POLLING, LONG_POLLING, STREAMING, WEBSOCKET, JSONP, UNDEFINED, S List broadcasters(); /** - * Remove this {@link org.atmosphere.cpr.AtmosphereResource} from all {@link org.atmosphere.cpr.Broadcaster} + * Remove this {@link org.atmosphere.runtime.AtmosphereResource} from all {@link org.atmosphere.runtime.Broadcaster} * * @return this */ public AtmosphereResource removeFromAllBroadcasters(); /** - * Set the first {@link Broadcaster} associated with this resource. This {@link org.atmosphere.cpr.Broadcaster} + * Set the first {@link Broadcaster} associated with this resource. This {@link org.atmosphere.runtime.Broadcaster} * will be returned when {@link #getBroadcaster()} is invoked. * * @param broadcaster @@ -168,7 +168,7 @@ enum TRANSPORT {POLLING, LONG_POLLING, STREAMING, WEBSOCKET, JSONP, UNDEFINED, S AtmosphereResource setBroadcaster(Broadcaster broadcaster); /** - * Add/Associate a {@link org.atmosphere.cpr.Broadcaster} with this resource. + * Add/Associate a {@link org.atmosphere.runtime.Broadcaster} with this resource. * * @param broadcaster * @return this @@ -176,7 +176,7 @@ enum TRANSPORT {POLLING, LONG_POLLING, STREAMING, WEBSOCKET, JSONP, UNDEFINED, S AtmosphereResource addBroadcaster(Broadcaster broadcaster); /** - * Remove a {@link org.atmosphere.cpr.Broadcaster} with this resource. + * Remove a {@link org.atmosphere.runtime.Broadcaster} with this resource. * * @param broadcaster * @return this @@ -320,8 +320,8 @@ enum TRANSPORT {POLLING, LONG_POLLING, STREAMING, WEBSOCKET, JSONP, UNDEFINED, S /** * Initialize an {@link AtmosphereResource}. * - * @param config The {@link org.atmosphere.cpr.AtmosphereConfig} - * @param broadcaster The {@link org.atmosphere.cpr.Broadcaster}. + * @param config The {@link org.atmosphere.runtime.AtmosphereConfig} + * @param broadcaster The {@link org.atmosphere.runtime.Broadcaster}. * @param req The {@link AtmosphereRequest} * @param response The {@link AtmosphereResource} * @param asyncSupport The {@link AsyncSupport} diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEvent.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEvent.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEvent.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEvent.java index f543153bde8..b92caeb7762 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEvent.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEvent.java @@ -14,13 +14,13 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * An AtmosphereResourceEvent is created every time an event occurs, like when a * {@link Broadcaster#broadcast(java.lang.Object)} is executed, when a browser remotely closes the connection or * when a suspended resource times out or gets resumed. When such events occur, an instance of that class will be - * created and its associated {@link AtmosphereHandler#onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)} will be invoked. + * created and its associated {@link AtmosphereHandler#onStateChange(org.atmosphere.runtime.AtmosphereResourceEvent)} will be invoked. * * @author Jeanfrancois Arcand */ @@ -86,7 +86,7 @@ public interface AtmosphereResourceEvent { public boolean isClosedByClient(); /** - * Return true if the application closed the connection using {@link org.atmosphere.cpr.AtmosphereResource#close()}. + * Return true if the application closed the connection using {@link org.atmosphere.runtime.AtmosphereResource#close()}. * * @return if the application. */ diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventImpl.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventImpl.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventImpl.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventImpl.java index ee09faaf92e..d60666be020 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventImpl.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventImpl.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListener.java similarity index 80% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListener.java index 98b72771f0a..5f2c669d46a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListener.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Receive notifications when resume, client disconnect or broadcast events occur. Also extends @@ -29,7 +29,7 @@ public interface AtmosphereResourceEventListener extends AtmosphereResourceHeart * but nothing has yet been written on the connection. An implementation could configure the request's headers, * flush some data, etc. during that stage. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onPreSuspend(AtmosphereResourceEvent event); @@ -37,7 +37,7 @@ public interface AtmosphereResourceEventListener extends AtmosphereResourceHeart * Invoked when the {@link AtmosphereResource#suspend} has been completed and the response is * considered as suspended. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onSuspend(AtmosphereResourceEvent event); @@ -45,21 +45,21 @@ public interface AtmosphereResourceEventListener extends AtmosphereResourceHeart * Invoked when the {@link AtmosphereResource#resume} is invoked or when the * suspend's time out expires. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onResume(AtmosphereResourceEvent event); /** * Invoked when the remote connection gets closed. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onDisconnect(AtmosphereResourceEvent event); /** * Invoked when a {@link Broadcaster#broadcast} occurs. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onBroadcast(AtmosphereResourceEvent event); @@ -67,14 +67,14 @@ public interface AtmosphereResourceEventListener extends AtmosphereResourceHeart * Invoked when an operations failed to execute for an unknown reason (eg. IOException because the client * remotely closed the connection, a broken connection, etc.). * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onThrowable(AtmosphereResourceEvent event); /** * Invoked when {@link AtmosphereResource#close} gets called. * - * @param event a {@link org.atmosphere.cpr.AtmosphereResourceEvent} + * @param event a {@link org.atmosphere.runtime.AtmosphereResourceEvent} */ void onClose(AtmosphereResourceEvent event); } diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListenerAdapter.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListenerAdapter.java index 6d347aa8e8d..5d63fca2c83 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceEventListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceEventListenerAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceFactory.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceFactory.java index 74eb0cac4d2..c8c407b746a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceFactory.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.inject.AtmosphereConfigAware; @@ -68,7 +68,7 @@ AtmosphereResource create(AtmosphereConfig config, * @param response an {@link AtmosphereResponse} * @param a {@link AsyncSupport} * @param handler an {@link AtmosphereHandler} - * @param t an {@link org.atmosphere.cpr.AtmosphereResource.TRANSPORT} + * @param t an {@link org.atmosphere.runtime.AtmosphereResource.TRANSPORT} * @return an {@link AtmosphereResourceImpl} */ AtmosphereResource create(AtmosphereConfig config, @@ -136,25 +136,25 @@ AtmosphereResource create(AtmosphereConfig config, /** * Remove the {@link AtmosphereResource} from all instances of {@link Broadcaster}. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return the {@link AtmosphereResource}, or null if not found. */ AtmosphereResource remove(String uuid); /** - * Find an {@link AtmosphereResource} based on its {@link org.atmosphere.cpr.AtmosphereResource#uuid()}. + * Find an {@link AtmosphereResource} based on its {@link org.atmosphere.runtime.AtmosphereResource#uuid()}. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return the {@link AtmosphereResource}, or null if not found. */ AtmosphereResource find(String uuid); /** - * Locate an {@link AtmosphereResource}, based on its {@link org.atmosphere.cpr.AtmosphereResource#uuid()}, in a - * cluster. If the {@link AtmosphereResource} is available in the cluster, the {@link org.atmosphere.cpr.AtmosphereResourceFactory.Async#available} - * callback will be invoked. If not, the {@link org.atmosphere.cpr.AtmosphereResourceFactory.Async#notAvailable} + * Locate an {@link AtmosphereResource}, based on its {@link org.atmosphere.runtime.AtmosphereResource#uuid()}, in a + * cluster. If the {@link AtmosphereResource} is available in the cluster, the {@link org.atmosphere.runtime.AtmosphereResourceFactory.Async#available} + * callback will be invoked. If not, the {@link org.atmosphere.runtime.AtmosphereResourceFactory.Async#notAvailable} * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @param async an {@link Async} */ void locate(String uuid, Async async); @@ -165,9 +165,9 @@ AtmosphereResource create(AtmosphereConfig config, * method is not synchronized and may not return all the {@link Broadcaster} in case * {@link Broadcaster#addAtmosphereResource(AtmosphereResource)} is being called concurrently. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return all {@link Broadcaster} associated with a {@link AtmosphereResource#uuid} - * @deprecated Use {@link org.atmosphere.cpr.AtmosphereResourceFactory#find(String)}.broadcasters() instead + * @deprecated Use {@link org.atmosphere.runtime.AtmosphereResourceFactory#find(String)}.broadcasters() instead */ @Deprecated Set broadcasters(String uuid); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceHeartbeatEventListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceHeartbeatEventListener.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceHeartbeatEventListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceHeartbeatEventListener.java index 5a9106931d2..aa8030cc410 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceHeartbeatEventListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceHeartbeatEventListener.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Receive notifications when heartbeat events occur. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceImpl.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceImpl.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceImpl.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceImpl.java index 0d78d8ad06e..983d1fecebb 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceImpl.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceImpl.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.interceptor.AllowInterceptor; import org.atmosphere.util.Utils; @@ -33,14 +33,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_CREATE; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.AtmosphereResource.TRANSPORT.UNDEFINED; -import static org.atmosphere.cpr.Broadcaster.ROOT_MASTER; -import static org.atmosphere.cpr.HeaderConfig.LONG_POLLING_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_UPGRADE; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRANSPORT; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_SESSION_CREATE; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.AtmosphereResource.TRANSPORT.UNDEFINED; +import static org.atmosphere.runtime.Broadcaster.ROOT_MASTER; +import static org.atmosphere.runtime.HeaderConfig.LONG_POLLING_TRANSPORT; +import static org.atmosphere.runtime.HeaderConfig.WEBSOCKET_UPGRADE; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_ERROR; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRANSPORT; import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.CLOSE; /** @@ -55,7 +55,6 @@ public class AtmosphereResourceImpl implements AtmosphereResource { public static final String PRE_SUSPEND = AtmosphereResourceImpl.class.getName() + ".preSuspend"; public static final String SKIP_BROADCASTER_CREATION = AtmosphereResourceImpl.class.getName() + ".skipBroadcasterCreation"; - public static final String METEOR = Meteor.class.getName(); private AtmosphereRequest req; private AtmosphereResponse response; @@ -103,8 +102,8 @@ public AtmosphereResourceImpl(AtmosphereConfig config, Broadcaster broadcaster, /** * Initialize an {@link AtmosphereResource}. * - * @param config The {@link org.atmosphere.cpr.AtmosphereConfig} - * @param broadcaster The {@link org.atmosphere.cpr.Broadcaster}. + * @param config The {@link org.atmosphere.runtime.AtmosphereConfig} + * @param broadcaster The {@link org.atmosphere.runtime.Broadcaster}. * @param req The {@link AtmosphereRequest} * @param response The {@link AtmosphereResource} * @param asyncSupport The {@link AsyncSupport} @@ -304,7 +303,6 @@ public AtmosphereResource resume() { logger.trace("Wasn't able to resume a connection {}", this, t); } finally { unregister(); - Utils.destroyMeteor(req); } listeners.clear(); return this; @@ -805,15 +803,6 @@ public void cancel() throws IOException { asyncSupport.complete(this); - try { - Object o = req.getAttribute(AtmosphereResourceImpl.METEOR); - if (o != null && Meteor.class.isAssignableFrom(o.getClass())) { - Meteor.class.cast(o).destroy(); - } - } catch (Exception ex) { - logger.trace("Meteor exception {}", ex); - } - SessionTimeoutSupport.restoreTimeout(req); action.type(Action.TYPE.CANCELLED); if (asyncSupport != null) asyncSupport.action(this); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListener.java similarity index 82% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListener.java index e497b18144b..a325ad63cbb 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListener.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Listener for when {@libk AtmosphereResource} gets suspended and disconnected. @@ -23,14 +23,14 @@ public interface AtmosphereResourceListener { /** - * Ibnvoked when the {@link org.atmosphere.cpr.AtmosphereResource} gets suspended + * Ibnvoked when the {@link org.atmosphere.runtime.AtmosphereResource} gets suspended * * @param uuid {@link AtmosphereResource#uuid()} */ void onSuspended(String uuid); /** - * Ibnvoked when the {@link org.atmosphere.cpr.AtmosphereResource} gets disconnected + * Ibnvoked when the {@link org.atmosphere.runtime.AtmosphereResource} gets disconnected * * @param uuid {@link AtmosphereResource#uuid()} */ diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListenerAdapter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListenerAdapter.java index b48a354d8fe..2b00d398e09 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceListenerAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSession.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSession.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSession.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSession.java index a3766c9a04f..778ec3defb0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSession.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSession.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.Collection; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSessionFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSessionFactory.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSessionFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSessionFactory.java index 57a815c0f37..d6f74a5bd55 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResourceSessionFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResourceSessionFactory.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Factory for {@link AtmosphereResourceSession} instances diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponse.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponse.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponse.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponse.java index 1218a8625a8..59e4553d4d2 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponse.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponse.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponseImpl.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponseImpl.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponseImpl.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponseImpl.java index 6451e2cf37c..89fb6c5acba 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereResponseImpl.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereResponseImpl.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.CookieUtil; import org.atmosphere.util.ServletProxyFactory; @@ -23,6 +23,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; +import javax.servlet.WriteListener; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; @@ -46,8 +47,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM; -import static org.atmosphere.cpr.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_USE_STREAM; +import static org.atmosphere.runtime.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; /** * An Atmosphere's response representation. An AtmosphereResponse can be used to construct a bi-directional asynchronous @@ -557,7 +558,17 @@ public ServletOutputStream getOutputStream() throws IOException { if (forceAsyncIOWriter || !delegateToNativeResponse) { return new Stream(isBuffering()); } else { - return _r().getOutputStream() != null ? _r().getOutputStream() : new ServletOutputStream() { + return (_r().getOutputStream() != null) ? _r().getOutputStream() : new ServletOutputStream() { + @Override + public boolean isReady() { + return false; + } + + @Override + public void setWriteListener(WriteListener writeListener) { + + } + @Override public void write(int b) throws IOException { } @@ -1028,6 +1039,16 @@ public void close() throws java.io.IOException { forceAsyncIOWriter = b; } } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setWriteListener(WriteListener writeListener) { + + } } private final class Writer extends PrintWriter { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServlet.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServlet.java index 1956ec1e596..21c6bb7f5fe 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServlet.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServlet.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public AtmosphereServlet() { /** * Create an Atmosphere Servlet. * - * @param isFilter true if this instance is used as an {@link org.atmosphere.cpr.AtmosphereFilter} + * @param isFilter true if this instance is used as an {@link org.atmosphere.runtime.AtmosphereFilter} */ public AtmosphereServlet(boolean isFilter) { this(isFilter, true); @@ -58,7 +58,7 @@ public AtmosphereServlet(boolean isFilter) { /** * Create an Atmosphere Servlet. * - * @param isFilter true if this instance is used as an {@link org.atmosphere.cpr.AtmosphereFilter} + * @param isFilter true if this instance is used as an {@link org.atmosphere.runtime.AtmosphereFilter} * @param autoDetectHandlers */ public AtmosphereServlet(boolean isFilter, boolean autoDetectHandlers) { @@ -94,7 +94,7 @@ public AtmosphereFramework framework() { } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -108,7 +108,7 @@ public void doHead(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport} + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport} * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -122,7 +122,7 @@ public void doOptions(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -136,7 +136,7 @@ public void doTrace(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -150,7 +150,7 @@ public void doDelete(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -164,7 +164,7 @@ public void doPut(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} @@ -178,7 +178,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse res) } /** - * Delegate the request processing to an instance of {@link org.atmosphere.cpr.AsyncSupport}. + * Delegate the request processing to an instance of {@link org.atmosphere.runtime.AsyncSupport}. * * @param req the {@link javax.servlet.http.HttpServletRequest} * @param res the {@link javax.servlet.http.HttpServletResponse} diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServletProcessor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServletProcessor.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServletProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServletProcessor.java index 8e8374030ca..44b5fc67854 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereServletProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereServletProcessor.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import javax.servlet.Servlet; import javax.servlet.ServletConfig; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereSession.java b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereSession.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereSession.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereSession.java index 0a1b9bdbc0a..bd88a1ce2bd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereSession.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/AtmosphereSession.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilter.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilter.java index 1b5f4b1c4ee..f08901c5871 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilter.java @@ -15,10 +15,10 @@ */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** - * Transform a message before it get broadcasted to {@link AtmosphereHandler#onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) }. + * Transform a message before it get broadcasted to {@link AtmosphereHandler#onStateChange(org.atmosphere.runtime.AtmosphereResourceEvent) }. *

    * See {@link org.atmosphere.util.XSSHtmlFilter} for an example. * @@ -88,7 +88,7 @@ void setOriginalMsg(Object originalMsg) { * Transform or filter a message. Return BroadcastAction(ACTION.ABORT, message) * {@link Broadcaster} to discard the message, eg. to not broadcast it. * - * @param broadcasterId the {@link org.atmosphere.cpr.Broadcaster#getID()} calling this object + * @param broadcasterId the {@link org.atmosphere.runtime.Broadcaster#getID()} calling this object * @param originalMessage The original message which was {@link Broadcaster#broadcast(Object)}; * @param message The transformed or not message. * @return a transformed message. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterAdapter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterAdapter.java index 332d4e15b72..cc22d784a77 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Adapter for {@link PerRequestBroadcastFilter}. Both methods return {@link BroadcastAction.ACTION#CONTINUE} with the message. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterLifecycle.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterLifecycle.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterLifecycle.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterLifecycle.java index 8d392e4f979..dc343d9aa23 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcastFilterLifecycle.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcastFilterLifecycle.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Add lifecycle method to the {@link BroadcastFilter} interface. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Broadcaster.java b/modules/runtime/src/main/java/org/atmosphere/runtime/Broadcaster.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/cpr/Broadcaster.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/Broadcaster.java index b58a736c9b6..2061203368a 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Broadcaster.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/Broadcaster.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.net.URI; import java.util.Collection; @@ -26,18 +26,18 @@ /** * A Broadcaster is responsible for delivering messages to its subscribed {@link AtmosphereResource}s, which are * representing suspended responses. {@link AtmosphereResource} can be added using {@link Broadcaster#addAtmosphereResource}, - * so when {@link #broadcast(java.lang.Object)} is executed, {@link AtmosphereHandler#onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)} + * so when {@link #broadcast(java.lang.Object)} is executed, {@link AtmosphereHandler#onStateChange(org.atmosphere.runtime.AtmosphereResourceEvent)} * will be invoked and the suspended connection will have a chance to write the message available using {@link AtmosphereResourceEvent#getMessage()}. *

    * A {@link Broadcaster} will by default use an {@link ExecutorService}, and the number of Threads will be computed * based on the number of cores/CPUs of the OS under which the application runs. Thus invoking - * {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)} will be executed asynchronously so this is + * {@link org.atmosphere.runtime.Broadcaster#broadcast(Object)} will be executed asynchronously so this is * important to wait for the {@link Future#get} to awake/unblock to be guaranteed that the operation has completed. *

    * One final word on Broadcaster: by default, a Broadcaster will broadcast using * all {@link AtmosphereResource} on which the response has been suspended, e.g. {AtmosphereResource#suspend()} * has been invoked. This behavior is configurable and you can configure it by invoking the - * {@link Broadcaster#setScope(org.atmosphere.cpr.Broadcaster.SCOPE)} ):

      + * {@link Broadcaster#setScope(org.atmosphere.runtime.Broadcaster.SCOPE)} ):
        *
      • REQUEST: broadcast events only to the AtmosphereResourceEvent associated with the current request.
      • *
      • APPLICATION: broadcast events to all AtmosphereResourceEvent created for the current web application.
      • *
      • VM: broadcast events to all AtmosphereResourceEvent created inside the current virtual machine.
      • @@ -68,13 +68,13 @@ enum POLICY { /** * Set the maximum number of suspended {@link AtmosphereResource}s. If the maximum is reached, Atmosphere will either - * resume {@link AtmosphereResource} using {@link org.atmosphere.cpr.Broadcaster.POLICY#FIFO} (first in first out) - * or {@link org.atmosphere.cpr.Broadcaster.POLICY#REJECT} the {@link AtmosphereResource}. + * resume {@link AtmosphereResource} using {@link org.atmosphere.runtime.Broadcaster.POLICY#FIFO} (first in first out) + * or {@link org.atmosphere.runtime.Broadcaster.POLICY#REJECT} the {@link AtmosphereResource}. *

        * By default the number is unlimited. * * @param maxSuspended maximum number of suspended AtmosphereResource - * @oaram policy the {@link org.atmosphere.cpr.Broadcaster.POLICY} + * @oaram policy the {@link org.atmosphere.runtime.Broadcaster.POLICY} */ void setSuspendPolicy(long maxSuspended, POLICY policy); @@ -145,7 +145,7 @@ enum POLICY { /** * Broadcast the {@link Object} when an {@link AtmosphereResource} is resumed by a timeout or when using - * {@link org.atmosphere.cpr.AtmosphereResource#resume()}. + * {@link org.atmosphere.runtime.AtmosphereResource#resume()}. * * @param o the {@link Object} to be broadcasted * @return a {@link Future} that can be used to synchronize using the {@link Future#get()} @@ -207,7 +207,7 @@ enum POLICY { * Return an {@link List} of {@link AtmosphereResource}. * * @return {@link List} of {@link AtmosphereResource} associated with this {@link Broadcaster}. - * @see org.atmosphere.cpr.Broadcaster#addAtmosphereResource(AtmosphereResource) + * @see org.atmosphere.runtime.Broadcaster#addAtmosphereResource(AtmosphereResource) */ Collection getAtmosphereResources(); @@ -253,17 +253,17 @@ enum POLICY { public void releaseExternalResources(); /** - * Set the {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy}. Make sure you are selecting the right policy + * Set the {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy}. Make sure you are selecting the right policy * to avoid unexpected situations. * - * @param policy a {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy} + * @param policy a {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy} */ public void setBroadcasterLifeCyclePolicy(BroadcasterLifeCyclePolicy policy); /** - * Get the {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy}. + * Get the {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy}. * - * @return {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy} + * @return {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy} */ public BroadcasterLifeCyclePolicy getBroadcasterLifeCyclePolicy(); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCache.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCache.java similarity index 88% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCache.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCache.java index bc1c2dbbf41..e0305659969 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCache.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCache.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.BroadcastMessage; import org.atmosphere.cache.BroadcasterCacheInspector; @@ -59,7 +59,7 @@ *

        * Implementations of this interface must be thread-safe. *

        - * A BroadcasterCache can be configured by invoking {@link org.atmosphere.cpr.BroadcasterConfig#setBroadcasterCache(BroadcasterCache)}, by + * A BroadcasterCache can be configured by invoking {@link org.atmosphere.runtime.BroadcasterConfig#setBroadcasterCache(BroadcasterCache)}, by * defining it in your web/application.xml or by using the {@link org.atmosphere.config.service.BroadcasterCacheService} annotation. * * @author Jeanfrancois Arcand @@ -99,8 +99,8 @@ public interface BroadcasterCache extends AtmosphereConfigAware { * Retrieve messages associated with {@link AtmosphereResource}. * * - * @param id The associated {@link org.atmosphere.cpr.Broadcaster#addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource).getID} - * @param uuid {@link org.atmosphere.cpr.AtmosphereResource} + * @param id The associated {@link org.atmosphere.runtime.Broadcaster#addAtmosphereResource(org.atmosphere.runtime.AtmosphereResource).getID} + * @param uuid {@link org.atmosphere.runtime.AtmosphereResource} * @return a {@link List} of messages (String). */ List retrieveFromCache(String id, String uuid); @@ -108,8 +108,8 @@ public interface BroadcasterCache extends AtmosphereConfigAware { /** * Remove the previously cached message. * - * @param broadcasterId The {@link org.atmosphere.cpr.Broadcaster#getID()} - * @param uuid an {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param broadcasterId The {@link org.atmosphere.runtime.Broadcaster#getID()} + * @param uuid an {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @param cache the {@link CacheMessage} */ BroadcasterCache clearCache(String broadcasterId, String uuid, CacheMessage cache); @@ -118,18 +118,18 @@ public interface BroadcasterCache extends AtmosphereConfigAware { * Allow an application to exclude, or block, an {@link AtmosphereResource} to received cached message. * No new message will get sent to this client except the ones already cached. * - * @param broadcasterId The {@link org.atmosphere.cpr.Broadcaster#getID()} + * @param broadcasterId The {@link org.atmosphere.runtime.Broadcaster#getID()} * @param r an {@link AtmosphereResource} * @return this */ BroadcasterCache excludeFromCache(String broadcasterId, AtmosphereResource r); /** - * Add a {@link org.atmosphere.cpr.AtmosphereResource#uuid()} to the list of active {@link org.atmosphere.cpr.AtmosphereResource} + * Add a {@link org.atmosphere.runtime.AtmosphereResource#uuid()} to the list of active {@link org.atmosphere.runtime.AtmosphereResource} * Message will be cached for the resource associated with the uuid. * - * @param broadcasterId The {@link org.atmosphere.cpr.Broadcaster#getID()} - * @param uuid an {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param broadcasterId The {@link org.atmosphere.runtime.Broadcaster#getID()} + * @param uuid an {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return this */ BroadcasterCache cacheCandidate(String broadcasterId, String uuid); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCacheListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCacheListener.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCacheListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCacheListener.java index aae535dbb90..3eef00e3da3 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterCacheListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterCacheListener.java @@ -13,12 +13,12 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.CacheMessage; /** - * Listener for {@link org.atmosphere.cpr.BroadcasterCache} + * Listener for {@link org.atmosphere.runtime.BroadcasterCache} */ public interface BroadcasterCacheListener { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterConfig.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterConfig.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterConfig.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterConfig.java index 705ca563f1e..112d3e53131 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterConfig.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterConfig.java @@ -15,10 +15,10 @@ */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.BroadcasterCacheInspector; -import org.atmosphere.cpr.BroadcastFilter.BroadcastAction; +import org.atmosphere.runtime.BroadcastFilter.BroadcastAction; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.IOUtils; import org.slf4j.Logger; @@ -205,7 +205,7 @@ public BroadcasterConfig setExecutorService(ExecutorService executorService) { * * @param executorService to be used when broadcasting. * @param isExecutorShared true if the life cycle of the {@link ExecutorService} will be executed by the application. - * It means Atmosphere will NOT invoke the shutdown method when {@link org.atmosphere.cpr.BroadcasterConfig#destroy()} + * It means Atmosphere will NOT invoke the shutdown method when {@link org.atmosphere.runtime.BroadcasterConfig#destroy()} * is invoked. */ public BroadcasterConfig setExecutorService(ExecutorService executorService, boolean isExecutorShared) { @@ -229,7 +229,7 @@ public ExecutorService getExecutorService() { /** * Set an {@link ExecutorService} which can be used to write - * {@link org.atmosphere.cpr.AtmosphereResourceEvent#getMessage()}. By default, the result of {@link ExecutorsFactory#getAsyncOperationExecutor(AtmosphereConfig, String)} + * {@link org.atmosphere.runtime.AtmosphereResourceEvent#getMessage()}. By default, the result of {@link ExecutorsFactory#getAsyncOperationExecutor(AtmosphereConfig, String)} * is used if this method is not invoked. * * @param asyncWriteService to be used when writing events. @@ -240,12 +240,12 @@ public BroadcasterConfig setAsyncWriteService(ExecutorService asyncWriteService) /** * Set an {@link ExecutorService} which can be used to write - * {@link org.atmosphere.cpr.AtmosphereResourceEvent#getMessage()}. By default, the result of {@link ExecutorsFactory#getAsyncOperationExecutor(AtmosphereConfig, String)} + * {@link org.atmosphere.runtime.AtmosphereResourceEvent#getMessage()}. By default, the result of {@link ExecutorsFactory#getAsyncOperationExecutor(AtmosphereConfig, String)} * is used if this method is not invoked. * * @param asyncWriteService to be used when writing events. * @param isAsyncExecutorShared true if the life cycle of the {@link ExecutorService} will be executed by the application. - * It means Atmosphere will NOT invoke the shutdown method when this {@link org.atmosphere.cpr.BroadcasterConfig#destroy()} + * It means Atmosphere will NOT invoke the shutdown method when this {@link org.atmosphere.runtime.BroadcasterConfig#destroy()} * is invoked. */ public BroadcasterConfig setAsyncWriteService(ExecutorService asyncWriteService, boolean isAsyncExecutorShared) { @@ -591,7 +591,7 @@ public AtmosphereConfig getAtmosphereConfig() { } /** - * Manipulate the message before and after they are getting filtered by {@link org.atmosphere.cpr.BroadcastFilter} + * Manipulate the message before and after they are getting filtered by {@link org.atmosphere.runtime.BroadcastFilter} */ public static interface FilterManipulator { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFactory.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFactory.java index 6c23e6550cb..4d2aa8d31f0 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFactory.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.Collection; @@ -28,9 +28,9 @@ public interface BroadcasterFactory { /** * Configure the factory * - * @param clazz {@link org.atmosphere.cpr.Broadcaster} - * @param broadcasterLifeCyclePolicy {@link org.atmosphere.cpr.BroadcasterLifeCyclePolicy} - * @param c {@link org.atmosphere.cpr.AtmosphereConfig} + * @param clazz {@link org.atmosphere.runtime.Broadcaster} + * @param broadcasterLifeCyclePolicy {@link org.atmosphere.runtime.BroadcasterLifeCyclePolicy} + * @param c {@link org.atmosphere.runtime.AtmosphereConfig} */ public void configure(Class clazz, String broadcasterLifeCyclePolicy, AtmosphereConfig c); @@ -142,25 +142,25 @@ public interface BroadcasterFactory { Collection lookupAll(); /** - * Add a {@link org.atmosphere.cpr.BroadcasterListener} + * Add a {@link org.atmosphere.runtime.BroadcasterListener} * - * @param b a {@link org.atmosphere.cpr.BroadcasterListener} + * @param b a {@link org.atmosphere.runtime.BroadcasterListener} * @return this */ BroadcasterFactory addBroadcasterListener(BroadcasterListener b); /** - * Remove a {@link org.atmosphere.cpr.BroadcasterListener} + * Remove a {@link org.atmosphere.runtime.BroadcasterListener} * - * @param b a {@link org.atmosphere.cpr.BroadcasterListener} + * @param b a {@link org.atmosphere.runtime.BroadcasterListener} * @return this */ BroadcasterFactory removeBroadcasterListener(BroadcasterListener b); /** - * Return all {@link org.atmosphere.cpr.BroadcasterListener} + * Return all {@link org.atmosphere.runtime.BroadcasterListener} * - * @return {@link org.atmosphere.cpr.BroadcasterListener} + * @return {@link org.atmosphere.runtime.BroadcasterListener} */ Collection broadcasterListeners(); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFuture.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFuture.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFuture.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFuture.java index ca9824bd7b1..4dd67947273 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterFuture.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterFuture.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicy.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicy.java similarity index 79% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicy.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicy.java index 06f504e12d5..15d2300e472 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicy.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicy.java @@ -13,13 +13,13 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.concurrent.TimeUnit; /** - * This class can be used to configure the life cycle of a {@link org.atmosphere.cpr.Broadcaster}, eg. when a broadcaster - * gets destroyed {@link org.atmosphere.cpr.Broadcaster#destroy()} or when its associated resources + * This class can be used to configure the life cycle of a {@link org.atmosphere.runtime.Broadcaster}, eg. when a broadcaster + * gets destroyed {@link org.atmosphere.runtime.Broadcaster#destroy()} or when its associated resources * are released {@link Broadcaster#releaseExternalResources()}. * * @author Jeanfrancois Arcand @@ -38,14 +38,14 @@ public enum ATMOSPHERE_RESOURCE_POLICY { /** * Release all resources associated with the Broadcaster when the idle time expires. Suspended {@link AtmosphereResource} * will NOT get resumed. - * {@link org.atmosphere.cpr.Broadcaster#releaseExternalResources()} will be invoked. + * {@link org.atmosphere.runtime.Broadcaster#releaseExternalResources()} will be invoked. */ IDLE, /** * Release all resources associated with the Broadcaster when the idle time expires and destroy the Broadcaster. - * This operation removes the Broadcaster from it's associated {@link org.atmosphere.cpr.BroadcasterFactory} - * {@link org.atmosphere.cpr.Broadcaster#destroy()} will be invoked. Suspended {@link AtmosphereResource} + * This operation removes the Broadcaster from it's associated {@link org.atmosphere.runtime.BroadcasterFactory} + * {@link org.atmosphere.runtime.Broadcaster#destroy()} will be invoked. Suspended {@link AtmosphereResource} * will NOT get resumed. */ IDLE_DESTROY, @@ -57,20 +57,20 @@ public enum ATMOSPHERE_RESOURCE_POLICY { IDLE_RESUME, /** - * If there is no {@link org.atmosphere.cpr.AtmosphereResource} associated with the Broadcaster, + * If there is no {@link org.atmosphere.runtime.AtmosphereResource} associated with the Broadcaster, * release all resources. - * {@link org.atmosphere.cpr.Broadcaster#releaseExternalResources()} will be invoked. + * {@link org.atmosphere.runtime.Broadcaster#releaseExternalResources()} will be invoked. */ EMPTY, /** - * If there is no {@link org.atmosphere.cpr.AtmosphereResource} associated with the Broadcaster, release all resources, - * and destroy the broadcaster. This operation removes the Broadcaster from its associated {@link org.atmosphere.cpr.BroadcasterFactory} - * {@link org.atmosphere.cpr.Broadcaster#destroy()} will be invoked + * If there is no {@link org.atmosphere.runtime.AtmosphereResource} associated with the Broadcaster, release all resources, + * and destroy the broadcaster. This operation removes the Broadcaster from its associated {@link org.atmosphere.runtime.BroadcasterFactory} + * {@link org.atmosphere.runtime.Broadcaster#destroy()} will be invoked */ EMPTY_DESTROY, /** - * Never release or destroy the {@link org.atmosphere.cpr.Broadcaster}. + * Never release or destroy the {@link org.atmosphere.runtime.Broadcaster}. */ NEVER diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListener.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListener.java index 7060dba5738..0f4cfad0879 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListener.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Simple listener to be used to track {@link BroadcasterLifeCyclePolicy} events. @@ -34,7 +34,7 @@ public interface BroadcasterLifeCyclePolicyListener { void onIdle(); /** - * Both {@link org.atmosphere.cpr.Broadcaster#releaseExternalResources()} and {@link org.atmosphere.cpr.Broadcaster#destroy()} + * Both {@link org.atmosphere.runtime.Broadcaster#releaseExternalResources()} and {@link org.atmosphere.runtime.Broadcaster#destroy()} * are about to be invoked. */ void onDestroy(); diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListenerAdapter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListenerAdapter.java index 8e4ed0426d9..6a842e45a48 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterLifeCyclePolicyListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterLifeCyclePolicyListenerAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListener.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListener.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListener.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListener.java index aecbed506a1..3f5fa18d4fd 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListener.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * A listener for a {@link Broadcaster}'s event lifecycle. @@ -30,7 +30,7 @@ public interface BroadcasterListener { void onPostCreate(Broadcaster b); /** - * Invoked when the Broadcast operation completes for all {@link org.atmosphere.cpr.AtmosphereResource}. + * Invoked when the Broadcast operation completes for all {@link org.atmosphere.runtime.AtmosphereResource}. * * @param b a Broadcaster */ @@ -67,7 +67,7 @@ public interface BroadcasterListener { void onMessage(Broadcaster b, Deliver deliver); /** - * Throw this exception to interrupt the {@link org.atmosphere.cpr.Broadcaster#destroy()} operation. + * Throw this exception to interrupt the {@link org.atmosphere.runtime.Broadcaster#destroy()} operation. */ public final static class BroadcastListenerException extends RuntimeException { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListenerAdapter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListenerAdapter.java index b6093ef55a9..68612700204 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/BroadcasterListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/BroadcasterListenerAdapter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/ClusterBroadcastFilter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/ClusterBroadcastFilter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/ClusterBroadcastFilter.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/ClusterBroadcastFilter.java index 587298cb031..89475db462e 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/ClusterBroadcastFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/ClusterBroadcastFilter.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** * Specialize {@link BroadcastFilter} used when clustering is enabled. diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/CompletionAware.java b/modules/runtime/src/main/java/org/atmosphere/runtime/CompletionAware.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/cpr/CompletionAware.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/CompletionAware.java index da1f9b7f315..240ccff3c26 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/CompletionAware.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/CompletionAware.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/ContainerInitializer.java b/modules/runtime/src/main/java/org/atmosphere/runtime/ContainerInitializer.java similarity index 73% rename from modules/cpr/src/main/java/org/atmosphere/cpr/ContainerInitializer.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/ContainerInitializer.java index 46ed8bdd8b5..b920fd4ce37 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/ContainerInitializer.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/ContainerInitializer.java @@ -13,9 +13,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.GlassFishServ30WebSocketSupport; import org.atmosphere.container.JSR356AsyncSupport; import org.atmosphere.util.IOUtils; import org.atmosphere.util.Utils; @@ -31,14 +30,14 @@ import java.util.Map; import java.util.Set; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_SUPPORT; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_SESSION_SUPPORT; /** * Initializer for the AtmosphereFramework per servlet instance, * this initializer is called during web-application startup lifecycle (since Servlet 3.0). * If you need to disable automatic initialization take a look at the following switch: *

        - * {@link org.atmosphere.cpr.ApplicationConfig}.DISABLE_ATMOSPHERE_INITIALIZER} + * {@link org.atmosphere.runtime.ApplicationConfig}.DISABLE_ATMOSPHERE_INITIALIZER} */ @HandlesTypes({}) @@ -61,32 +60,11 @@ public void onStartup(Set> classes, final ServletContext c) throws Serv DefaultAsyncSupportResolver resolver = new DefaultAsyncSupportResolver(framework.getAtmosphereConfig()); List> l = resolver.detectWebSocketPresent(false, true); - // Don't use WebLogic Native WebSocket support if JSR356 is available - int size = c.getServerInfo().toLowerCase().contains("weblogic") ? 1 : 0; - - String s = reg.getValue().getInitParameter(ApplicationConfig.PROPERTY_COMET_SUPPORT); - boolean force = c.getServerInfo().toLowerCase().contains("glassfish"); - if (s != null && s.equals(JSR356AsyncSupport.class.getName())) { - force = true; - } else if (s != null) { - force = false; - } - - if (force || l.size() == size && resolver.testClassExists(DefaultAsyncSupportResolver.JSR356_WEBSOCKET)) { + if (resolver.testClassExists(DefaultAsyncSupportResolver.JSR356_WEBSOCKET)) { try { framework.setAsyncSupport(new JSR356AsyncSupport(framework.getAtmosphereConfig(), c)); } catch (IllegalStateException ex) { - /** - * For an unknown reason, when PrimneFaces Showcase is deployed in GlassFish, - * the ServerContainer is always null. - * For Native usage - */ - if (c.getServerInfo().toLowerCase().contains("glassfish")) { - framework.setAsyncSupport(new GlassFishServ30WebSocketSupport(framework.getAtmosphereConfig(), c)); - framework.initializationError(null); - } else { - framework.initializationError(ex); - } + framework.initializationError(ex); } } @@ -110,7 +88,7 @@ public void requestInitialized(ServletRequestEvent sre) { } try { - s = c.getInitParameter(PROPERTY_SESSION_SUPPORT); + String s = c.getInitParameter(PROPERTY_SESSION_SUPPORT); if (s != null) { boolean sessionSupport = Boolean.valueOf(s); if (sessionSupport && c.getMajorVersion() > 2) { diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAnnotationProcessor.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAnnotationProcessor.java similarity index 99% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAnnotationProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAnnotationProcessor.java index 5541aaf6248..5318845a547 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAnnotationProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAnnotationProcessor.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.config.AtmosphereAnnotation; import org.atmosphere.config.service.AsyncSupportListenerService; @@ -72,7 +72,7 @@ public class DefaultAnnotationProcessor implements AnnotationProcessor { /** * The attribute name under which the annotations are stored in the servlet context. */ - public static final String ANNOTATION_ATTRIBUTE = "org.atmosphere.cpr.ANNOTATION_MAP"; + public static final String ANNOTATION_ATTRIBUTE = "org.atmosphere.runtime.ANNOTATION_MAP"; // Annotation in java is broken. private static final Class[] coreAnnotations = { diff --git a/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAsyncSupportResolver.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAsyncSupportResolver.java new file mode 100644 index 00000000000..46ecd908c21 --- /dev/null +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAsyncSupportResolver.java @@ -0,0 +1,179 @@ +/* + * Copyright 2017 Async-IO.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + + +package org.atmosphere.runtime; + +import org.atmosphere.container.JSR356AsyncSupport; +import org.atmosphere.container.NettyCometSupport; +import org.atmosphere.util.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.LinkedList; +import java.util.List; + +/** + * This is the default implementation of @link {AsyncSupportResolver}. + * + * @author Viktor Klang + */ +public class DefaultAsyncSupportResolver implements AsyncSupportResolver { + + private static final Logger logger = LoggerFactory.getLogger(DefaultAsyncSupportResolver.class); + + public final static String SERVLET_30 = "javax.servlet.AsyncListener"; + public final static String NETTY = "org.jboss.netty.channel.Channel"; + public final static String JSR356_WEBSOCKET = "javax.websocket.Endpoint"; + + private final AtmosphereConfig config; + + public DefaultAsyncSupportResolver(final AtmosphereConfig config) { + this.config = config; + } + + /** + * Convenience method that tests if a class with the given FQN is present on the classpath. + * + * @param testClass + * @return true if the class is present + */ + protected boolean testClassExists(final String testClass) { + try { + final boolean exists = testClass != null && testClass.length() > 0 && IOUtils.loadClass(null, testClass) != null; + logger.debug(exists ? "Found {}" : "Not found {}", testClass); + return exists; + } catch (Exception ex) { + return false; + } + } + + /** + * Returns a list of comet support by containers available on the classpath. + * + * @return + */ + public List> detectContainersPresent() { + return new LinkedList>() { + { + if (testClassExists(NETTY)) + add(NettyCometSupport.class); + } + }; + } + + public List> detectWebSocketPresent(final boolean useNativeIfPossible, final boolean useServlet30Async) { + + return new LinkedList>() { + { + add(JSR356AsyncSupport.class); + } + }; + } + + /** + * Given a Class of something that extends AsyncSupport, it tries to return an instance of that class. + *

        + * The class has to have a visible constructor with the signature (@link {AtmosphereConfig}). + * + * @param targetClass + * @return an instance of the specified class or null if the class cannot be instantiated + */ + public AsyncSupport newCometSupport(final Class targetClass) { + try { + return targetClass.getDeclaredConstructor(new Class[]{AtmosphereConfig.class}) + .newInstance(config); + } catch (final Exception e) { + logger.warn("Failed to create AsyncSupport class: {}, error: {}", targetClass, e); + + Throwable cause = e.getCause(); + if (cause != null) { + logger.error("Real error: {}", cause.getMessage(), cause); + } + return null; + } + } + + public AsyncSupport newCometSupport(final String targetClassFQN) { + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + return (AsyncSupport) cl.loadClass(targetClassFQN) + .getDeclaredConstructor(new Class[]{AtmosphereConfig.class}).newInstance(config); + } catch (final Exception e) { + logger.error("Failed to create AsyncSupport class: {}, error: {}", targetClassFQN, e); + Throwable cause = e.getCause(); + if (cause != null) { + logger.error("Real error: {}", cause.getMessage(), cause); + } + throw new IllegalArgumentException("Unable to create " + targetClassFQN, e); + } + } + + @Override + public AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking, boolean useServlet30Async) { + AsyncSupport cs = null; + + // Validate the value for old Servlet Container. + useServlet30Async = testClassExists(SERVLET_30); + + if (!defaultToBlocking) { + List> l = detectWebSocketPresent(useNativeIfPossible, useServlet30Async); + + if (!l.isEmpty()) { + cs = resolveWebSocket(l); + } + } + + if (cs == null) { + return resolveNativeCometSupport(detectContainersPresent()); + } else { + return cs; + } + } + + public AsyncSupport resolveWebSocket(final java.util.List> available) { + if (available == null || available.isEmpty()) return null; + else return newCometSupport(available.get(0)); + } + + /** + * This method is called to determine which native comet support to the used. + * + * @param available + * @return the result of @link {resolveMultipleNativeSupportConflict} if there are more than 1 item in the list of available ontainers + */ + protected AsyncSupport resolveNativeCometSupport(final java.util.List> available) { + if (available == null || available.isEmpty()) return null; + else if (available.size() == 1) return newCometSupport(available.get(0)); + else return resolveMultipleNativeSupportConflict(available); + } + + /** + * This method is called if there are more than one potential native container in scope. + * + * @return a AsyncSupport instance + */ + protected AsyncSupport resolveMultipleNativeSupportConflict(final List> available) { + final StringBuilder b = new StringBuilder("Found multiple containers, please specify which one to use: "); + for (Class cs : available) { + b.append((cs != null) ? cs.getCanonicalName() : "null").append(", "); + } + + b.append(" until you do, Atmosphere will use:" + available.get(0)); + logger.warn("{}", b.toString()); + return newCometSupport(available.get(0)); + } +} \ No newline at end of file diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceFactory.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceFactory.java index 4c2f359927d..279a4a8487f 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceFactory.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; import org.slf4j.Logger; @@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRANSPORT; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRANSPORT; /** * A Factory used to manage {@link AtmosphereResource} instances. You can use this factory to create, remove and find @@ -129,7 +129,7 @@ public AtmosphereResource create(AtmosphereConfig config, * @param response an {@link AtmosphereResponse} * @param a {@link AsyncSupport} * @param handler an {@link AtmosphereHandler} - * @param t an {@link org.atmosphere.cpr.AtmosphereResource.TRANSPORT} + * @param t an {@link org.atmosphere.runtime.AtmosphereResource.TRANSPORT} * @return an {@link AtmosphereResourceImpl} */ @Override @@ -249,7 +249,7 @@ public AtmosphereResource create(AtmosphereConfig config, String uuid, Atmospher /** * Remove the {@link AtmosphereResource} from all instances of {@link Broadcaster}. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return the {@link AtmosphereResource}, or null if not found. */ @Override @@ -263,9 +263,9 @@ public AtmosphereResource remove(String uuid) { } /** - * Find an {@link AtmosphereResource} based on its {@link org.atmosphere.cpr.AtmosphereResource#uuid()}. + * Find an {@link AtmosphereResource} based on its {@link org.atmosphere.runtime.AtmosphereResource#uuid()}. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return the {@link AtmosphereResource}, or null if not found. */ @Override @@ -288,9 +288,9 @@ public void locate(String uuid, Async async) { * method is not synchronized and may not return all the {@link Broadcaster} in case * {@link Broadcaster#addAtmosphereResource(AtmosphereResource)} is being called concurrently. * - * @param uuid the {@link org.atmosphere.cpr.AtmosphereResource#uuid()} + * @param uuid the {@link org.atmosphere.runtime.AtmosphereResource#uuid()} * @return all {@link Broadcaster} associated with a {@link AtmosphereResource#uuid} - * @deprecated Use {@link org.atmosphere.cpr.AtmosphereResourceFactory#find(String)}.broadcasters() instead + * @deprecated Use {@link org.atmosphere.runtime.AtmosphereResourceFactory#find(String)}.broadcasters() instead */ @Override @Deprecated diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSession.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSession.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSession.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSession.java index 2f804dd0296..d8c1c3d781e 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSession.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSession.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.Collection; import java.util.Collections; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactory.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactory.java index 5bfac0f6f24..e0ccbf8d253 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactory.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcaster.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcaster.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcaster.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcaster.java index 23f427f11a1..3bbea4fe958 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcaster.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcaster.java @@ -14,11 +14,11 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.BroadcastMessage; import org.atmosphere.cache.CacheMessage; -import org.atmosphere.cpr.BroadcastFilter.BroadcastAction; +import org.atmosphere.runtime.BroadcastFilter.BroadcastAction; import org.atmosphere.lifecycle.LifecycleHandler; import org.atmosphere.pool.PoolableBroadcasterFactory; import org.atmosphere.util.Utils; @@ -49,17 +49,17 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import static org.atmosphere.cpr.ApplicationConfig.BACKWARD_COMPATIBLE_WEBSOCKET_BEHAVIOR; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_CACHE_STRATEGY; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_SHAREABLE_LISTENERS; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_WAIT_TIME; -import static org.atmosphere.cpr.ApplicationConfig.CACHE_MESSAGE_ON_IO_FLUSH_EXCEPTION; -import static org.atmosphere.cpr.ApplicationConfig.MAX_INACTIVE; -import static org.atmosphere.cpr.ApplicationConfig.OUT_OF_ORDER_BROADCAST; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.ApplicationConfig.WRITE_TIMEOUT; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.NEVER; -import static org.atmosphere.cpr.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; +import static org.atmosphere.runtime.ApplicationConfig.BACKWARD_COMPATIBLE_WEBSOCKET_BEHAVIOR; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_CACHE_STRATEGY; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_SHAREABLE_LISTENERS; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_WAIT_TIME; +import static org.atmosphere.runtime.ApplicationConfig.CACHE_MESSAGE_ON_IO_FLUSH_EXCEPTION; +import static org.atmosphere.runtime.ApplicationConfig.MAX_INACTIVE; +import static org.atmosphere.runtime.ApplicationConfig.OUT_OF_ORDER_BROADCAST; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.ApplicationConfig.WRITE_TIMEOUT; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.NEVER; +import static org.atmosphere.runtime.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; /** * The default {@link Broadcaster} implementation. @@ -304,9 +304,9 @@ public synchronized void setID(String id) { } /** - * Rename this Broadcaster without invoking it's associated {@link org.atmosphere.cpr.BroadcasterFactory}. This + * Rename this Broadcaster without invoking it's associated {@link org.atmosphere.runtime.BroadcasterFactory}. This * method must be carefully used as it could easily create memory leak as the Broadcaster won't be removed - * from its {@link org.atmosphere.cpr.BroadcasterFactory}. + * from its {@link org.atmosphere.runtime.BroadcasterFactory}. * * @param id the new name * @return this; diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcasterFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcasterFactory.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcasterFactory.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcasterFactory.java index 1a403932a7b..60e93243ad3 100755 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultBroadcasterFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultBroadcasterFactory.java @@ -14,7 +14,7 @@ * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.lifecycle.BroadcasterLifecyclePolicyHandler; import org.slf4j.Logger; @@ -27,14 +27,14 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_POLICY; -import static org.atmosphere.cpr.ApplicationConfig.BROADCASTER_POLICY_TIMEOUT; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY_DESTROY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_RESUME; -import static org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.NEVER; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_POLICY; +import static org.atmosphere.runtime.ApplicationConfig.BROADCASTER_POLICY_TIMEOUT; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.EMPTY_DESTROY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_RESUME; +import static org.atmosphere.runtime.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.NEVER; /** * This class is responsible for creating {@link Broadcaster} instances. You can also add and remove {@link Broadcaster} diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultMetaBroadcaster.java b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultMetaBroadcaster.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/cpr/DefaultMetaBroadcaster.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/DefaultMetaBroadcaster.java index 16cf469eec1..7e601304b61 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/DefaultMetaBroadcaster.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/DefaultMetaBroadcaster.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.uri.UriTemplate; import org.slf4j.Logger; @@ -33,7 +33,7 @@ import java.util.concurrent.TimeoutException; /** - * Broadcast events to all or a subset of available {@link Broadcaster}s based on their {@link org.atmosphere.cpr.Broadcaster#getID()} value. + * Broadcast events to all or a subset of available {@link Broadcaster}s based on their {@link org.atmosphere.runtime.Broadcaster#getID()} value. * This class allows broadcasting events to a set of broadcasters that maps to some String like: *

          *        // Broadcast the event to all Broadcaster ID starting with /hello
        @@ -47,7 +47,7 @@
          * 

        * This class is NOT thread safe. *

        - * If you want to use MetaBroadcaster with Jersey or any framework, make sure all {@link org.atmosphere.cpr.Broadcaster#getID()} + * If you want to use MetaBroadcaster with Jersey or any framework, make sure all {@link org.atmosphere.runtime.Broadcaster#getID()} * starts with '/'. For example, with Jersey: *

          *
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Deliver.java b/modules/runtime/src/main/java/org/atmosphere/runtime/Deliver.java
        similarity index 99%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/Deliver.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/Deliver.java
        index 5dfd38b45c3..42efc9f4170 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Deliver.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/Deliver.java
        @@ -13,7 +13,7 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.atmosphere.cache.CacheMessage;
         
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/FrameworkConfig.java b/modules/runtime/src/main/java/org/atmosphere/runtime/FrameworkConfig.java
        similarity index 96%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/FrameworkConfig.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/FrameworkConfig.java
        index 7dc790ccd8f..96917002a27 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/FrameworkConfig.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/FrameworkConfig.java
        @@ -13,9 +13,9 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
        -import org.atmosphere.cpr.AtmosphereFramework.AtmosphereHandlerWrapper;
        +import org.atmosphere.runtime.AtmosphereFramework.AtmosphereHandlerWrapper;
         import org.atmosphere.inject.InjectIntrospector;
         import org.atmosphere.interceptor.JavaScriptProtocol;
         import org.atmosphere.websocket.WebSocketProcessor;
        @@ -69,7 +69,7 @@ public interface FrameworkConfig {
             /**
              * A request attribute used to lookup the {@link AtmosphereServlet}. This attribute is for framework integrators and not recommend for normal applications.
              */
        -    String ATMOSPHERE_SERVLET = "org.atmosphere.cpr.AtmosphereServlet";
        +    String ATMOSPHERE_SERVLET = "org.atmosphere.runtime.AtmosphereServlet";
             /**
              * A request attribute used to lookup the {@link AtmosphereResource}. This attribute is for framework integrators and not recommend for normal applications.
              */
        @@ -184,7 +184,7 @@ public interface FrameworkConfig {
              */
             String INJECT_LIBARY = "javax.inject.Inject";
             /**
        -     * The current installed {@link org.atmosphere.cpr.BroadcasterFactory}
        +     * The current installed {@link org.atmosphere.runtime.BroadcasterFactory}
              */
             String BROADCASTER_FACTORY = BroadcasterFactory.class.getName();
             /**
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/HeaderConfig.java b/modules/runtime/src/main/java/org/atmosphere/runtime/HeaderConfig.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/HeaderConfig.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/HeaderConfig.java
        index 99b329f7221..bc1361bda2e 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/HeaderConfig.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/HeaderConfig.java
        @@ -13,7 +13,7 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         /**
          * This interface contains all Atmosphere headers shared between the client and the server.
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/HeartbeatAtmosphereResourceEvent.java b/modules/runtime/src/main/java/org/atmosphere/runtime/HeartbeatAtmosphereResourceEvent.java
        similarity index 78%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/HeartbeatAtmosphereResourceEvent.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/HeartbeatAtmosphereResourceEvent.java
        index befa495c908..f0f84f16ab4 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/HeartbeatAtmosphereResourceEvent.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/HeartbeatAtmosphereResourceEvent.java
        @@ -14,14 +14,11 @@
          * the License.
          */
         
        -package org.atmosphere.cpr;
        -
        -import org.atmosphere.cpr.AtmosphereResourceEventImpl;
        -import org.atmosphere.cpr.AtmosphereResourceImpl;
        +package org.atmosphere.runtime;
         
         /**
          * 

        - * Specifies to the observable that {@link org.atmosphere.cpr.AtmosphereResourceEventListener#onHeartbeat(org.atmosphere.cpr.AtmosphereResourceEvent)} + * Specifies to the observable that {@link org.atmosphere.runtime.AtmosphereResourceEventListener#onHeartbeat(org.atmosphere.runtime.AtmosphereResourceEvent)} * should be invoked when it fires event to observers. *

        * diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/KeepOpenStreamAware.java b/modules/runtime/src/main/java/org/atmosphere/runtime/KeepOpenStreamAware.java similarity index 96% rename from modules/cpr/src/main/java/org/atmosphere/cpr/KeepOpenStreamAware.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/KeepOpenStreamAware.java index f5ac9ac8597..5e285978bc9 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/KeepOpenStreamAware.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/KeepOpenStreamAware.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; /** diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/MetaBroadcaster.java b/modules/runtime/src/main/java/org/atmosphere/runtime/MetaBroadcaster.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/cpr/MetaBroadcaster.java rename to modules/runtime/src/main/java/org/atmosphere/runtime/MetaBroadcaster.java index 98d1dd99c28..6a8e9545427 100644 --- a/modules/cpr/src/main/java/org/atmosphere/cpr/MetaBroadcaster.java +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/MetaBroadcaster.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.inject.AtmosphereConfigAware; import org.atmosphere.util.ExecutorsFactory; @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; /** - * Broadcast events to all or a subset of available {@link Broadcaster}s based on their {@link org.atmosphere.cpr.Broadcaster#getID()} value. + * Broadcast events to all or a subset of available {@link Broadcaster}s based on their {@link org.atmosphere.runtime.Broadcaster#getID()} value. * This class allows broadcasting events to a set of broadcasters that maps to some String like: *
          *        // Broadcast the event to all Broadcaster ID starting with /hello
        @@ -39,7 +39,7 @@
          * 

        * This class is NOT thread safe. *

        - * If you want to use MetaBroadcaster with Jersey or any framework, make sure all {@link org.atmosphere.cpr.Broadcaster#getID()} + * If you want to use MetaBroadcaster with Jersey or any framework, make sure all {@link org.atmosphere.runtime.Broadcaster#getID()} * starts with '/'. For example, with Jersey: *

          *
        @@ -51,18 +51,18 @@
          */
         public interface MetaBroadcaster extends AtmosphereConfigAware {
             /**
        -     * Broadcast the message to all Broadcasters whose {@link org.atmosphere.cpr.Broadcaster#getID()} matches the broadcasterID value.
        +     * Broadcast the message to all Broadcasters whose {@link org.atmosphere.runtime.Broadcaster#getID()} matches the broadcasterID value.
              *
        -     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.runtime.Broadcaster#getID()}
              * @param message       a message to be broadcasted
              * @return a Future
              */
             Future> broadcastTo(String broadcasterID, Object message);
         
             /**
        -     * Broadcast the message to all Broadcasters whose {@link org.atmosphere.cpr.Broadcaster#getID()} matches the broadcasterID value.
        +     * Broadcast the message to all Broadcasters whose {@link org.atmosphere.runtime.Broadcaster#getID()} matches the broadcasterID value.
              *
        -     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.runtime.Broadcaster#getID()}
              * @param message       a message to be broadcasted
              * @param cacheMessage  allow the cache to be cached or not.
              * @return a Future
        @@ -70,10 +70,10 @@ public interface MetaBroadcaster extends AtmosphereConfigAware {
             Future> broadcastTo(String broadcasterID, Object message, boolean cacheMessage);
         
             /**
        -     * Broadcast the message at a fixed rate to all Broadcasters whose {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * Broadcast the message at a fixed rate to all Broadcasters whose {@link org.atmosphere.runtime.Broadcaster#getID()}
              * matches the broadcasterID value. This operation will invoke {@link Broadcaster#scheduleFixedBroadcast(Object, long, java.util.concurrent.TimeUnit)}}
              *
        -     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.runtime.Broadcaster#getID()}
              * @param message       a message to be broadcasted
              * @param time          a time value
              * @param unit          a {@link TimeUnit}
        @@ -82,10 +82,10 @@ public interface MetaBroadcaster extends AtmosphereConfigAware {
             Future> scheduleTo(String broadcasterID, Object message, int time, TimeUnit unit);
         
             /**
        -     * Delay the message delivery to Broadcasters whose {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * Delay the message delivery to Broadcasters whose {@link org.atmosphere.runtime.Broadcaster#getID()}
              * matches the broadcasterID value. This operation will invoke {@link Broadcaster#delayBroadcast(Object, long, java.util.concurrent.TimeUnit)} (Object, long, java.util.concurrent.TimeUnit)}}
              *
        -     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.cpr.Broadcaster#getID()}
        +     * @param broadcasterID a String (or path) that can potentially match a {@link org.atmosphere.runtime.Broadcaster#getID()}
              * @param message       a message to be broadcasted
              * @param time          a time value
              * @param unit          a {@link TimeUnit}
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/PerRequestBroadcastFilter.java b/modules/runtime/src/main/java/org/atmosphere/runtime/PerRequestBroadcastFilter.java
        similarity index 83%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/PerRequestBroadcastFilter.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/PerRequestBroadcastFilter.java
        index 8ac6a360790..18b888cc3d7 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/PerRequestBroadcastFilter.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/PerRequestBroadcastFilter.java
        @@ -13,7 +13,7 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         /**
          * An extended {@link BroadcastFilter} that can be used to filter based on {@link AtmosphereResource}.
        @@ -27,9 +27,9 @@ public interface PerRequestBroadcastFilter extends BroadcastFilter {
              * {@link AtmosphereResponse} as the headers may have been already sent back to the browser.
              *
              *
        -     * @param broadcasterId the {@link org.atmosphere.cpr.Broadcaster#getID()}
        -     * @param r the {@link org.atmosphere.cpr.AtmosphereResource}
        -     * @param originalMessage The original message used when calling {@link org.atmosphere.cpr.Broadcaster#broadcast(Object)}
        +     * @param broadcasterId the {@link org.atmosphere.runtime.Broadcaster#getID()}
        +     * @param r the {@link org.atmosphere.runtime.AtmosphereResource}
        +     * @param originalMessage The original message used when calling {@link org.atmosphere.runtime.Broadcaster#broadcast(Object)}
              * @param message         a message
              * @return a {@link BroadcastAction}
              */
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Serializer.java b/modules/runtime/src/main/java/org/atmosphere/runtime/Serializer.java
        similarity index 97%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/Serializer.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/Serializer.java
        index e2cfdf97d7c..20d12032188 100755
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Serializer.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/Serializer.java
        @@ -15,7 +15,7 @@
          */
         
         
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import java.io.IOException;
         import java.io.OutputStream;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionSupport.java b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionSupport.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/SessionSupport.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/SessionSupport.java
        index cb6790b50d5..4f0ddfdfd40 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionSupport.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionSupport.java
        @@ -13,7 +13,7 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutRestorer.java b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutRestorer.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutRestorer.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutRestorer.java
        index 938d0494ef9..11c74cbfd37 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutRestorer.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutRestorer.java
        @@ -13,7 +13,7 @@
         * License for the specific language governing permissions and limitations under
         * the License.
         */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutSupport.java b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutSupport.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutSupport.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutSupport.java
        index 0a47f391b3a..8976fa8dd09 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/SessionTimeoutSupport.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/SessionTimeoutSupport.java
        @@ -13,7 +13,7 @@
         * License for the specific language governing permissions and limitations under
         * the License.
         */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/Universe.java b/modules/runtime/src/main/java/org/atmosphere/runtime/Universe.java
        similarity index 80%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/Universe.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/Universe.java
        index e34ec2549f2..bab0c66a81c 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/Universe.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/Universe.java
        @@ -13,7 +13,7 @@
         * License for the specific language governing permissions and limitations under
         * the License.
         */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
        @@ -51,9 +51,9 @@ public static void metaBroadcaster(DefaultMetaBroadcaster a) {
             }
         
             /**
        -     * Set the must be unique {@link org.atmosphere.cpr.BroadcasterFactory}
        +     * Set the must be unique {@link org.atmosphere.runtime.BroadcasterFactory}
              *
        -     * @param a {@link org.atmosphere.cpr.BroadcasterFactory}
        +     * @param a {@link org.atmosphere.runtime.BroadcasterFactory}
              */
             public static void broadcasterFactory(BroadcasterFactory a) {
                 if (factory != null) {
        @@ -63,9 +63,9 @@ public static void broadcasterFactory(BroadcasterFactory a) {
             }
         
             /**
        -     * Set the must be unique {@link org.atmosphere.cpr.AtmosphereFramework}
        +     * Set the must be unique {@link org.atmosphere.runtime.AtmosphereFramework}
              *
        -     * @param a {@link org.atmosphere.cpr.AtmosphereFramework}
        +     * @param a {@link org.atmosphere.runtime.AtmosphereFramework}
              */
             public static void framework(AtmosphereFramework a) {
                 if (framework != null) {
        @@ -87,9 +87,9 @@ public static void resourceFactory(AtmosphereResourceFactory a) {
             }
         
             /**
        -     * Set the must be unique {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory}
        +     * Set the must be unique {@link org.atmosphere.runtime.AtmosphereResourceSessionFactory}
              *
        -     * @param a {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory}
        +     * @param a {@link org.atmosphere.runtime.AtmosphereResourceSessionFactory}
              */
             public static void sessionResourceFactory(AtmosphereResourceSessionFactory a) {
                 if (sessionFactory != null) {
        @@ -99,18 +99,18 @@ public static void sessionResourceFactory(AtmosphereResourceSessionFactory a) {
             }
         
             /**
        -     * Return the {@link org.atmosphere.cpr.BroadcasterFactory}
        +     * Return the {@link org.atmosphere.runtime.BroadcasterFactory}
              *
        -     * @return the {@link org.atmosphere.cpr.BroadcasterFactory}
        +     * @return the {@link org.atmosphere.runtime.BroadcasterFactory}
              */
             public static BroadcasterFactory broadcasterFactory() {
                 return factory;
             }
         
             /**
        -     * Return the {@link org.atmosphere.cpr.AtmosphereFramework}
        +     * Return the {@link org.atmosphere.runtime.AtmosphereFramework}
              *
        -     * @return the {@link org.atmosphere.cpr.AtmosphereFramework}
        +     * @return the {@link org.atmosphere.runtime.AtmosphereFramework}
              */
             public static AtmosphereFramework framework() {
                 return framework;
        @@ -126,9 +126,9 @@ public static AtmosphereResourceFactory resourceFactory() {
             }
         
             /**
        -     * Return the {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory}
        +     * Return the {@link org.atmosphere.runtime.AtmosphereResourceSessionFactory}
              *
        -     * @return the {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory}
        +     * @return the {@link org.atmosphere.runtime.AtmosphereResourceSessionFactory}
              */
             public static AtmosphereResourceSessionFactory sessionFactory() {
                 return sessionFactory;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/cpr/WebSocketProcessorFactory.java b/modules/runtime/src/main/java/org/atmosphere/runtime/WebSocketProcessorFactory.java
        similarity index 99%
        rename from modules/cpr/src/main/java/org/atmosphere/cpr/WebSocketProcessorFactory.java
        rename to modules/runtime/src/main/java/org/atmosphere/runtime/WebSocketProcessorFactory.java
        index 5de5b7d87df..84664945cb0 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/cpr/WebSocketProcessorFactory.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/runtime/WebSocketProcessorFactory.java
        @@ -13,7 +13,7 @@
          * License for the specific language governing permissions and limitations under
          * the License.
          */
        -package org.atmosphere.cpr;
        +package org.atmosphere.runtime;
         
         import org.atmosphere.util.IOUtils;
         import org.atmosphere.websocket.DefaultWebSocketProcessor;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java b/modules/runtime/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java
        similarity index 90%
        rename from modules/cpr/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java
        index 392ad3426bd..7fa452da795 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/AbstractBroadcasterProxy.java
        @@ -15,14 +15,14 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.AtmosphereConfig;
        -import org.atmosphere.cpr.AtmosphereResource;
        -import org.atmosphere.cpr.AtmosphereResourceEvent;
        -import org.atmosphere.cpr.Broadcaster;
        -import org.atmosphere.cpr.BroadcasterFuture;
        -import org.atmosphere.cpr.DefaultBroadcaster;
        -import org.atmosphere.cpr.Deliver;
        -import org.atmosphere.cpr.FrameworkConfig;
        +import org.atmosphere.runtime.AtmosphereConfig;
        +import org.atmosphere.runtime.AtmosphereResource;
        +import org.atmosphere.runtime.AtmosphereResourceEvent;
        +import org.atmosphere.runtime.Broadcaster;
        +import org.atmosphere.runtime.BroadcasterFuture;
        +import org.atmosphere.runtime.DefaultBroadcaster;
        +import org.atmosphere.runtime.Deliver;
        +import org.atmosphere.runtime.FrameworkConfig;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         
        @@ -33,7 +33,7 @@
         
         
         /**
        - * Abstract {@link org.atmosphere.cpr.Broadcaster} that delegates the internal processing to a proxy.
        + * Abstract {@link org.atmosphere.runtime.Broadcaster} that delegates the internal processing to a proxy.
          *
          * @author Jeanfrancois Arcand
          */
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java b/modules/runtime/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java
        similarity index 99%
        rename from modules/cpr/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java
        index 16635756387..84d4fffef9d 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/AtmosphereConfigReader.java
        @@ -20,7 +20,7 @@
         import org.atmosphere.config.AtmosphereHandlerConfig;
         import org.atmosphere.config.AtmosphereHandlerProperty;
         import org.atmosphere.config.FrameworkConfiguration;
        -import org.atmosphere.cpr.AtmosphereConfig;
        +import org.atmosphere.runtime.AtmosphereConfig;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         import org.w3c.dom.Document;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/AtmosphereFilterChain.java b/modules/runtime/src/main/java/org/atmosphere/util/AtmosphereFilterChain.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/AtmosphereFilterChain.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/AtmosphereFilterChain.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java b/modules/runtime/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java
        similarity index 91%
        rename from modules/cpr/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java
        index cc12468f379..54d1438a0af 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/ByteArrayAsyncWriter.java
        @@ -15,9 +15,9 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.AsyncIOWriter;
        -import org.atmosphere.cpr.AsyncIOWriterAdapter;
        -import org.atmosphere.cpr.AtmosphereResponse;
        +import org.atmosphere.runtime.AsyncIOWriter;
        +import org.atmosphere.runtime.AsyncIOWriterAdapter;
        +import org.atmosphere.runtime.AtmosphereResponse;
         
         import java.io.ByteArrayOutputStream;
         import java.io.IOException;
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ChunkConcatReaderPool.java b/modules/runtime/src/main/java/org/atmosphere/util/ChunkConcatReaderPool.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/ChunkConcatReaderPool.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/ChunkConcatReaderPool.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/CookieUtil.java b/modules/runtime/src/main/java/org/atmosphere/util/CookieUtil.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/CookieUtil.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/CookieUtil.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java b/modules/runtime/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java
        similarity index 95%
        rename from modules/cpr/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java
        index 52b789f3d8c..0263491881b 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/DefaultEndpointMapper.java
        @@ -15,9 +15,9 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.AtmosphereConfig;
        -import org.atmosphere.cpr.AtmosphereRequest;
        -import org.atmosphere.cpr.FrameworkConfig;
        +import org.atmosphere.runtime.AtmosphereConfig;
        +import org.atmosphere.runtime.AtmosphereRequest;
        +import org.atmosphere.runtime.FrameworkConfig;
         import org.atmosphere.util.uri.UriTemplate;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
        @@ -26,7 +26,7 @@
         import java.util.Map;
         
         /**
        - * Default implementation of the {@link EndpointMapper} used by the {@link org.atmosphere.cpr.AsynchronousProcessor}
        + * Default implementation of the {@link EndpointMapper} used by the {@link org.atmosphere.runtime.AsynchronousProcessor}
          * and {@link org.atmosphere.websocket.DefaultWebSocketProcessor}
          *
          * @author Jeanfrancois Arcand
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/DefaultUUIDProvider.java b/modules/runtime/src/main/java/org/atmosphere/util/DefaultUUIDProvider.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/DefaultUUIDProvider.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/DefaultUUIDProvider.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/EndpointMapper.java b/modules/runtime/src/main/java/org/atmosphere/util/EndpointMapper.java
        similarity index 91%
        rename from modules/cpr/src/main/java/org/atmosphere/util/EndpointMapper.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/EndpointMapper.java
        index 65efaed851a..b14794f089c 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/EndpointMapper.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/EndpointMapper.java
        @@ -15,14 +15,13 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.AtmosphereRequest;
        -import org.atmosphere.cpr.AtmosphereRequestImpl;
        +import org.atmosphere.runtime.AtmosphereRequest;
         import org.atmosphere.inject.AtmosphereConfigAware;
         
         import java.util.Map;
         
         /**
        - * This class is responsible for mapping request to handler like {@link org.atmosphere.cpr.AtmosphereHandler}
        + * This class is responsible for mapping request to handler like {@link org.atmosphere.runtime.AtmosphereHandler}
          * or {@link org.atmosphere.websocket.WebSocketHandler}
          *
          * @param 
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java b/modules/runtime/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java
        similarity index 94%
        rename from modules/cpr/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java
        index 6ed0f5e270f..7135848a5a3 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/ExcludeSessionBroadcaster.java
        @@ -30,12 +30,12 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.AtmosphereConfig;
        -import org.atmosphere.cpr.AtmosphereResource;
        -import org.atmosphere.cpr.Broadcaster;
        -import org.atmosphere.cpr.BroadcasterFuture;
        -import org.atmosphere.cpr.DefaultBroadcaster;
        -import org.atmosphere.cpr.Deliver;
        +import org.atmosphere.runtime.AtmosphereConfig;
        +import org.atmosphere.runtime.AtmosphereResource;
        +import org.atmosphere.runtime.Broadcaster;
        +import org.atmosphere.runtime.BroadcasterFuture;
        +import org.atmosphere.runtime.DefaultBroadcaster;
        +import org.atmosphere.runtime.Deliver;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ExecutorsFactory.java b/modules/runtime/src/main/java/org/atmosphere/util/ExecutorsFactory.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/util/ExecutorsFactory.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/ExecutorsFactory.java
        index 1794456ad88..6ca6ae61741 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/ExecutorsFactory.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/ExecutorsFactory.java
        @@ -15,8 +15,8 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.ApplicationConfig;
        -import org.atmosphere.cpr.AtmosphereConfig;
        +import org.atmosphere.runtime.ApplicationConfig;
        +import org.atmosphere.runtime.AtmosphereConfig;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         
        @@ -29,7 +29,7 @@
         import java.util.concurrent.TimeUnit;
         import java.util.concurrent.atomic.AtomicInteger;
         
        -import static org.atmosphere.cpr.ApplicationConfig.USE_FORJOINPOOL;
        +import static org.atmosphere.runtime.ApplicationConfig.USE_FORJOINPOOL;
         
         /**
          * Stateless Factory to create {@link ExecutorService} used in all Atmosphere Component. By default they are
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/FakeHttpSession.java b/modules/runtime/src/main/java/org/atmosphere/util/FakeHttpSession.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/FakeHttpSession.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/FakeHttpSession.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/FilterConfigImpl.java b/modules/runtime/src/main/java/org/atmosphere/util/FilterConfigImpl.java
        similarity index 100%
        rename from modules/cpr/src/main/java/org/atmosphere/util/FilterConfigImpl.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/FilterConfigImpl.java
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ForkJoinPool.java b/modules/runtime/src/main/java/org/atmosphere/util/ForkJoinPool.java
        similarity index 98%
        rename from modules/cpr/src/main/java/org/atmosphere/util/ForkJoinPool.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/ForkJoinPool.java
        index 0128a402d04..a1dc22358ad 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/ForkJoinPool.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/ForkJoinPool.java
        @@ -15,7 +15,7 @@
          */
         package org.atmosphere.util;
         
        -import org.atmosphere.cpr.ApplicationConfig;
        +import org.atmosphere.runtime.ApplicationConfig;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         
        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/IOUtils.java b/modules/runtime/src/main/java/org/atmosphere/util/IOUtils.java
        similarity index 93%
        rename from modules/cpr/src/main/java/org/atmosphere/util/IOUtils.java
        rename to modules/runtime/src/main/java/org/atmosphere/util/IOUtils.java
        index ec13da883f5..7bdcf02dadd 100644
        --- a/modules/cpr/src/main/java/org/atmosphere/util/IOUtils.java
        +++ b/modules/runtime/src/main/java/org/atmosphere/util/IOUtils.java
        @@ -16,16 +16,15 @@
         package org.atmosphere.util;
         
         import org.atmosphere.config.service.DeliverTo;
        -import org.atmosphere.cpr.ApplicationConfig;
        -import org.atmosphere.cpr.AtmosphereConfig;
        -import org.atmosphere.cpr.AtmosphereFramework;
        -import org.atmosphere.cpr.AtmosphereRequest;
        -import org.atmosphere.cpr.AtmosphereRequestImpl;
        -import org.atmosphere.cpr.AtmosphereResource;
        -import org.atmosphere.cpr.AtmosphereResourceImpl;
        -import org.atmosphere.cpr.AtmosphereServlet;
        -import org.atmosphere.cpr.Broadcaster;
        -import org.atmosphere.cpr.MeteorServlet;
        +import org.atmosphere.runtime.ApplicationConfig;
        +import org.atmosphere.runtime.AtmosphereConfig;
        +import org.atmosphere.runtime.AtmosphereFramework;
        +import org.atmosphere.runtime.AtmosphereRequest;
        +import org.atmosphere.runtime.AtmosphereRequestImpl;
        +import org.atmosphere.runtime.AtmosphereResource;
        +import org.atmosphere.runtime.AtmosphereResourceImpl;
        +import org.atmosphere.runtime.AtmosphereServlet;
        +import org.atmosphere.runtime.Broadcaster;
         import org.slf4j.Logger;
         import org.slf4j.LoggerFactory;
         
        @@ -51,8 +50,8 @@
         import java.util.regex.Matcher;
         import java.util.regex.Pattern;
         
        -import static org.atmosphere.cpr.HeaderConfig.FORCE_BINARY;
        -import static org.atmosphere.cpr.HeaderConfig.X_ATMO_BINARY;
        +import static org.atmosphere.runtime.HeaderConfig.FORCE_BINARY;
        +import static org.atmosphere.runtime.HeaderConfig.X_ATMO_BINARY;
         
         public class IOUtils {
             private final static Logger logger = LoggerFactory.getLogger(IOUtils.class);
        @@ -63,9 +62,6 @@ public class IOUtils {
                 knownClasses = new ArrayList() {
                     {
                         add(AtmosphereServlet.class.getName());
        -                add(MeteorServlet.class.getName());
        -                add("com.vaadin.server.VaadinServlet");
        -                add("org.primefaces.push.PushServlet");
                     }
                 };
             }
        @@ -391,8 +387,8 @@ public static boolean isAtmosphere(String className) {
             /**
              * 

        * This method reads the given file stored under "META-INF/services" and accessed through the framework's class loader - * to specify a list of {@link org.atmosphere.cpr.AtmosphereFramework.MetaServiceAction actions} to be done on different - * service classes ({@link org.atmosphere.cpr.AtmosphereInterceptor}, {@link org.atmosphere.cpr.BroadcastFilter}, etc). + * to specify a list of {@link org.atmosphere.runtime.AtmosphereFramework.MetaServiceAction actions} to be done on different + * service classes ({@link org.atmosphere.runtime.AtmosphereInterceptor}, {@link org.atmosphere.runtime.BroadcastFilter}, etc). *

        *

        *

        @@ -407,8 +403,8 @@ public static boolean isAtmosphere(String className) { *

        *

        *

        - * If you don't specify any {@link org.atmosphere.cpr.AtmosphereFramework.MetaServiceAction} before a class, then - * default action will be {@link org.atmosphere.cpr.AtmosphereFramework.MetaServiceAction#INSTALL}. + * If you don't specify any {@link org.atmosphere.runtime.AtmosphereFramework.MetaServiceAction} before a class, then + * default action will be {@link org.atmosphere.runtime.AtmosphereFramework.MetaServiceAction#INSTALL}. *

        *

        *

        diff --git a/modules/cpr/src/main/java/org/atmosphere/util/IntrospectionUtils.java b/modules/runtime/src/main/java/org/atmosphere/util/IntrospectionUtils.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/IntrospectionUtils.java rename to modules/runtime/src/main/java/org/atmosphere/util/IntrospectionUtils.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/QueryStringDecoder.java b/modules/runtime/src/main/java/org/atmosphere/util/QueryStringDecoder.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/QueryStringDecoder.java rename to modules/runtime/src/main/java/org/atmosphere/util/QueryStringDecoder.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ReaderInputStream.java b/modules/runtime/src/main/java/org/atmosphere/util/ReaderInputStream.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/ReaderInputStream.java rename to modules/runtime/src/main/java/org/atmosphere/util/ReaderInputStream.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ServletContextFactory.java b/modules/runtime/src/main/java/org/atmosphere/util/ServletContextFactory.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/ServletContextFactory.java rename to modules/runtime/src/main/java/org/atmosphere/util/ServletContextFactory.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ServletProxyFactory.java b/modules/runtime/src/main/java/org/atmosphere/util/ServletProxyFactory.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/ServletProxyFactory.java rename to modules/runtime/src/main/java/org/atmosphere/util/ServletProxyFactory.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/SimpleBroadcaster.java b/modules/runtime/src/main/java/org/atmosphere/util/SimpleBroadcaster.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/util/SimpleBroadcaster.java rename to modules/runtime/src/main/java/org/atmosphere/util/SimpleBroadcaster.java index 2036ad5353e..20942fefbe3 100755 --- a/modules/cpr/src/main/java/org/atmosphere/util/SimpleBroadcaster.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/SimpleBroadcaster.java @@ -15,15 +15,15 @@ */ package org.atmosphere.util; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterConfig; -import org.atmosphere.cpr.BroadcasterFuture; -import org.atmosphere.cpr.DefaultBroadcaster; -import org.atmosphere.cpr.Deliver; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterConfig; +import org.atmosphere.runtime.BroadcasterFuture; +import org.atmosphere.runtime.DefaultBroadcaster; +import org.atmosphere.runtime.Deliver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * Simple {@link org.atmosphere.cpr.Broadcaster} implementation that use the calling thread when broadcasting events. + * Simple {@link org.atmosphere.runtime.Broadcaster} implementation that use the calling thread when broadcasting events. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/util/StringEscapeUtils.java b/modules/runtime/src/main/java/org/atmosphere/util/StringEscapeUtils.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/StringEscapeUtils.java rename to modules/runtime/src/main/java/org/atmosphere/util/StringEscapeUtils.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/StringFilterAggregator.java b/modules/runtime/src/main/java/org/atmosphere/util/StringFilterAggregator.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/util/StringFilterAggregator.java rename to modules/runtime/src/main/java/org/atmosphere/util/StringFilterAggregator.java index d7ded7740fb..c838bee9005 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/StringFilterAggregator.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/StringFilterAggregator.java @@ -16,8 +16,8 @@ package org.atmosphere.util; -import org.atmosphere.cpr.BroadcastFilter; -import org.atmosphere.cpr.BroadcastFilter.BroadcastAction.ACTION; +import org.atmosphere.runtime.BroadcastFilter; +import org.atmosphere.runtime.BroadcastFilter.BroadcastAction.ACTION; import java.util.concurrent.atomic.AtomicReference; diff --git a/modules/cpr/src/main/java/org/atmosphere/util/ThreadLocalInvoker.java b/modules/runtime/src/main/java/org/atmosphere/util/ThreadLocalInvoker.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/ThreadLocalInvoker.java rename to modules/runtime/src/main/java/org/atmosphere/util/ThreadLocalInvoker.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/UUIDProvider.java b/modules/runtime/src/main/java/org/atmosphere/util/UUIDProvider.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/UUIDProvider.java rename to modules/runtime/src/main/java/org/atmosphere/util/UUIDProvider.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/Utils.java b/modules/runtime/src/main/java/org/atmosphere/util/Utils.java similarity index 91% rename from modules/cpr/src/main/java/org/atmosphere/util/Utils.java rename to modules/runtime/src/main/java/org/atmosphere/util/Utils.java index 50aa20578bd..7ac47ad1457 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/Utils.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/Utils.java @@ -15,16 +15,15 @@ */ package org.atmosphere.util; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereObjectFactory; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.cpr.HeaderConfig; -import org.atmosphere.cpr.Meteor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereObjectFactory; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.FrameworkConfig; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.handler.AnnotatedProxy; import org.atmosphere.handler.ReflectorServletProcessor; import org.atmosphere.inject.InjectableObjectFactory; @@ -40,10 +39,10 @@ import java.util.HashSet; import java.util.Set; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.FrameworkConfig.NEED_RUNTIME_INJECTION; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_UPGRADE; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_VERSION; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.FrameworkConfig.NEED_RUNTIME_INJECTION; +import static org.atmosphere.runtime.HeaderConfig.WEBSOCKET_UPGRADE; +import static org.atmosphere.runtime.HeaderConfig.WEBSOCKET_VERSION; /** * Utils class. @@ -346,17 +345,6 @@ public static final boolean requestScopedInjection(AtmosphereConfig config, Obje } } - public final static void destroyMeteor(AtmosphereRequest req) { - try { - Object o = req.getAttribute(AtmosphereResourceImpl.METEOR); - if (o != null && Meteor.class.isAssignableFrom(o.getClass())) { - Meteor.class.cast(o).destroy(); - } - } catch (Exception ex) { - LOGGER.debug("Meteor resume exception: Cannot resume an already resumed/cancelled request", ex); - } - } - public static String pathInfo(AtmosphereRequest request) { String pathInfo = null; String path = null; diff --git a/modules/cpr/src/main/java/org/atmosphere/util/Version.java b/modules/runtime/src/main/java/org/atmosphere/util/Version.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/Version.java rename to modules/runtime/src/main/java/org/atmosphere/util/Version.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java b/modules/runtime/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java similarity index 87% rename from modules/cpr/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java index 0e1fd29ddde..a557bcd65a1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/VoidAnnotationProcessor.java @@ -15,14 +15,14 @@ */ package org.atmosphere.util; -import org.atmosphere.cpr.AnnotationProcessor; -import org.atmosphere.cpr.AtmosphereConfig; +import org.atmosphere.runtime.AnnotationProcessor; +import org.atmosphere.runtime.AtmosphereConfig; import java.io.File; import java.io.IOException; /** - * An {@link org.atmosphere.cpr.AnnotationProcessor} that does nothing. + * An {@link org.atmosphere.runtime.AnnotationProcessor} that does nothing. * * @author Jeanfrancois Arcand */ diff --git a/modules/cpr/src/main/java/org/atmosphere/util/VoidExecutorService.java b/modules/runtime/src/main/java/org/atmosphere/util/VoidExecutorService.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/VoidExecutorService.java rename to modules/runtime/src/main/java/org/atmosphere/util/VoidExecutorService.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/VoidServletConfig.java b/modules/runtime/src/main/java/org/atmosphere/util/VoidServletConfig.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/VoidServletConfig.java rename to modules/runtime/src/main/java/org/atmosphere/util/VoidServletConfig.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/WebDotXmlReader.java b/modules/runtime/src/main/java/org/atmosphere/util/WebDotXmlReader.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/util/WebDotXmlReader.java rename to modules/runtime/src/main/java/org/atmosphere/util/WebDotXmlReader.java index 1a7c3e1f214..116870993a1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/WebDotXmlReader.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/WebDotXmlReader.java @@ -16,7 +16,7 @@ package org.atmosphere.util; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.FrameworkConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -119,7 +119,7 @@ private void parse(Document document) { } /** - * Return an {@link ArrayList} which maps to the {@link org.atmosphere.cpr.AtmosphereServlet} + * Return an {@link ArrayList} which maps to the {@link org.atmosphere.runtime.AtmosphereServlet} */ public ArrayList getMappings() { return mappings; diff --git a/modules/cpr/src/main/java/org/atmosphere/util/XSSHtmlFilter.java b/modules/runtime/src/main/java/org/atmosphere/util/XSSHtmlFilter.java similarity index 98% rename from modules/cpr/src/main/java/org/atmosphere/util/XSSHtmlFilter.java rename to modules/runtime/src/main/java/org/atmosphere/util/XSSHtmlFilter.java index c6566380293..b7703b9fcc5 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/XSSHtmlFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/XSSHtmlFilter.java @@ -16,7 +16,7 @@ package org.atmosphere.util; -import org.atmosphere.cpr.BroadcastFilter; +import org.atmosphere.runtime.BroadcastFilter; /** * Simple {@link BroadcastFilter} which automatically filter diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/FocusPoint.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/FocusPoint.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/FocusPoint.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/FocusPoint.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/GoogleAnalytics_v1_URLBuildingStrategy.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/GoogleAnalytics_v1_URLBuildingStrategy.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/GoogleAnalytics_v1_URLBuildingStrategy.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/GoogleAnalytics_v1_URLBuildingStrategy.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/HTTPGetMethod.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/HTTPGetMethod.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/HTTPGetMethod.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/HTTPGetMethod.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/JGoogleAnalyticsTracker.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/JGoogleAnalyticsTracker.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/JGoogleAnalyticsTracker.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/JGoogleAnalyticsTracker.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/ModuleDetection.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/ModuleDetection.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/ModuleDetection.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/ModuleDetection.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/analytics/URLBuildingStrategy.java b/modules/runtime/src/main/java/org/atmosphere/util/analytics/URLBuildingStrategy.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/analytics/URLBuildingStrategy.java rename to modules/runtime/src/main/java/org/atmosphere/util/analytics/URLBuildingStrategy.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java index 226b5e9db4e..4fd7a2f94cb 100644 --- a/modules/cpr/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java +++ b/modules/runtime/src/main/java/org/atmosphere/util/annotation/AnnotationDetector.java @@ -50,7 +50,6 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLDecoder; -import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; @@ -314,23 +313,6 @@ public final void detect(final String... packageNames) throws IOException { if (jarFile.isFile() && jarFile.exists()) { files.add(jarFile); print("Add jar file from VFS: '%s'", jarFile); - } else { - try { - // VirtualFile#getChildren(java.lang.String) may return an object which refers a .jar managed by the deployer - // The problem is that this .jar file does not contains .class in sub-directories - // Ex: if your original file contains /foo/bar/Baz.class and /foo/Bar.class, VFS returns a .jar file with: - // - /foo - // - /foo/Bar.class - // - /foo/bar - // ==> /foo/bar/Baz.class is missing! - // Resolving child directories recursively solves the issue - List vfs = getVfsChildren(org.jboss.vfs.VFS.getChild(dir.getPath())); - for (org.jboss.vfs.VirtualFile f : vfs) { - files.add(f.getPhysicalFile()); - } - } catch (Throwable ex) { - vfs(url, packageName, streams); - } } } else { vfs(url, packageName, streams); @@ -390,28 +372,6 @@ public final void detect(final String... packageNames) throws IOException { } } - /** - *

        - * This method recursively retrieves VFS files when a directory is detected. - *

        - * - * @param vfs the root - * @return all children files - */ - private List getVfsChildren(final org.jboss.vfs.VirtualFile vfs) { - final List retval = new ArrayList(); - - for (org.jboss.vfs.VirtualFile f : vfs.getChildren()) { - if (f.isDirectory()) { - retval.addAll(getVfsChildren(org.jboss.vfs.VFS.getChild(vfs.getPathName() + File.separator + f.getName()))); - } else { - retval.add(f); - } - } - - return retval; - } - private boolean isRunningJavaWebStart() { boolean hasJNLP = false; try { diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/ClassFileBuffer.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/ClassFileBuffer.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/ClassFileBuffer.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/ClassFileBuffer.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/ClassFileIterator.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/ClassFileIterator.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/ClassFileIterator.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/ClassFileIterator.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/FileIterator.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/FileIterator.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/FileIterator.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/FileIterator.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/InputStreamIterator.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/InputStreamIterator.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/InputStreamIterator.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/InputStreamIterator.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/annotation/ZipFileIterator.java b/modules/runtime/src/main/java/org/atmosphere/util/annotation/ZipFileIterator.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/annotation/ZipFileIterator.java rename to modules/runtime/src/main/java/org/atmosphere/util/annotation/ZipFileIterator.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/uri/UriComponent.java b/modules/runtime/src/main/java/org/atmosphere/util/uri/UriComponent.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/uri/UriComponent.java rename to modules/runtime/src/main/java/org/atmosphere/util/uri/UriComponent.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/uri/UriPattern.java b/modules/runtime/src/main/java/org/atmosphere/util/uri/UriPattern.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/uri/UriPattern.java rename to modules/runtime/src/main/java/org/atmosphere/util/uri/UriPattern.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/uri/UriTemplate.java b/modules/runtime/src/main/java/org/atmosphere/util/uri/UriTemplate.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/uri/UriTemplate.java rename to modules/runtime/src/main/java/org/atmosphere/util/uri/UriTemplate.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/uri/UriTemplateParser.java b/modules/runtime/src/main/java/org/atmosphere/util/uri/UriTemplateParser.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/uri/UriTemplateParser.java rename to modules/runtime/src/main/java/org/atmosphere/util/uri/UriTemplateParser.java diff --git a/modules/cpr/src/main/java/org/atmosphere/util/version.properties b/modules/runtime/src/main/java/org/atmosphere/util/version.properties similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/util/version.properties rename to modules/runtime/src/main/java/org/atmosphere/util/version.properties diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java b/modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java similarity index 86% rename from modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java index 2e829c938fb..3510866f1d4 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketFactory.java @@ -15,9 +15,9 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceFactory; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceFactory; +import org.atmosphere.runtime.AtmosphereResourceImpl; import javax.inject.Inject; diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java b/modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java index 1b2a2f8e7fc..91ca9a0b684 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/DefaultWebSocketProcessor.java @@ -18,22 +18,22 @@ import org.atmosphere.annotation.AnnotationUtil; import org.atmosphere.config.service.Singleton; import org.atmosphere.config.service.WebSocketHandlerService; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereMappingException; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEventImpl; -import org.atmosphere.cpr.AtmosphereResourceEventListener; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereMappingException; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEventImpl; +import org.atmosphere.runtime.AtmosphereResourceEventListener; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.FrameworkConfig; +import org.atmosphere.runtime.HeaderConfig; import org.atmosphere.util.DefaultEndpointMapper; import org.atmosphere.util.EndpointMapper; import org.atmosphere.util.ExecutorsFactory; @@ -67,21 +67,21 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.Action.TYPE.SKIP_ATMOSPHEREHANDLER; -import static org.atmosphere.cpr.ApplicationConfig.INVOKE_ATMOSPHERE_INTERCEPTOR_ON_WEBSOCKET_MESSAGE; -import static org.atmosphere.cpr.ApplicationConfig.IN_MEMORY_STREAMING_BUFFER_SIZE; -import static org.atmosphere.cpr.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; -import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION; -import static org.atmosphere.cpr.AtmosphereFramework.REFLECTOR_ATMOSPHEREHANDLER; -import static org.atmosphere.cpr.Broadcaster.ROOT_MASTER; -import static org.atmosphere.cpr.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; +import static org.atmosphere.runtime.Action.TYPE.SKIP_ATMOSPHEREHANDLER; +import static org.atmosphere.runtime.ApplicationConfig.INVOKE_ATMOSPHERE_INTERCEPTOR_ON_WEBSOCKET_MESSAGE; +import static org.atmosphere.runtime.ApplicationConfig.IN_MEMORY_STREAMING_BUFFER_SIZE; +import static org.atmosphere.runtime.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION; +import static org.atmosphere.runtime.AtmosphereFramework.REFLECTOR_ATMOSPHEREHANDLER; +import static org.atmosphere.runtime.Broadcaster.ROOT_MASTER; +import static org.atmosphere.runtime.FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE; import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.CLOSE; import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.CONNECT; import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.MESSAGE; /** - * Like the {@link org.atmosphere.cpr.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket request to the + * Like the {@link org.atmosphere.runtime.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket request to the * proper {@link org.atmosphere.websocket.WebSocket} implementation. This class can be extended in order to support any protocol * running on top websocket. * @@ -581,7 +581,7 @@ private void handleException(Exception ex, WebSocket webSocket, WebSocketHandler } /** - * Dispatch to request/response to the {@link org.atmosphere.cpr.AsyncSupport} implementation as it was a normal HTTP request. + * Dispatch to request/response to the {@link org.atmosphere.runtime.AsyncSupport} implementation as it was a normal HTTP request. * * @param request a {@link AtmosphereRequest} * @param r a {@link AtmosphereResponse} diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocket.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocket.java similarity index 94% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocket.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocket.java index 266771c248b..37a59fe4c06 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocket.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocket.java @@ -15,16 +15,16 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereInterceptorWriter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.KeepOpenStreamAware; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereInterceptorWriter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.KeepOpenStreamAware; import org.atmosphere.util.ByteArrayAsyncWriter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_ERROR; /** * Represent a portable WebSocket implementation which can be used to write message. @@ -260,8 +260,8 @@ public WebSocket write(AtmosphereResponse r, byte[] b, int offset, int length) t } /** - * Broadcast, using the {@link org.atmosphere.cpr.AtmosphereResource#getBroadcaster()} the object to all - * {@link WebSocket} associated with the {@link org.atmosphere.cpr.Broadcaster}. This method does the same as + * Broadcast, using the {@link org.atmosphere.runtime.AtmosphereResource#getBroadcaster()} the object to all + * {@link WebSocket} associated with the {@link org.atmosphere.runtime.Broadcaster}. This method does the same as * websocket.resource().getBroadcaster().broadcast(o). * * @param o An object to broadcast to all WebSockets. diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java index 2938533de31..7c3cce9fe84 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListener.java @@ -15,7 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereResourceEventListener; +import org.atmosphere.runtime.AtmosphereResourceEventListener; /** * A listener for monitoring what's occurring on a WebSocket, independently of the underlying implementation. diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java similarity index 97% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java index f3658211a77..4ee2571f5ea 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketEventListenerAdapter.java @@ -15,7 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketFactory.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketFactory.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketFactory.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketFactory.java index 370e5e5b8a3..16594f956bf 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketFactory.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketFactory.java @@ -15,7 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResource; /** * A factory for retrieving {@link WebSocket} diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandler.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandler.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandler.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandler.java diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandlerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandlerAdapter.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandlerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandlerAdapter.java diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java index fa74f335c40..91c981839cc 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketHandshakeFilter.java @@ -15,7 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.ApplicationConfig; +import org.atmosphere.runtime.ApplicationConfig; import org.atmosphere.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_ERROR; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_VERSION; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_ERROR; +import static org.atmosphere.runtime.HeaderConfig.WEBSOCKET_VERSION; /** * A Servlet Filter for configuring which WebSocket protocol version an application want to support. diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketPingPongListener.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketPingPongListener.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketPingPongListener.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketPingPongListener.java diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java similarity index 95% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java index a1eb7e13610..5453938a990 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessor.java @@ -15,10 +15,10 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.Broadcaster; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.Broadcaster; import org.atmosphere.util.SimpleBroadcaster; import org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent; @@ -39,7 +39,7 @@ public interface WebSocketProcessor { /** * Configure, or post construct a WebSocketProcessor - * @param config an {@link org.atmosphere.cpr.AtmosphereConfig} + * @param config an {@link org.atmosphere.runtime.AtmosphereConfig} * @return this */ WebSocketProcessor configure(AtmosphereConfig config); diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java similarity index 93% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java index 4f9da9daa41..6ece366da82 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProcessorAdapter.java @@ -15,9 +15,9 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResponse; import javax.servlet.http.HttpServletRequest; import java.io.IOException; diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java similarity index 81% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java index 699af299696..ec88b036fb1 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocol.java @@ -15,8 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereRequest; import org.atmosphere.inject.AtmosphereConfigAware; import java.util.List; @@ -30,9 +29,9 @@ public interface WebSocketProtocol extends AtmosphereConfigAware { /** - * Parse the WebSocket message, and delegate the processing to the {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} or - * to any existing technology. Invoking {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} will delegate the request processing - * to the {@link org.atmosphere.cpr.AtmosphereHandler} implementation. Returning null means this implementation will + * Parse the WebSocket message, and delegate the processing to the {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} or + * to any existing technology. Invoking {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} will delegate the request processing + * to the {@link org.atmosphere.runtime.AtmosphereHandler} implementation. Returning null means this implementation will * handle itself the processing/dispatching of the WebSocket's request; *
        * As an example, this is how Websocket messages are delegated to the @@ -46,9 +45,9 @@ public interface WebSocketProtocol extends AtmosphereConfigAware { List onMessage(WebSocket webSocket, String data); /** - * Parse the WebSocket message, and delegate the processing to the {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} or - * to any existing technology. Invoking {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} will delegate the request processing - * to the {@link org.atmosphere.cpr.AtmosphereHandler} implementation. Returning null means this implementation will + * Parse the WebSocket message, and delegate the processing to the {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} or + * to any existing technology. Invoking {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} will delegate the request processing + * to the {@link org.atmosphere.runtime.AtmosphereHandler} implementation. Returning null means this implementation will * handle itself the processing/dispatching of the WebSocket's request; *
        * As an example, this is how Websocket messages are delegated to the diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java similarity index 77% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java index 6b059e0a870..a785c5bc300 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketProtocolStream.java @@ -15,8 +15,7 @@ */ package org.atmosphere.websocket; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereRequest; import java.io.InputStream; import java.io.Reader; @@ -31,9 +30,9 @@ public interface WebSocketProtocolStream extends WebSocketProtocol { /** - * Parse the WebSocket stream, and delegate the processing to the {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} or - * to any existing technology. Invoking {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} will delegate the request processing - * to the {@link org.atmosphere.cpr.AtmosphereHandler} implementation. Returning null means this implementation will + * Parse the WebSocket stream, and delegate the processing to the {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} or + * to any existing technology. Invoking {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} will delegate the request processing + * to the {@link org.atmosphere.runtime.AtmosphereHandler} implementation. Returning null means this implementation will * handle itself the processing/dispatching of the WebSocket's request; *
        * As an example, this is how Websocket messages are delegated to the @@ -47,9 +46,9 @@ public interface WebSocketProtocolStream extends WebSocketProtocol { List onTextStream(WebSocket webSocket, Reader r); /** - * Parse the WebSocket stream, and delegate the processing to the {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} or - * to any existing technology. Invoking {@link org.atmosphere.cpr.AtmosphereFramework#asyncSupport} will delegate the request processing - * to the {@link org.atmosphere.cpr.AtmosphereHandler} implementation. Returning null means this implementation will + * Parse the WebSocket stream, and delegate the processing to the {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} or + * to any existing technology. Invoking {@link org.atmosphere.runtime.AtmosphereFramework#asyncSupport} will delegate the request processing + * to the {@link org.atmosphere.runtime.AtmosphereHandler} implementation. Returning null means this implementation will * handle itself the processing/dispatching of the WebSocket's request; *
        * As an example, this is how Websocket messages are delegated to the diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandler.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandler.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandler.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandler.java diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandlerAdapter.java b/modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandlerAdapter.java similarity index 100% rename from modules/cpr/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandlerAdapter.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/WebSocketStreamingHandlerAdapter.java diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java index 7676d5db00c..3b8aa389857 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/EchoProtocol.java @@ -15,9 +15,8 @@ */ package org.atmosphere.websocket.protocol; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; import org.atmosphere.websocket.WebSocket; import org.atmosphere.websocket.WebSocketProcessor; import org.atmosphere.websocket.WebSocketProtocol; @@ -27,7 +26,7 @@ import java.util.List; /** - * Simple {@link org.atmosphere.websocket.WebSocketProcessor} that invoke the {@link org.atmosphere.cpr.Broadcaster#broadcast} API when a WebSocket message + * Simple {@link org.atmosphere.websocket.WebSocketProcessor} that invoke the {@link org.atmosphere.runtime.Broadcaster#broadcast} API when a WebSocket message * is received. *

        * NOTE: If WebSocket frame are used the bytes will be decoded into a String, which reduce performance. diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java similarity index 92% rename from modules/cpr/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java index 214ff7f9ce1..7984b2aa9e7 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/ProtocolUtil.java @@ -15,10 +15,10 @@ */ package org.atmosphere.websocket.protocol; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; import org.atmosphere.websocket.WebSocket; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java similarity index 90% rename from modules/cpr/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java index a263bbf64f7..cd695fac2e6 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/SimpleHttpProtocol.java @@ -15,11 +15,11 @@ */ package org.atmosphere.websocket.protocol; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.websocket.WebSocket; import org.atmosphere.websocket.WebSocketProcessor; import org.atmosphere.websocket.WebSocketProtocol; @@ -35,12 +35,12 @@ import static org.atmosphere.websocket.protocol.ProtocolUtil.constructRequest; /** - * Like the {@link org.atmosphere.cpr.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket messages to the + * Like the {@link org.atmosphere.runtime.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket messages to the * proper {@link org.atmosphere.websocket.WebSocket} implementation by wrapping the Websocket message's bytes within * an {@link javax.servlet.http.HttpServletRequest}. *

        - * The content-type is defined using {@link org.atmosphere.cpr.ApplicationConfig#WEBSOCKET_CONTENT_TYPE} property - * The method is defined using {@link org.atmosphere.cpr.ApplicationConfig#WEBSOCKET_METHOD} property + * The content-type is defined using {@link org.atmosphere.runtime.ApplicationConfig#WEBSOCKET_CONTENT_TYPE} property + * The method is defined using {@link org.atmosphere.runtime.ApplicationConfig#WEBSOCKET_METHOD} property *

        * * @author Jeanfrancois Arcand diff --git a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java similarity index 89% rename from modules/cpr/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java rename to modules/runtime/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java index f02b9c522f1..d386c7b4cde 100644 --- a/modules/cpr/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java +++ b/modules/runtime/src/main/java/org/atmosphere/websocket/protocol/StreamingHttpProtocol.java @@ -15,11 +15,11 @@ */ package org.atmosphere.websocket.protocol; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.FrameworkConfig; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.FrameworkConfig; import org.atmosphere.websocket.WebSocket; import org.atmosphere.websocket.WebSocketProcessor; import org.atmosphere.websocket.WebSocketProtocolStream; @@ -34,12 +34,12 @@ import static org.atmosphere.websocket.protocol.ProtocolUtil.constructRequest; /** - * Like the {@link org.atmosphere.cpr.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket stream to the + * Like the {@link org.atmosphere.runtime.AsynchronousProcessor} class, this class is responsible for dispatching WebSocket stream to the * proper {@link org.atmosphere.websocket.WebSocket} implementation by wrapping the Websocket message's bytes within * an {@link javax.servlet.http.HttpServletRequest}. *

        - * The content-type is defined using {@link org.atmosphere.cpr.ApplicationConfig#WEBSOCKET_CONTENT_TYPE} property - * The method is defined using {@link org.atmosphere.cpr.ApplicationConfig#WEBSOCKET_METHOD} property + * The content-type is defined using {@link org.atmosphere.runtime.ApplicationConfig#WEBSOCKET_CONTENT_TYPE} property + * The method is defined using {@link org.atmosphere.runtime.ApplicationConfig#WEBSOCKET_METHOD} property *

        * * @author Jeanfrancois Arcand diff --git a/modules/runtime/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/modules/runtime/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer new file mode 100644 index 00000000000..68fdc63b95c --- /dev/null +++ b/modules/runtime/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer @@ -0,0 +1,3 @@ +runtime.AnnotationScanningServletContainerInitializer +runtime.ContainerInitializer + diff --git a/modules/cpr/src/main/resources/META-INF/services/org.atmosphere.inject.CDIProducer b/modules/runtime/src/main/resources/META-INF/services/org.atmosphere.inject.CDIProducer similarity index 100% rename from modules/cpr/src/main/resources/META-INF/services/org.atmosphere.inject.CDIProducer rename to modules/runtime/src/main/resources/META-INF/services/org.atmosphere.inject.CDIProducer diff --git a/modules/cpr/src/main/resources/META-INF/services/org.atmosphere.inject.Injectable b/modules/runtime/src/main/resources/META-INF/services/org.atmosphere.inject.Injectable similarity index 100% rename from modules/cpr/src/main/resources/META-INF/services/org.atmosphere.inject.Injectable rename to modules/runtime/src/main/resources/META-INF/services/org.atmosphere.inject.Injectable diff --git a/modules/cpr/src/main/resources/atmosphere-web.xml.template b/modules/runtime/src/main/resources/atmosphere-web.xml.template similarity index 94% rename from modules/cpr/src/main/resources/atmosphere-web.xml.template rename to modules/runtime/src/main/resources/atmosphere-web.xml.template index 6d294b0e786..a56db25da0a 100755 --- a/modules/cpr/src/main/resources/atmosphere-web.xml.template +++ b/modules/runtime/src/main/resources/atmosphere-web.xml.template @@ -17,7 +17,7 @@ AtmosphereServlet AtmosphereServlet - org.atmosphere.cpr.AtmosphereServlet + org.atmosphere.runtime.AtmosphereServlet diff --git a/modules/cpr/src/main/resources/atmosphere.xml b/modules/runtime/src/main/resources/atmosphere.xml similarity index 73% rename from modules/cpr/src/main/resources/atmosphere.xml rename to modules/runtime/src/main/resources/atmosphere.xml index d215b588a4a..850bd60f53a 100755 --- a/modules/cpr/src/main/resources/atmosphere.xml +++ b/modules/runtime/src/main/resources/atmosphere.xml @@ -36,27 +36,27 @@ - org.atmosphere.cpr.broadcasterFactory + org.atmosphere.runtime.broadcasterFactory - org.atmosphere.cpr.broadcasterClass + org.atmosphere.runtime.broadcasterClass - org.atmosphere.cpr.broadcasterCacheClass + org.atmosphere.runtime.broadcasterCacheClass - org.atmosphere.cpr.asyncSupport + org.atmosphere.runtime.asyncSupport - org.atmosphere.cpr.sessionSupport + org.atmosphere.runtime.sessionSupport @@ -67,19 +67,19 @@ - org.atmosphere.cpr.noCacheHeaders + org.atmosphere.runtime.noCacheHeaders - org.atmosphere.cpr.dropAccessControlAllowOriginHeader - + org.atmosphere.runtime.dropAccessControlAllowOriginHeader + - org.atmosphere.cpr.broadcasterLifeCyclePolicy - + org.atmosphere.runtime.broadcasterLifeCyclePolicy + @@ -114,23 +114,23 @@ - org.atmosphere.cpr.AtmosphereResource + org.atmosphere.runtime.AtmosphereResource - org.atmosphere.cpr.broadcastFilterClasses + org.atmosphere.runtime.broadcastFilterClasses - org.atmosphere.cpr.AtmosphereServlet.resumeAndKeepAlive + org.atmosphere.runtime.AtmosphereServlet.resumeAndKeepAlive - org.atmosphere.cpr.AtmosphereServlet.resumedOnTimeout + org.atmosphere.runtime.AtmosphereServlet.resumedOnTimeout @@ -141,24 +141,24 @@ - org.atmosphere.cpr.AsyncSupport.maxInactiveActivity + org.atmosphere.runtime.AsyncSupport.maxInactiveActivity - org.atmosphere.cpr.Trackable + org.atmosphere.runtime.Trackable - org.atmosphere.cpr.allowQueryStreamAsPostOrGet - + org.atmosphere.runtime.allowQueryStreamAsPostOrGet + - org.atmosphere.cpr.customCometSupport + org.atmosphere.runtime.customCometSupport @@ -192,20 +192,20 @@ - org.atmosphere.cpr.AtmosphereServlet + org.atmosphere.runtime.AtmosphereServlet - org.atmosphere.cpr.AtmosphereResource + org.atmosphere.runtime.AtmosphereResource - org.atmosphere.cpr.AsynchronousProcessor.supportSession - + org.atmosphere.runtime.AsynchronousProcessor.supportSession + - org.atmosphere.cpr.AtmosphereHandler + org.atmosphere.runtime.AtmosphereHandler @@ -213,8 +213,8 @@ - org.atmosphere.cpr.AtmosphereResource.writeHeader - + org.atmosphere.runtime.AtmosphereResource.writeHeader + diff --git a/modules/cpr/src/main/resources/atmosphere.xml.template b/modules/runtime/src/main/resources/atmosphere.xml.template similarity index 100% rename from modules/cpr/src/main/resources/atmosphere.xml.template rename to modules/runtime/src/main/resources/atmosphere.xml.template diff --git a/modules/cpr/src/main/resources/context.xml b/modules/runtime/src/main/resources/context.xml similarity index 100% rename from modules/cpr/src/main/resources/context.xml rename to modules/runtime/src/main/resources/context.xml diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java similarity index 93% rename from modules/cpr/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java index 3ad5f98e6a7..8d5dfe5f076 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/EncoderDecoderTest.java @@ -20,18 +20,18 @@ import org.atmosphere.config.service.Get; import org.atmosphere.config.service.ManagedService; import org.atmosphere.config.service.Message; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsyncIOWriter; -import org.atmosphere.cpr.AsyncIOWriterAdapter; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsyncIOWriter; +import org.atmosphere.runtime.AsyncIOWriterAdapter; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.*; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.*; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java similarity index 94% rename from modules/cpr/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java index 08437d8ba64..2d1a6165af4 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/ManagedAtmosphereHandlerTest.java @@ -23,28 +23,28 @@ import org.atmosphere.config.service.Put; import org.atmosphere.config.service.Ready; import org.atmosphere.config.service.WebSocketHandlerService; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.ApplicationConfig; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereInterceptorAdapter; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceFactory; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResourceSessionFactory; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.BroadcasterFactory; -import org.atmosphere.cpr.DefaultMetaBroadcaster; -import org.atmosphere.cpr.FrameworkConfig; -import org.atmosphere.cpr.MetaBroadcaster; -import org.atmosphere.cpr.WebSocketProcessorFactory; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.ApplicationConfig; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereInterceptorAdapter; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceFactory; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResourceSessionFactory; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.BroadcasterFactory; +import org.atmosphere.runtime.DefaultMetaBroadcaster; +import org.atmosphere.runtime.FrameworkConfig; +import org.atmosphere.runtime.MetaBroadcaster; +import org.atmosphere.runtime.WebSocketProcessorFactory; import org.atmosphere.interceptor.HeartbeatInterceptor; import org.atmosphere.interceptor.InvokationOrder; import org.atmosphere.util.ExcludeSessionBroadcaster; @@ -73,10 +73,10 @@ import java.util.Enumeration; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter.OnSuspend; -import static org.atmosphere.cpr.HeaderConfig.LONG_POLLING_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.WEBSOCKET_TRANSPORT; -import static org.atmosphere.cpr.HeaderConfig.X_ATMOSPHERE_TRANSPORT; +import static org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnSuspend; +import static org.atmosphere.runtime.HeaderConfig.LONG_POLLING_TRANSPORT; +import static org.atmosphere.runtime.HeaderConfig.WEBSOCKET_TRANSPORT; +import static org.atmosphere.runtime.HeaderConfig.X_ATMOSPHERE_TRANSPORT; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java similarity index 88% rename from modules/cpr/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java index db35ac87c57..fcdf86b2e7a 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/cache/ManagedAtmosphereHandlerTest.java @@ -17,15 +17,15 @@ import org.atmosphere.cache.UUIDBroadcasterCache; import org.atmosphere.config.service.ManagedService; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java similarity index 90% rename from modules/cpr/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java index a2d01519f3e..98c8c773406 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/custom/CustomAnnotationTest.java @@ -17,16 +17,16 @@ import org.atmosphere.annotation.Processor; import org.atmosphere.config.AtmosphereAnnotation; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/path/PathTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/path/PathTest.java similarity index 95% rename from modules/cpr/src/test/java/org/atmosphere/annotation/path/PathTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/path/PathTest.java index 0a48f71c0f6..bfa323f7ba2 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/path/PathTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/path/PathTest.java @@ -22,21 +22,21 @@ import org.atmosphere.config.service.PathParam; import org.atmosphere.config.service.Singleton; import org.atmosphere.config.service.WebSocketHandlerService; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereHandler; -import org.atmosphere.cpr.AtmosphereInterceptor; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceEvent; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.Broadcaster; -import org.atmosphere.cpr.WebSocketProcessorFactory; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereHandler; +import org.atmosphere.runtime.AtmosphereInterceptor; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceEvent; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.Broadcaster; +import org.atmosphere.runtime.WebSocketProcessorFactory; import org.atmosphere.websocket.WebSocket; import org.atmosphere.websocket.WebSocketHandlerAdapter; import org.atmosphere.websocket.WebSocketProcessor; diff --git a/modules/cpr/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java b/modules/runtime/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java similarity index 86% rename from modules/cpr/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java rename to modules/runtime/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java index b0c47e73102..2b9170c35ec 100644 --- a/modules/cpr/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/annotation/scanning/AnnotationScanningTest.java @@ -16,16 +16,16 @@ package org.atmosphere.annotation.scanning; import org.atmosphere.config.service.AtmosphereResourceListenerService; -import org.atmosphere.cpr.Action; -import org.atmosphere.cpr.AsynchronousProcessor; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResource; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResourceListener; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.Action; +import org.atmosphere.runtime.AsynchronousProcessor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResource; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResourceListener; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.atmosphere.handler.AtmosphereHandlerAdapter; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.BeforeMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java b/modules/runtime/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java rename to modules/runtime/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java index ca82118b782..194dc551992 100644 --- a/modules/cpr/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/container/version/JSR356WebSocketTest.java @@ -15,7 +15,7 @@ */ package org.atmosphere.container.version; -import org.atmosphere.cpr.*; +import org.atmosphere.runtime.*; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.testng.annotations.BeforeMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java b/modules/runtime/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java similarity index 86% rename from modules/cpr/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java rename to modules/runtime/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java index d681033df46..2c2ed8815b6 100644 --- a/modules/cpr/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/interceptor/SSEAtmosphereInterceptorTest.java @@ -15,15 +15,15 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.AsyncSupport; -import org.atmosphere.cpr.AtmosphereConfig; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereRequest; -import org.atmosphere.cpr.AtmosphereRequestImpl; -import org.atmosphere.cpr.AtmosphereResourceImpl; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; -import org.atmosphere.cpr.HeaderConfig; +import org.atmosphere.runtime.AsyncSupport; +import org.atmosphere.runtime.AtmosphereConfig; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl; +import org.atmosphere.runtime.AtmosphereResourceImpl; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; +import org.atmosphere.runtime.HeaderConfig; import org.mockito.Mockito; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -32,6 +32,7 @@ import javax.servlet.ServletContext; import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; +import javax.servlet.WriteListener; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -77,6 +78,16 @@ public void testDataWriter() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); ServletResponse resp = Mockito.mock(HttpServletResponse.class); Mockito.when(resp.getOutputStream()).thenReturn(new ServletOutputStream() { + @Override + public boolean isReady() { + return true; + } + + @Override + public void setWriteListener(WriteListener writeListener) { + + } + @Override public void write(int b) throws IOException { baos.write(b); diff --git a/modules/cpr/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java b/modules/runtime/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java rename to modules/runtime/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java index 98cbec7206d..4b3c7cb453a 100644 --- a/modules/cpr/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/interceptor/SimpleRestInterceptorTest.java @@ -15,17 +15,13 @@ */ package org.atmosphere.interceptor; -import org.atmosphere.cpr.*; +import org.atmosphere.runtime.*; import org.atmosphere.util.IOUtils; import org.mockito.Mockito; import org.testng.annotations.Test; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.Reader; import java.io.StringReader; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AsyncIOInterceptorTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AsyncIOInterceptorTest.java similarity index 95% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AsyncIOInterceptorTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AsyncIOInterceptorTest.java index 3e81784a6fe..b9f02b9d000 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AsyncIOInterceptorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AsyncIOInterceptorTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.testng.annotations.Test; @@ -21,14 +21,14 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM; +import static org.atmosphere.runtime.ApplicationConfig.PROPERTY_USE_STREAM; import static org.testng.Assert.assertEquals; public class AsyncIOInterceptorTest { @Test public void singleTest() throws ServletException, IOException { - final AtomicReference s = new AtomicReference(); + final AtomicReference s = new AtomicReference<>(); AtmosphereResponse res = AtmosphereResponseImpl.newInstance().request(AtmosphereRequestImpl.newInstance()); res.request().setAttribute(PROPERTY_USE_STREAM, false); res.asyncIOWriter(new AtmosphereInterceptorWriter().interceptor(new AsyncIOInterceptor() { @@ -61,7 +61,7 @@ public void redirect(AtmosphereResponse response, String location) { @Test public void chaining() throws ServletException, IOException { - final AtomicReference s = new AtomicReference(new StringBuffer()); + final AtomicReference s = new AtomicReference<>(new StringBuffer()); AtmosphereResponse res = AtmosphereResponseImpl.newInstance().request(AtmosphereRequestImpl.newInstance()); res.request().setAttribute(PROPERTY_USE_STREAM, false); res.asyncIOWriter(new AtmosphereInterceptorWriter().interceptor(new AsyncIOInterceptor() { diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereFrameworkTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereFrameworkTest.java similarity index 75% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereFrameworkTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereFrameworkTest.java index 7cdf5cd338e..4bee019e3f1 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereFrameworkTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereFrameworkTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.ServletContextFactory; import org.testng.annotations.Test; @@ -36,48 +36,6 @@ public class AtmosphereFrameworkTest { - /** - *

        - * Test interceptor installation through meta service file declaration. - *

        - * - * @throws Exception if test fails - */ - @Test - public void testInterceptorInstalledByMetaService() throws Exception { - final AtmosphereFramework framework = new AtmosphereFramework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); - framework.addAtmosphereHandler("/*", mock(AtmosphereHandler.class)); - - // Where the file describing the interceptor to install is stored - framework.metaServicePath = "META-INF/test-services/"; - framework.init(); - final AsynchronousProcessor processor = new AsynchronousProcessor(framework.getAtmosphereConfig()) { - @Override - public org.atmosphere.cpr.Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException { - return action(req, res); - } - }; - - framework.setAsyncSupport(processor); - final AtomicReference value = new AtomicReference(); - - // Intercepts interceptor call - final AtmosphereRequest r = new AtmosphereRequestImpl.Builder().request(new HttpServletRequestWrapper(new AtmosphereRequestImpl.NoOpsRequest()) { - @Override - public void setAttribute(String name, Object o) { - if (MyInterceptor.class.getName().equals(name)) { - value.set(o); - } - super.setAttribute(name, o); - } - }).build(); - processor.action(r, AtmosphereResponseImpl.newInstance()); - assertNotNull(value.get()); - - // The interceptor must be installed and called one time. - assertEquals(1, value.get()); - } - @Test public void testBroadcasterFactory() throws Exception { AtmosphereFramework f = new AtmosphereFramework(); @@ -87,14 +45,14 @@ public void testBroadcasterFactory() throws Exception { @Test public void testServletContextFactory() throws ServletException { - AtmosphereFramework f = new AtmosphereFramework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); + AtmosphereFramework f = new AtmosphereFramework();; f.init(); assertNotNull(ServletContextFactory.getDefault().getServletContext()); } @Test public void testReload() throws ServletException { - AtmosphereFramework f = new AtmosphereFramework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); + AtmosphereFramework f = new AtmosphereFramework();; f.init(); f.destroy(); f.init(); @@ -117,9 +75,6 @@ public ServletContext getServletContext() { @Override public String getInitParameter(String name) { - if (ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356.equals(name)) { - return "true"; - } return null; } @@ -170,9 +125,6 @@ public ServletContext getServletContext() { @Override public String getInitParameter(String name) { - if (ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356.equals(name)) { - return "true"; - } return null; } @@ -314,7 +266,7 @@ public Collection broadcasterListeners() { @Test public void testIsInit() throws ServletException { - AtmosphereFramework f = new AtmosphereFramework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); + AtmosphereFramework f = new AtmosphereFramework();; f.init(); final AtomicBoolean b = new AtomicBoolean(); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereHandlerTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereHandlerTest.java similarity index 97% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereHandlerTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereHandlerTest.java index 3c3d70593fc..8df1a67daae 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereHandlerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereHandlerTest.java @@ -13,9 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -135,7 +135,7 @@ public AsyncIOWriter write(AtmosphereResponse r, byte[] data) throws IOException broadcaster, mock(AtmosphereRequestImpl.class), r, - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorTest.java index 68cdc2b924a..1406d7a5770 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.interceptor.InvokationOrder; import org.mockito.Mockito; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorWriterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorWriterTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorWriterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorWriterTest.java index e3c5b9cd3ec..0ecfc78a0bd 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereInterceptorWriterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereInterceptorWriterTest.java @@ -13,12 +13,12 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; - -import java.io.IOException; +package org.atmosphere.runtime; import org.testng.annotations.Test; +import java.io.IOException; + import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereRequestTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereRequestTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereRequestTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereRequestTest.java index ee4d9dd9fbb..bf627d66ca8 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereRequestTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereRequestTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceFactoryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceFactoryTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceFactoryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceFactoryTest.java index 641524f39fe..8ee14360889 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceFactoryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceFactoryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceListenerTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceListenerTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceListenerTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceListenerTest.java index a726216e5db..789ad5dc0c1 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceListenerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceListenerTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceStateRecoveryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceStateRecoveryTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceStateRecoveryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceStateRecoveryTest.java index 9d3f66f8258..f0227c1f978 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceStateRecoveryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceStateRecoveryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.UUIDBroadcasterCache; import org.atmosphere.handler.AtmosphereHandlerAdapter; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceTest.java similarity index 97% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceTest.java index 571f61004df..fc00e76f6a9 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereResourceTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereResourceTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.handler.AbstractReflectorAtmosphereHandler; @@ -22,16 +22,25 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import javax.servlet.*; +import javax.servlet.AsyncContext; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletOutputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; -import java.util.*; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereSessionTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereSessionTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereSessionTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereSessionTest.java index 80fd9d4c2ca..888b8a322f6 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/AtmosphereSessionTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/AtmosphereSessionTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.handler.AtmosphereHandlerAdapter; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcastFilterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcastFilterTest.java similarity index 97% rename from modules/cpr/src/test/java/org/atmosphere/cpr/BroadcastFilterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/BroadcastFilterTest.java index f8fbde328b9..140fa2b0685 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcastFilterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcastFilterTest.java @@ -13,10 +13,10 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.client.TrackMessageSizeFilter; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -54,7 +54,7 @@ public void setUp() throws Exception { broadcaster, req, AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -72,7 +72,7 @@ public void testProgrammaticBroadcastFilter() throws ExecutionException, Interru public void testInitBroadcastFilter() throws ExecutionException, InterruptedException, ServletException { AtmosphereConfig config = new AtmosphereFramework() .addInitParameter(ApplicationConfig.BROADCAST_FILTER_CLASSES, Filter.class.getName()) - .setAsyncSupport(mock(BlockingIOCometSupport.class)) + .setAsyncSupport(mock(Servlet30CometSupport.class)) .init(new ServletConfig() { @Override public String getServletName() { @@ -103,7 +103,7 @@ public Enumeration getInitParameterNames() { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -242,7 +242,7 @@ public void testMultipleMessageLengthFilter() throws ExecutionException, Interru broadcaster, req, AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), new AR())); } @@ -263,7 +263,7 @@ public void testSetMultipleMessageLengthFilter() throws ExecutionException, Inte broadcaster, req, AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), new AR()); broadcaster.addAtmosphereResource(ar); } diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterCacheTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterCacheTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterCacheTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterCacheTest.java index fdb73da6a20..72fd6c286df 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterCacheTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterCacheTest.java @@ -13,14 +13,14 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.AbstractBroadcasterCache; import org.atmosphere.cache.BroadcastMessage; import org.atmosphere.cache.BroadcasterCacheInspector; import org.atmosphere.cache.CacheMessage; import org.atmosphere.cache.UUIDBroadcasterCache; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; @@ -60,7 +60,7 @@ public void setUp() throws Exception { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterLifecyclePolicyTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterLifecyclePolicyTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterLifecyclePolicyTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterLifecyclePolicyTest.java index 624920b9b7a..51f2f4faa71 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterLifecyclePolicyTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterLifecyclePolicyTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterListenerTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterListenerTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterListenerTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterListenerTest.java index 49782bde358..f73d24c20a8 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterListenerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterListenerTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.UUIDBroadcasterCache; import org.atmosphere.util.SimpleBroadcaster; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterTest.java similarity index 96% rename from modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterTest.java index f65fcbdf567..06715266779 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/BroadcasterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/BroadcasterTest.java @@ -13,12 +13,18 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import static org.mockito.Mockito.mock; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import org.atmosphere.container.Servlet30CometSupport; +import org.atmosphere.util.ExecutorsFactory; +import org.testng.Assert; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; import java.io.IOException; import java.util.Enumeration; import java.util.HashSet; @@ -26,17 +32,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.util.ExecutorsFactory; -import org.atmosphere.util.SimpleBroadcaster; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +import static org.mockito.Mockito.mock; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; public class BroadcasterTest { @@ -56,7 +54,7 @@ public void setUp() throws Exception { broadcaster, AtmosphereRequestImpl.newInstance(), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -135,7 +133,7 @@ public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOEx @Test public void testSetBroadcastMethod() throws ExecutionException, InterruptedException, ServletException { AtmosphereConfig config = new AtmosphereFramework() - .setAsyncSupport(mock(BlockingIOCometSupport.class)) + .setAsyncSupport(mock(Servlet30CometSupport.class)) .init(new ServletConfig() { @Override public String getServletName() { @@ -166,19 +164,19 @@ public Enumeration getInitParameterNames() { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); AtmosphereResource ar2 = new AtmosphereResourceImpl(config, broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); AtmosphereResource ar3 = new AtmosphereResourceImpl(config, broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar).addAtmosphereResource(ar2).addAtmosphereResource(ar3); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/ConcurrentBroadcasterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/ConcurrentBroadcasterTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/ConcurrentBroadcasterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/ConcurrentBroadcasterTest.java index df35df9665a..33840cdb3d1 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/ConcurrentBroadcasterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/ConcurrentBroadcasterTest.java @@ -13,9 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.SimpleBroadcaster; import org.testng.annotations.AfterMethod; @@ -102,7 +102,7 @@ public void testOrderedConcurrentBroadcast() throws InterruptedException { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -310,7 +310,7 @@ public void testOrderedSimpleBroadcast() throws InterruptedException { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -345,7 +345,7 @@ AtmosphereResource newAR(AtmosphereHandler a) { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), a); } } diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/CookieTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/CookieTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/CookieTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/CookieTest.java index 824e3654f31..54ba396ba6b 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/CookieTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/CookieTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.testng.annotations.AfterMethod; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAsyncSupportResolverTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAsyncSupportResolverTest.java similarity index 80% rename from modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAsyncSupportResolverTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAsyncSupportResolverTest.java index 59c4fb8a52b..db6a6af5f77 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAsyncSupportResolverTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAsyncSupportResolverTest.java @@ -13,9 +13,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.container.Servlet30CometSupport; import org.testng.Assert; import org.testng.annotations.AfterMethod; @@ -41,7 +40,6 @@ public class DefaultAsyncSupportResolverTest { @BeforeMethod public void setUp() throws Exception { config = new AtmosphereFramework() - .addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true") .init().getAtmosphereConfig(); defaultAsyncSupportResolver = new DefaultAsyncSupportResolver(config); } @@ -84,7 +82,7 @@ public void testAsyncSupportClassNotFoundDefaultsToServlet30IfAvailable(){ } @Test - public void testAsyncSupportClassNotFoundDefaultsToBlockingIOIfServlet30IsNotAvailable(){ + public void testAsyncSupportClassNotFoundDefaultsToBlockingIOIfServlet30IsNotAvailable() { boolean useNativeIfPossible = false; boolean defaultToBlocking = false; boolean useServlet30Async = true; @@ -95,7 +93,7 @@ public void testAsyncSupportClassNotFoundDefaultsToBlockingIOIfServlet30IsNotAva // Override the container detection mechanism to use an invalid Async Support class only defaultAsyncSupportResolver = spy(defaultAsyncSupportResolver); - List> asyncSupportList = new ArrayList(){{ + List> asyncSupportList = new ArrayList() {{ add(InvalidAsyncSupportClass.class); }}; doReturn(asyncSupportList) @@ -107,28 +105,6 @@ public void testAsyncSupportClassNotFoundDefaultsToBlockingIOIfServlet30IsNotAva doReturn(false) .when(defaultAsyncSupportResolver) .testClassExists(DefaultAsyncSupportResolver.SERVLET_30); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.TOMCAT_WEBSOCKET); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.JETTY_9); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.JETTY_8); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.GRIZZLY2_WEBSOCKET); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.GRIZZLY_WEBSOCKET); - doReturn(false) - .when(defaultAsyncSupportResolver) - .testClassExists(DefaultAsyncSupportResolver.JBOSS_AS7_WEBSOCKET); - - Assert.assertEquals( - defaultAsyncSupportResolver.resolve(useNativeIfPossible, defaultToBlocking, useServlet30Async).getClass(), - BlockingIOCometSupport.class); } class InvalidAsyncSupportClass implements AsyncSupport{ diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactoryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactoryTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactoryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactoryTest.java index 3e4a682379e..19ef5a5ffac 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultAtmosphereResourceSessionFactoryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultAtmosphereResourceSessionFactoryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.mockito.Mockito; import org.testng.annotations.Test; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterFactoryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterFactoryTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterFactoryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterFactoryTest.java index 10bb532dc4e..3b5de7322f3 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterFactoryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterFactoryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.ExecutorsFactory; import org.atmosphere.util.SimpleBroadcaster; @@ -32,7 +32,7 @@ import static org.testng.Assert.assertTrue; /** - * Unit tests for the {@link org.atmosphere.cpr.DefaultBroadcasterFactory}. + * Unit tests for the {@link org.atmosphere.runtime.DefaultBroadcasterFactory}. * * @author Jason Burgess */ diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterTest.java similarity index 96% rename from modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterTest.java index 6c0b335a1e1..a7afdf6b089 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/DefaultBroadcasterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/DefaultBroadcasterTest.java @@ -13,13 +13,13 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.AbstractBroadcasterCache; import org.atmosphere.cache.BroadcastMessage; import org.atmosphere.cache.CacheMessage; -import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.cpr.BroadcasterCacheTest.AR; +import org.atmosphere.container.Servlet30CometSupport; +import org.atmosphere.runtime.BroadcasterCacheTest.AR; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -97,7 +97,7 @@ public List retrieveFromCache(String id, String uuid) { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), new AR()); final String message = "foo"; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/ExcludeSessionBroadcasterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/ExcludeSessionBroadcasterTest.java similarity index 95% rename from modules/cpr/src/test/java/org/atmosphere/cpr/ExcludeSessionBroadcasterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/ExcludeSessionBroadcasterTest.java index aac1a9c61ee..d37d3d275bd 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/ExcludeSessionBroadcasterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/ExcludeSessionBroadcasterTest.java @@ -13,9 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.util.ExcludeSessionBroadcaster; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -50,7 +50,7 @@ public void setUp() throws Exception { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/MetaBroadcasterTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/MetaBroadcasterTest.java similarity index 96% rename from modules/cpr/src/test/java/org/atmosphere/cpr/MetaBroadcasterTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/MetaBroadcasterTest.java index 598cc65fd05..50a8df68f0e 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/MetaBroadcasterTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/MetaBroadcasterTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.ExecutorsFactory; import org.testng.annotations.AfterMethod; @@ -31,7 +31,7 @@ public class MetaBroadcasterTest { @BeforeMethod public void setUp() throws Exception { - AtmosphereFramework f = new AtmosphereFramework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); + AtmosphereFramework f = new AtmosphereFramework(); config = f.init().getAtmosphereConfig(); factory = config.getBroadcasterFactory(); factory.remove(Broadcaster.ROOT_MASTER); diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/PoolableBroadcasterFactoryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/PoolableBroadcasterFactoryTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/PoolableBroadcasterFactoryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/PoolableBroadcasterFactoryTest.java index f0c8661210f..775eecdcab0 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/PoolableBroadcasterFactoryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/PoolableBroadcasterFactoryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/QueryStringTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/QueryStringTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/QueryStringTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/QueryStringTest.java index 06e1ede2af7..bd2dcae4c41 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/QueryStringTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/QueryStringTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.testng.annotations.BeforeMethod; @@ -22,7 +22,6 @@ import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; - import java.io.IOException; import java.util.Enumeration; import java.util.LinkedHashMap; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/ServiceTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/ServiceTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/ServiceTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/ServiceTest.java index 00e34baa51f..132a6b52ab4 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/ServiceTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/ServiceTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.config.service.AtmosphereFrameworkListenerService; import org.atmosphere.config.service.BroadcasterService; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/SessionTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/SessionTest.java similarity index 97% rename from modules/cpr/src/test/java/org/atmosphere/cpr/SessionTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/SessionTest.java index ac6c10e8b2d..39c40e998d4 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/SessionTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/SessionTest.java @@ -13,9 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.cpr.AtmosphereRequestImpl.NoOpsRequest; +import org.atmosphere.runtime.AtmosphereRequestImpl.NoOpsRequest; import org.atmosphere.util.FakeHttpSession; import org.testng.annotations.Test; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/TrackMessageSizeInterceptorTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/TrackMessageSizeInterceptorTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/TrackMessageSizeInterceptorTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/TrackMessageSizeInterceptorTest.java index 45cc2db45b5..44faa3420ca 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/TrackMessageSizeInterceptorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/TrackMessageSizeInterceptorTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.client.TrackMessageSizeInterceptor; import org.atmosphere.interceptor.TrackMessageSizeB64Interceptor; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/UUIDBroadcasterCacheTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/UUIDBroadcasterCacheTest.java similarity index 97% rename from modules/cpr/src/test/java/org/atmosphere/cpr/UUIDBroadcasterCacheTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/UUIDBroadcasterCacheTest.java index 0112c016f8d..9c909468177 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/UUIDBroadcasterCacheTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/UUIDBroadcasterCacheTest.java @@ -13,10 +13,10 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.cache.UUIDBroadcasterCache; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.atmosphere.util.ExecutorsFactory; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -57,7 +57,7 @@ public void setUp() throws Exception { broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); } diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/UrlMappingTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/UrlMappingTest.java similarity index 99% rename from modules/cpr/src/test/java/org/atmosphere/cpr/UrlMappingTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/UrlMappingTest.java index 3fa51c994a3..ce3e8488b2e 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/UrlMappingTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/UrlMappingTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.util.DefaultEndpointMapper; import org.atmosphere.util.EndpointMapper; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketFactoryTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketFactoryTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketFactoryTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketFactoryTest.java index ce0046d2c35..63683607982 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketFactoryTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketFactoryTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.config.service.WebSocketFactoryService; import org.atmosphere.websocket.WebSocket; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketHandlerTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketHandlerTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketHandlerTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketHandlerTest.java index 538035f42c4..cab8e6fede1 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketHandlerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketHandlerTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.util.SimpleBroadcaster; @@ -34,7 +34,7 @@ import java.util.Enumeration; import java.util.concurrent.ExecutionException; -import static org.atmosphere.cpr.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketProcessorTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketProcessorTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketProcessorTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketProcessorTest.java index 9a046577977..e631f61ef6c 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketProcessorTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketProcessorTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.websocket.WebSocket; import org.atmosphere.websocket.WebSocketEventListener; @@ -40,8 +40,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import static org.atmosphere.cpr.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; -import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; +import static org.atmosphere.runtime.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID; import static org.atmosphere.websocket.WebSocketEventListener.WebSocketEvent.TYPE.DISCONNECT; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertEquals; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketStreamingHandlerTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketStreamingHandlerTest.java similarity index 98% rename from modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketStreamingHandlerTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketStreamingHandlerTest.java index d6226a31684..b8d95643cb6 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/WebSocketStreamingHandlerTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/WebSocketStreamingHandlerTest.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; import org.atmosphere.container.BlockingIOCometSupport; import org.atmosphere.websocket.WebSocket; @@ -35,7 +35,7 @@ import java.util.Enumeration; import java.util.concurrent.ExecutionException; -import static org.atmosphere.cpr.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; +import static org.atmosphere.runtime.ApplicationConfig.RECYCLE_ATMOSPHERE_REQUEST_RESPONSE; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; diff --git a/modules/cpr/src/test/java/org/atmosphere/cpr/WriteTimeoutTest.java b/modules/runtime/src/test/java/org/atmosphere/runtime/WriteTimeoutTest.java similarity index 92% rename from modules/cpr/src/test/java/org/atmosphere/cpr/WriteTimeoutTest.java rename to modules/runtime/src/test/java/org/atmosphere/runtime/WriteTimeoutTest.java index 09852e0432d..62221d6b0c8 100644 --- a/modules/cpr/src/test/java/org/atmosphere/cpr/WriteTimeoutTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/runtime/WriteTimeoutTest.java @@ -13,9 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package org.atmosphere.cpr; +package org.atmosphere.runtime; -import org.atmosphere.container.BlockingIOCometSupport; +import org.atmosphere.container.Servlet30CometSupport; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -41,8 +41,7 @@ public class WriteTimeoutTest { @BeforeMethod public void setUp() throws Exception { config = new AtmosphereFramework() - .addInitParameter("org.atmosphere.cpr.Broadcaster.writeTimeout", "2000") - .addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true") + .addInitParameter("org.atmosphere.runtime.Broadcaster.writeTimeout", "2000") .init().getAtmosphereConfig(); DefaultBroadcasterFactory factory = new DefaultBroadcasterFactory(DefaultBroadcaster.class, "NEVER", config); config.framework().setBroadcasterFactory(factory); @@ -65,7 +64,7 @@ public void testWriteTimeout() throws ExecutionException, InterruptedException, broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); @@ -91,7 +90,7 @@ public void testNoWriteTimeout() throws ExecutionException, InterruptedException broadcaster, mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance(), - mock(BlockingIOCometSupport.class), + mock(Servlet30CometSupport.class), atmosphereHandler); broadcaster.addAtmosphereResource(ar); diff --git a/modules/cpr/src/test/java/org/atmosphere/util/ChunkConcatReaderPoolTest.java b/modules/runtime/src/test/java/org/atmosphere/util/ChunkConcatReaderPoolTest.java similarity index 100% rename from modules/cpr/src/test/java/org/atmosphere/util/ChunkConcatReaderPoolTest.java rename to modules/runtime/src/test/java/org/atmosphere/util/ChunkConcatReaderPoolTest.java diff --git a/modules/cpr/src/test/java/org/atmosphere/util/CookieUtilTest.java b/modules/runtime/src/test/java/org/atmosphere/util/CookieUtilTest.java similarity index 100% rename from modules/cpr/src/test/java/org/atmosphere/util/CookieUtilTest.java rename to modules/runtime/src/test/java/org/atmosphere/util/CookieUtilTest.java diff --git a/modules/cpr/src/test/java/org/atmosphere/util/IOUtilsTest.java b/modules/runtime/src/test/java/org/atmosphere/util/IOUtilsTest.java similarity index 100% rename from modules/cpr/src/test/java/org/atmosphere/util/IOUtilsTest.java rename to modules/runtime/src/test/java/org/atmosphere/util/IOUtilsTest.java diff --git a/modules/cpr/src/test/java/org/atmosphere/websocket/WebSocketTest.java b/modules/runtime/src/test/java/org/atmosphere/websocket/WebSocketTest.java similarity index 96% rename from modules/cpr/src/test/java/org/atmosphere/websocket/WebSocketTest.java rename to modules/runtime/src/test/java/org/atmosphere/websocket/WebSocketTest.java index 25660aaaffc..28c70d3c738 100644 --- a/modules/cpr/src/test/java/org/atmosphere/websocket/WebSocketTest.java +++ b/modules/runtime/src/test/java/org/atmosphere/websocket/WebSocketTest.java @@ -16,10 +16,10 @@ package org.atmosphere.websocket; import org.atmosphere.container.BlockingIOCometSupport; -import org.atmosphere.cpr.AsyncIOInterceptor; -import org.atmosphere.cpr.AtmosphereFramework; -import org.atmosphere.cpr.AtmosphereResponse; -import org.atmosphere.cpr.AtmosphereResponseImpl; +import org.atmosphere.runtime.AsyncIOInterceptor; +import org.atmosphere.runtime.AtmosphereFramework; +import org.atmosphere.runtime.AtmosphereResponse; +import org.atmosphere.runtime.AtmosphereResponseImpl; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/modules/runtime/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework b/modules/runtime/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework new file mode 100644 index 00000000000..c7b0eb53340 --- /dev/null +++ b/modules/runtime/src/test/resources/META-INF/test-services/org.atmosphere.cpr.AtmosphereFramework @@ -0,0 +1,2 @@ +INSTALL +org.atmosphere.runtime.AtmosphereFrameworkTest$MyInterceptor \ No newline at end of file diff --git a/modules/cpr/src/test/resources/logback-test.xml b/modules/runtime/src/test/resources/logback-test.xml similarity index 100% rename from modules/cpr/src/test/resources/logback-test.xml rename to modules/runtime/src/test/resources/logback-test.xml diff --git a/pom.xml b/pom.xml index 00ab84cd97e..b30431c7f7d 100755 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ maven-compiler-plugin - 2.3.2 + 3.3 1.8 1.8 @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.3.1 + 2.6 @@ -112,16 +112,16 @@ org.apache.maven.plugins maven-site-plugin - 2.1 + 3.4 org.apache.maven.plugins maven-release-plugin - 2.5 + 2.5.2 maven-clean-plugin - 2.4 + 2.6.1 @@ -206,7 +206,7 @@ atmosphere-pmd-ruleset.xml UTF-8 - 1.7 + 1.8 false true true @@ -227,7 +227,7 @@ org.apache.maven.plugins maven-eclipse-plugin - 2.6 + 2.9 @@ -252,7 +252,7 @@ true org.apache.maven.plugins maven-source-plugin - 2.1.2 + 3.0.0 attach-sources @@ -265,7 +265,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.5 + 2.10.3 true 1.7 @@ -288,7 +288,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.5 + 1.9.1 add-source @@ -345,7 +345,7 @@ true org.apache.maven.plugins maven-source-plugin - 2.1.2 + 3.0.0 attach-sources @@ -358,7 +358,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.5 + 2.10.3 true 1.6 @@ -393,7 +393,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 + 2.10.3 true true @@ -409,15 +409,12 @@ org.apache.maven.plugins maven-jxr-plugin - 2.3 - - true - + 2.5 org.apache.maven.plugins maven-project-info-reports-plugin - 2.4 + 2.8.1 @@ -484,60 +481,12 @@ - - org.eclipse.jetty - jetty-websocket - ${jetty7-version} - provided - - - javax.servlet - servlet-api - - - org.testng testng ${testng-version} test - - org.mortbay.jetty - jetty - ${jetty-version} - provided - - - org.mortbay.jetty - servlet-api - - - - - org.mortbay.jetty - jetty-util - ${jetty-version} - provided - - - org.mortbay.jetty - servlet-api - - - - - org.mortbay.jetty - jetty-management - ${jetty-version} - provided - - - org.mortbay.jetty - servlet-api - - - com.ning async-http-client @@ -584,28 +533,14 @@ - 6.1.22 - 1.19 - 2.2.11 - 4.11 3.1.0 [2.5,4) - 1.9.57 - 2.3.24 - 2.1.1.GA - 1.0.31 - 7.6.9.v20130131 - 8.1.17.v20150415 - 9.3.5.v20151012 - 6.0.35 - 7.0.35 1.2.1 2.4.0 1.9.33 1.7.13 1.7.13 1.1.2 - 0.5 2.0.1 1.2.4 2.4.2