To properly route incoming requests to the Spring-managed MessageBroker, request mapping must be configured in three places:
DispatcherServlet mapping in web.xml
HandlerMapping in the Spring WebApplicationContext
Channel definitions in the BlazeDS services-config.xml
The simplest request mapping scenario is when the Flex front-end is the only client type for the application. In this case you can just map /messagebroker as the top-level path for requests. The mapping in web.xml would be:
<!-- Map all /messagbroker requests to the DispatcherServlet for handling --> <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping>
 
    		When using the message-broker config tag, a SimpleUrlHandlerMapping is installed that by default maps all 
    		incoming DispatcherServlet requests to the Spring-managed MessageBroker using a /*path pattern.  
    		The default mapping can be overridden by providing one or more mapping child elements.  If you want to provide your own
    		HandlerMapping bean configuration, you can disable the default using the disable-default-mapping attribute 
    		of the message-broker tag.  The order of the installed SimpleUrlHandlerMapping can be set (for complex 
    		scenarios where multiple handler mapping types are installed in the same context) using the mapping-order attribute.
    	
			The SimpleUrlHandlerMapping in the Spring WebApplicationContext maps all requests to the Spring-managed MessageBroker via 
			the MessageBrokerHandlerAdapter.  The default setup installed by the message-broker config tag is equivalent to the
			following bean definitions:
		
<!-- Maps request paths at /* to the BlazeDS MessageBroker --> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <value> /*=_messageBroker </value> </property> </bean> <!-- Dispatches requests mapped to a MessageBroker --> <bean class="org.springframework.flex.servlet.MessageBrokerHandlerAdapter"/>
Channel definitions in the BlazeDS services-config.xml must correspond to the chosen mapping. For example, to set up a typical AMF channel in BlazeDS that matches the above mapping strategy:
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <polling-enabled>false</polling-enabled> </properties> </channel-definition>
See the BlazeDS documentation for more information on configuring communication channels in services-config.xml.