-
-
Notifications
You must be signed in to change notification settings - Fork 750
Getting started with GWT
You will need the following dependencies to get started:
<dependencies>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-gwt-client</artifactId>
<version>1.0.0.beta1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-gwt-server</artifactId>
<version>1.0.0.beta1</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
The atmosphere-gwt-client has scope provided because these Java classes will be transformed to javascript and are included into the resulting war package.You should select the slf4j package for the logging framework that you will use. Here we selected the jdk14 bridge for java.util.logging. You can define the following properties for convenience and we will refer to them in this document:
<properties>
<gwtModule>org.atmosphere.samples.GWTDemo</gwtModule>
<gwt.compiler.force>false</gwt.compiler.force>
<gwt.draftCompile>false</gwt.draftCompile>
<gwt.style>OBF</gwt.style>
</properties>
defines the basename and package of your main .gwt.xml file. So in the case of the gwt-demo it is located in src/main/resources/org/atmosphere/samples/GWTDemo.gwt.xml
... TODO ...
AtmosphereListener Javadoc
void onConnected(int heartbeat,
int connectionID)
The connection has been established
Parameters:
heartbeat - This is the interval with which the server will send heartbeats
connectionID - This is the unique number that identifies this connection
void onBeforeDisconnected()
Send just before the connection is stopped (this can happen also because the window is being closed)
void onDisconnected()
The connection has disconnected. When the disconnect was unexpected the connecting will be refreshed.
void onError(Throwable exception,
boolean connected)
An error has occurred.
Parameters:
exception -
connected - This will indicate whether the connection is still alive
void onHeartbeat()
The connection has received a heartbeat. When a heartbeat is not received at the expected time, the connection is
assumed to be dead and a new one is established.
void onRefresh()
The connection will be refreshed by the client. This will occur to prevent data from accumulating in the clients comet
implementation and slowing down message processing. Normally you don't need to do anything with this event. It signals
the start of a scheduled reconnection. A new connection will be established and the current connection is only dropped
when the new connection has become alive.
void onAfterRefresh()
You will receive this after a connection has been refreshed or re-established and is ready to process new events.
void onMessage(List<?> messages)
A batch of messages from the server has arrived.
Parameters:
messages -
What you should do is specify true in the configuration of the maven-gwt-plugin and deploy the war to your tomcat server. After the war is deploy you should run "mvn gwt:run" and the shell will start without starting the build-in jetty. Now you type the url of your page that is hosted by tomcat and add "?gwt.codesvr=127.0.0.1:9997" to the url. This will redirect the javascript to the gwt shell.
Read more about the GWT Maven Plugin
Try and start the client (AtmosphereClient.start()) [scheduleDeferred](http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/core/client/Scheduler.html#scheduleDeferred(com.google.gwt.core.client.Scheduler.ScheduledCommand\))
- 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