|
|
Emite its a pure gwt library, so no server code is involved. You may ask yourself "why do you I need to install a proxy?"
Prerequisites
You need a running xmpp server with Http Binding connection enabled. See our Server and Client Compatibility Matrix
Environment setup
- install maven2 version 2.0.7 or over (http://maven.apache.org)
- download GWT version 1.5. Currently, our version 0.2.0 is compatible with gwt-1.5M1 (due a gwt-ext issue). Our 0.2.1 version supports gwt-1.5M2 (using a development version of gwt-ext) and in version >= 0.2.7 we are using gwt-1.5rc.
- create or modify the maven ~/.m2/settings.xml file to use the proper distribution of gwt (see Appendix A)
- configure your server Http Binding Service to listen at http://localhost:5280/http-bind/ or tweak the web.xml file of emite to change this values
Run the example from the sources
- check out the code: svn checkout http://emite.googlecode.com/svn/trunk/ emite
- inside the emite directory type mvn gwt:gwt to run emite using the GWTShell ...
- ... or type ./script/server.sh to compile the sources to javascript, and start a jetty server with a proxy installed, and run the example looking at: http://localhost:4444/gwt/EmiteUI.html
Using Eclipse
- run mvn eclipse:eclipse
- import the project from eclipse
Use emite in your own project
There are other ways, but the fastest is to use maven2:
- create a new maven project if needed: mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
- Add this to the resulting pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
<dependencies>
<dependency>
<groupId>com.calclab</groupId>
<artifactId>emite</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
</project>See Appendix C for more pom.xml configuration options. You can also take a look to http://emite.googlecode.com/svn/trunk/blackboard/ for an example of an application that uses Emite library.
- Create a new gwt project with the current gwt module dependencies:
<!-- library: required --> <inherits name="com.calclab.emite.Emite" /> <!-- if you want to include the emite ui in your application --> <inherits name="com.calclab.emiteuimodule.EmiteUIModule" /> <!-- to make GWTShell use the java proxy --> <servlet path="/proxy" class="de.spieleck.servlets.ProxyServlet"/>
Also, if you want to use the ui you have to configure the connection settings in your app's html file. Take a look at http://emite.googlecode.com/svn/trunk/emite/src/main/java/com/calclab/emiteui/public/EmiteUI.html to see an example.
Appendix A: Configuration of maven
Example of maven .m2/settings.xml to work with gwt-maven plugin:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<profiles>
<profile>
<id>gwt-1.4.61</id>
<properties>
<google.webtoolkit.home>/usr/local/lib/gwt/gwt-linux-1.4.61</google.webtoolkit.home>
<!-- <google.webtoolkit.devjar>gwt-dev-linux</google.webtoolkit.devjar> -->
<!-- you only need this is you are on a mac -->
<google.webtoolkit.extrajvmargs>-Xmx256M</google.webtoolkit.extrajvmargs>
</properties>
</profile>
<profile>
<id>gwt-0.0.2030</id>
<properties>
<google.webtoolkit.home>/usr/local/lib/gwt/gwt-linux-0.0.2030</google.webtoolkit.home>
<!-- <google.webtoolkit.devjar>gwt-dev-linux</google.webtoolkit.devjar> -->
<!-- you only need this is you are on a mac -->
<google.webtoolkit.extrajvmargs>-Xmx256M</google.webtoolkit.extrajvmargs>
</properties>
</profile>
<profile>
<id>gwt-1.5.0</id>
<properties>
<google.webtoolkit.home>/usr/local/lib/gwt/gwt-linux-1.5.0</google.webtoolkit.home>
<!-- <google.webtoolkit.devjar>gwt-dev-linux</google.webtoolkit.devjar> -->
<!-- you only need this is you are on a mac -->
<google.webtoolkit.extrajvmargs>-Xmx256M</google.webtoolkit.extrajvmargs>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gwt-1.5.0</activeProfile>
</activeProfiles>
</settings>Appendix B: jar and war generation
To generate a jar from the sources type mvn package , or mvn install to install it in your current maven repository.
If you're planning to install it in your own web server, you can generate a war with: mvn compile war:war
Appendix C: more pom.xml options
We usually use gwt-maven plugin to compile and run the gwt applications, and jetty to run the proxies. You can configure them adding this lines to pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- more stuff here -->
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>com.totsp.gwt</groupId>
<artifactId>maven-googlewebtoolkit2-plugin</artifactId>
<version>2.0-beta14</version>
<configuration>
<style>OBF</style>
<runTarget>
<!-- [[ YOUR APP HTML FILE HERE ]] -->
</runTarget>
<compileTarget>
<param></param>
</compileTarget>
<compileTargets>
<compileTarget>
<!-- [[ YOUR APP MODULE NAME HERE ]] -->
</compileTarget>
</compileTargets>
<generatorRootClasses></generatorRootClasses>
<generatorDestinationPackage>
<!-- [[ YOUR APP MODULE NAME HERE ]] -->
</generatorDestinationPackage>
<generateGettersAndSetters>
false
</generateGettersAndSetters>
<generatePropertyChangeSupport>
false
</generatePropertyChangeSupport>
</configuration>
<executions>
<execution>
<goals>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.5</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>0</scanIntervalSeconds>
<connectors>
<connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>4444</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>
</project>
Appendix D: Apache configuration
First, copy the emite compilation output into your web server. Some orientative apache configuration for emite (using a proxy for both html/js and bosh). Work in progress:
<VirtualHost YOURIP> ServerAdmin ADMINEMAIL ServerName YOUREMITEDOMAIN ExpiresActive on ExpiresDefault "now plus 2 hours" # No working in apache (debian- sarge), try to uncomment in other apache versions # Header append Cache-Control public # SetOutputFilter DEFLATE <Files ext-*.js> ExpiresDefault "now plus 1 year" </Files> <Files ext-*.css> ExpiresDefault "now plus 1 year" </Files> <Files *.cache.*> ExpiresDefault "now plus 1 year" </Files> <Files *.nocache.*> ExpiresDefault "now plus 2 minutes" </Files> <IfModule mod_proxy.c> ProxyPass /com.calclab.emiteui.EmiteUI/proxy http://YOURXMPPSERVER:5280/http-bind/ ProxyPassReverse /com.calclab.emiteui.EmiteUI/proxy http://YOURXMPPSERVER:5280/http-bind/ # This part is optional (only if you are using a internal web server por emite pages): ProxyPass / http://YOUREMITEINNERINSTALLATION/ ProxyPassReverse / http://YOUREMITEINNERINSTALLATION/ </IfModule> </VirtualHost>
You can change also the 5280 port with your xmpp server bosh port.
Apache applies its Timeout directive to BOSH/http-bind connections made through mod_proxy and kills such connections after the Timeout expires. In order to prevent this please remove the Timeout directive from your httpd.conf file, or use a higger value.
Sign in to add a comment

When I run mvn gwt:compile I get an NPE, which it turns out (from reading the code) is because I don't have GWT installed. I guess I'll install that. My understanding is that the gwt-maven package will install it for me, but I guess it doesn't go all the way.
Installing GWT 0.0.2030 and pointing "google.webtoolkit.home" to its root in my settings.xml gets me a clean compile.
When I tried to run ./script/server, it launched, but the URL 404'd. An error message indicated that the copy ("cp -a target... src...") failed because the dest directory didn't exist. When I created a "gwt" directory inside src/main/webapp, it succeeded. Now I can fetch the test page.
When I run mvn gwt:compile I get the error:
Could not create the Java virtual machine. Unrecognized option: -gen
Could someone help me please??
We created an issue for that and currently is solved
When I run ./script/server I get "BUILD FAILURE" for gwt and jetty:run
I'm running the emite from svn (645) with gwt 1.5 rc1 (my settings.xml file points to it)
Any ideas?
probably some problems with maven configuration. please post this in the emite groups (emite@googlecode.com) with the full output and we will help
best regards dani