-
-
Notifications
You must be signed in to change notification settings - Fork 751
Using URI path templates with annotated classes
Available with @WebSocketService, @ManagedService, @MeteorService or @AtmosphereHandlerService, URI path templates are URIs with variables embedded within the URI syntax. These variables are substituted at runtime in order for a @...Service to respond to a request based on the substituted URI. Variables are denoted by curly braces. For example, look at the following @ManagedService annotation:
@ManagedService(path = "{chatroom}")
public class ChatRoom {
}
If it is required that a chatroom must only consist of lower and upper case numeric characters then it is possible to declare a particular regular expression, which overrides the default regular expression, "[^/]+?", for example:
@ManagedService(path = "{chatroom: [a-zA-Z][a-zA-Z_0-9]*}")
public class ChatRoom {
}
In this type of example the chatroom variable will only match names that begin with one upper or lower case letter and zero or more alpha numeric characters and the underscore character. If a name does not match that a 404 (Not Found) response will occur.
By default, Every value evaluated from curly braces will have their own instance of the annotated classes. If you need a single class, use the @Singleton annotation.
@Singleton
@ManagedService(path = "{chatroom: [a-zA-Z][a-zA-Z_0-9]*}")
public class ChatRoom {
}
- Understanding Atmosphere
- Understanding @ManagedService
- Using javax.inject.Inject and javax.inject.PostConstruct annotation
- Understanding Atmosphere's Annotation
- Understanding AtmosphereResource
- Understanding AtmosphereHandler
- Understanding WebSocketHandler
- Understanding Broadcaster
- Understanding BroadcasterCache
- Understanding Meteor
- Understanding BroadcastFilter
- Understanding Atmosphere's Events Listeners
- Understanding AtmosphereInterceptor
- Configuring Atmosphere for Performance
- Understanding JavaScript functions
- Understanding AtmosphereResourceSession
- Improving Performance by using the PoolableBroadcasterFactory
- Using Atmosphere Jersey API
- Using Meteor API
- Using AtmosphereHandler API
- Using Socket.IO
- Using GWT
- Writing HTML5 Server-Sent Events
- Using STOMP protocol
- Streaming WebSocket messages
- Configuring Atmosphere's Classes Creation and Injection
- Using AtmosphereInterceptor to customize Atmosphere Framework
- Writing WebSocket sub protocol
- Configuring Atmosphere for the Cloud
- Injecting Atmosphere's Components in Jersey
- Sharing connection between Browser's windows and tabs
- Understanding AtmosphereResourceSession
- Manage installed services
- Server Side: javadoc API
- Server Side: atmosphere.xml and web.xml configuration
- Client Side: atmosphere.js API