我一直在嘗試在Flex應用程序中爲支持http/s請求找到正確的配置。我讀過的所有文檔,他們暗示做類似如下:如何在Flex/BlazeDS中同時支持HTTP和HTTPS通道?
<default-channels>
<channel ref="my-secure-amf">
<serialization>
<log-property-errors>true</log-property-errors>
</serialization>
</channel>
<channel ref="my-amf">
<serialization>
<log-property-errors>true</log-property-errors>
</serialization>
</channel>
這打擊通過HTTPS的應用程序,但通過http擊中同一個應用程序時,得到間歇性通信故障時的偉大工程。這裏是一個縮寫服務-config.xml中:
<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>
<!-- HTTPS requests don't work on IE when pragma "no-cache" headers are set so you need to set the add-no-cache-headers property to false -->
<add-no-cache-headers>false</add-no-cache-headers>
<!-- Use to limit the client channel's connect attempt to the specified time interval. -->
<connect-timeout-seconds>10</connect-timeout-seconds>
</properties>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<!--<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>-->
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
<connect-timeout-seconds>10</connect-timeout-seconds>
</properties>
</channel-definition>
我使用Tomcat 5.5.17和Java 5.運行
- BlazeDS的文件說,這是最好的做法。有沒有更好的辦法?
- 使用這個配置,似乎有2-3個重試與default-channels元素中定義的每個通道相關聯,所以在my-amf通道通過http請求連接之前,它總是需要約20秒。有沒有辦法重寫2-3次重試,每次重試1次?
在此先感謝您的答案。