<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<!--
  - Contacts web application
  - Client application context
  -->

<beans>

    <!-- Resolves ${...} placeholders from client.properties -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location"><value>client.properties</value></property>
    </bean>

    <!-- Proxy for the RMI-exported ContactManager -->
    <!-- COMMENTED OUT BY DEFAULT TO AVOID CONFLICTS WITH APPLICATION SERVERS
    <bean id="rmiProxy" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
        <property name="serviceInterface">
            <value>sample.contact.ContactManager</value>
        </property>
        <property name="serviceUrl">
            <value>rmi://${serverName}:${rmiPort}/contactManager</value>
        </property>
        <property name="remoteInvocationFactory">
            <ref local="remoteInvocationFactory"/>
        </property>
    </bean>

    <bean id="remoteInvocationFactory" class="org.springframework.security.ui.rmi.ContextPropagatingRemoteInvocationFactory"/>
    -->

    <!-- Proxy for the HTTP-invoker-exported ContactManager -->
    <!-- Spring's HTTP invoker uses Java serialization via HTTP  -->
    <bean id="httpInvokerProxy" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
        <property name="serviceInterface">
            <value>sample.contact.ContactManager</value>
        </property>
        <property name="serviceUrl">
            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-httpinvoker</value>
        </property>
        <property name="httpInvokerRequestExecutor">
            <ref local="httpInvokerRequestExecutor"/>
        </property>
    </bean>

    <!-- Automatically propagates ContextHolder-managed Authentication principal
         and credentials to a HTTP invoker BASIC authentication header -->
    <bean id="httpInvokerRequestExecutor" class="org.springframework.security.core.context.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor"/>

    <!-- Proxy for the Hessian-exported ContactManager
    <bean id="hessianProxy" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
        <property name="serviceInterface">
            <value>sample.contact.ContactManager</value>
        </property>
        <property name="serviceUrl">
            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-hessian</value>
        </property>
    </bean>
    -->

    <!-- Proxy for the Burlap-exported ContactManager
    <bean id="burlapProxy" class="org.springframework.remoting.caucho.BurlapProxyFactoryBean">
        <property name="serviceInterface">
            <value>sample.contact.ContactManager</value>
        </property>
        <property name="serviceUrl">
            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-burlap</value>
        </property>
    </bean>
    -->

</beans>
