<?xml version="1.0" encoding="UTF-8"?>
<!--

  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

-->
<services-config>
  <services>
    <service id="remoting-service" class="flex.messaging.services.RemotingService">
      <adapters>
        <adapter-definition
                id="java-object"
                class="flex.messaging.services.remoting.adapters.JavaAdapter"
                default="true"/>
        <adapter-definition
                id="compressed-java-object"
                class="org.apache.royale.net.remoting.amf.adapter.AMFCompressorAdapter"/>
      </adapters>
      <default-channels>
        <channel ref="websocketAmf"/>
        <channel ref="longPollingAmf"/>
        <channel ref="shortPollingAmf"/>
      </default-channels>
    </service>
  </services>

  <channels>
    <channel-definition id="websocketAmf" class="mx.messaging.channels.StreamingAMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/websocket-amf"
                class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
      <properties>
        <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis>
        <add-no-cache-headers>true</add-no-cache-headers>
        <serialization>
            <enable-small-messages>true</enable-small-messages>
        </serialization>
      </properties>
    </channel-definition>
    <channel-definition id="longPollingAmf" class="mx.messaging.channels.AMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/long-polling-amf"
                class="flex.messaging.endpoints.AMFEndpoint"/>
      <properties>
        <polling-enabled>true</polling-enabled>
        <wait-interval-millis>0</wait-interval-millis>
        <polling-interval-millis>1000</polling-interval-millis>
        <max-waiting-poll-requests>100</max-waiting-poll-requests>
        <piggybacking-enabled>true</piggybacking-enabled>
        <add-no-cache-headers>true</add-no-cache-headers>
      </properties>
    </channel-definition>
    <channel-definition id="shortPollingAmf" class="mx.messaging.channels.AMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/short-polling-amf"
                class="flex.messaging.endpoints.AMFEndpoint"/>
      <properties>
        <polling-enabled>true</polling-enabled>
        <polling-interval-millis>3000</polling-interval-millis>
        <piggybacking-enabled>true</piggybacking-enabled>
        <add-no-cache-headers>true</add-no-cache-headers>
      </properties>
    </channel-definition>
  </channels>
  <validators>
    <validator class="flex.messaging.validators.ClassDeserializationValidator">
      <properties>
        <allow-classes>
          <class name="org.apache.royale.amfsamples.valueobjects.*"/>
          <class name="flex.messaging.messages.*"/>
          <class name="flex.messaging.io.*"/>
          <class name="flex.messaging.io.amf.*"/>
        </allow-classes>
      </properties>
    </validator>
  </validators>

  <flex-client>
    <!-- Make sure clients are automatically expired -->
    <timeout-minutes>720</timeout-minutes>
  </flex-client>

  <logging>
    <!--
            Logging inside BlazeDS is completely turned off.
            The UniversalExceptionTranslator will handle logging
            of exceptions inside Spring.
    -->
    <target class="flex.messaging.log.ConsoleTarget" level="None"/>
  </logging>
</services-config>
