我正在尝试在Stripes ActionBean中接收断开连接的Google ChannelPresence。我目前正在使用DynamicMappingFilter来动态映射我的ActionBean URL。当我使用映射到“/ _ah / channel / disconnected /".
的servlet时,断开连接存在工作正常自定义映射正在使用我使用UrlBinding(“/ testing /”)的其他ActionBean。但是,ChannelPresence似乎没有发送到处理ChannelPresence断开连接的ActionBean:
@UrlBinding("/_ah/channel/disconnected/")
public class LogoutActionBean implements ActionBean {
private ActionBeanContext context;
public void setContext(ActionBeanContext abc) {
context = abc;
}
public ActionBeanContext getContext() {
return context;
}
@DefaultHandler
public Resolution logout() {
UserStore userStore = UserStore.getInstance();
ChannelService channelService = ChannelServiceFactory.getChannelService();
ChannelPresence presence = null;
String clientID = null;
try {
presence = channelService.parsePresence(context.getRequest());
} catch (IOException e) {
}
if (presence != null) {
clientID = presence.clientId();
userStore.removeUser(clientID);
}
UserStoreUtility.updateAllUserList();
return new ForwardResolution("UserList.jsp");
}
}
这是我的web.xml:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<display-name>Stripes Filter</display-name>
<filter-name>StripesFilter</filter-name>
<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
<init-param>
<param-name>ActionResolver.Packages</param-name>
<param-value>net.sourceforge.stripes.examples, com.channel</param-value>
</init-param>
</filter>
<filter>
<description>Dynamically maps URLs to ActionBeans.</description>
<display-name>Stripes Dynamic Mapping Filter</display-name>
<filter-name>DynamicMappingFilter</filter-name>
<filter-class>
net.sourceforge.stripes.controller.DynamicMappingFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>DynamicMappingFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>