7.3 GWT & Dojo Cometd Client with Spring Bayeux on Tomcat with Embedded Jetty

This example will show GWT & Dojo Cometd Client with Spring Bayeux on Tomcat with an embedded Jetty instance to handle Bayeux communication.

1. Spring Bayeux Configuration

This configures a Jetty Server that will run the Bayeux services contained in the comet.war.

/WEB-INF/jetty-context.xml
                    
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="Server" 
          class="org.mortbay.jetty.Server"
          init-method="start" destroy-method="stop">
          
        <property name="threadPool">
            <bean id="ThreadPool"
                class="org.mortbay.thread.BoundedThreadPool">
                <property name="minThreads" value="10" />
                <property name="lowThreads" value="50" />
                <property name="maxThreads" value="250" />
            </bean>
        </property>

        <property name="connectors">
            <list>
                <bean id="Connector"
                    class="org.mortbay.jetty.nio.SelectChannelConnector">
                    <property name="port" value="8675" />
                    <property name="maxIdleTime" value="30000" />
                    <property name="acceptors" value="2" />
                    <property name="confidentialPort" value="8443" />
                </bean>
            </list>
        </property>

        <property name="handler">
            <bean id="handlers"
                class="org.mortbay.jetty.handler.HandlerCollection">
                <property name="handlers">
                    <list>
                        <bean id="contexts"
                            class="org.mortbay.jetty.handler.ContextHandlerCollection">
                            <property name="handlers">
                                <list>
                                    <bean class="org.mortbay.jetty.webapp.WebAppContext">
                                        <property name="extractWAR" value="false"/>
                                        <property name="contextPath" value="/bayeux" />
                                        <property name="war" value="/user/local/springindepth/comet-webapp/target/comet.war" />
                                    </bean>
                                </list>
                            </property>
                        </bean>
                        <bean id="defaultHandler" class="org.mortbay.jetty.handler.DefaultHandler" />
                        <bean id="requestLog" class="org.mortbay.jetty.handler.RequestLogHandler" />
                    </list>
                </property>
            </bean>
        </property>
    </bean>
</beans>