如何实现连接/断开(GAE Channel API,Java)?

时间:2012-01-18 13:24:01

标签: java google-app-engine channel-api

这是我app.yaml的相关部分:

handlers:
[...]
- url: /_ah/channel/connected
  servlet: com.[MYAPP].server.channel.ChannelConnected
  name: ChannelConnected
- url: /_ah/channel/disconnected
  servlet: com.[MYAPP].server.channel.ChannelDisconnected
  name: ChannelDisconnected
- url: /*
  filter: com.google.inject.servlet.GuiceFilter
  login: required

[...]

inbound_services:
  - channel_presence

但是,App Engine无法识别ChannelDisconnected和ChannelConnected。 Dev Server的输出(SDK 1.6.1):

Jan 18, 2012 1:08:37 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
Warnung: No file found for: /_ah/channel/connected/

网络日志:

0.1.0.10 - - [18/Jan/2012:05:01:37 -0800] "POST /_ah/channel/connected/ HTTP/1.1" 404 346 - - "[MYID].appspot.com" ms=42 cpu_ms=88 api_cpu_ms=65 cpm_usd=0.002547 instance=00c61b117ce7311fe771ffe792d63bf0a07784

2 个答案:

答案 0 :(得分:1)

在已连接和已断开连接的处理程序末尾添加反斜杠:

- url: /_ah/channel/connected/
  servlet: com.[MYAPP].server.channel.ChannelConnected
  name: ChannelConnected
- url: /_ah/channel/disconnected/
  servlet: com.[MYAPP].server.channel.ChannelDisconnected
  name: ChannelDisconnected

答案 1 :(得分:0)

在您的yaml片段中,您的入站服务已被注释掉。如果实际部署的情况可能是导致问题的原因。