3. Adobe BlazeDS Configuration

The BlazeDS configuration first imports the 'remoting-config.xml' and sets up a default channel called 'person-amf'. Then in the channels section, it's URL and the class that will handle requests to the URL is configured. The parameters in the URL 'server.name' and 'server.port' are supplied by the Flex runtime. The 'context.root' parameter needs to be supplied during compilation using the 'context-root' compiler option.

/WEB-INF/flex/services-config.xml
                
<?xml version="1.0" encoding="UTF-8"?>
<services-config>

    <services>
        <service-include file-path="remoting-config.xml" />

        <default-channels>
           <channel ref="person-amf"/>
        </default-channels>
    </services>

    <channels>
        <channel-definition id="person-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amf" 
                      class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
    </channels>

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[BlazeDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
            </filters>
        </target>
    </logging>

    <system>
        <redeploy>
            <enabled>false</enabled>
        </redeploy>
    </system>

</services-config>
                
            

A JavaAdapter is configured to handle remoting requests. The 'person-amf' channel configured in the main config is set as the default channel. If Spring weren't used, remote services would be configured here.

/WEB-INF/flex/remoting-config.xml
                
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" 
         class="flex.messaging.services.RemotingService">

    <adapters>
        <adapter-definition id="java-object" 
                            class="flex.messaging.services.remoting.adapters.JavaAdapter" 
                            default="true"/>
    </adapters>

    <default-channels>
        <channel ref="person-amf"/>
    </default-channels>

</service>