public class SimpleMappingStrategy extends Object implements MappingStrategy
This mapping strategy is most useful when used with the Spring framework.
Example (using Spring):
<beans>
<bean id="mapping"
class="org.asteriskjava.fastagi.SimpleMappingStrategy">
<property name="mappings">
<map>
<entry>
<key><value>hello.agi</value></key>
<ref local="hello"/>
</entry>
<entry>
<key><value>leastcostdial.agi</value></key>
<ref local="leastCostDial"/>
</entry>
</map>
</property>
</bean>
<bean id="hello"
class="com.example.fastagi.HelloAgiScript"/>
<bean id="leastCostDial"
class="com.example.fastagi.LeastCostDialAgiScript">
<property name="rates"><value>rates.txt</value></property>
</bean>
<beans>
LeastCostDialAgiScript and HelloAgiScript must both implement the AgiScript.| Constructor and Description |
|---|
SimpleMappingStrategy() |
| Modifier and Type | Method and Description |
|---|---|
AgiScript |
determineScript(AgiRequest request,
AgiChannel channel)
Returns the AgiScript instance that is responsible to handle
the given request.
|
void |
setMappings(Map<String,AgiScript> mappings)
Set the "path to AgiScript" mapping.
|
public void setMappings(Map<String,AgiScript> mappings)
Use the path (for example hello.agi) as key and your
AgiScript (for example new HelloAgiScript()) as value of
this map.
mappings - the path to AgiScript mapping.public AgiScript determineScript(AgiRequest request, AgiChannel channel)
MappingStrategydetermineScript in interface MappingStrategyrequest - the request to lookup.channel - the channel.null if none could be determined by this strategy.Copyright © 2004–2022. All rights reserved.