我试图在Wicket-1.5.X web应用程序中添加气氛支持。(目前升级到6不是一种选择。)
目前,我已经将wicket过滤器配置为运行在气氛MeteorServlet之上。我已经为我的应用程序中使用的气氛创建了一个sharedResource。但是,我注意到,对于这种配置,即使是不使用共享资源的页面(比如我的静态登录页面)也似乎仍然激活它。
我认为解决方案是将wicket过滤器从MeteorServlet的顶部移到它的旁边。因此,/App/MyResource将触发流星,但其他一切只需使用get wicket即可。
我怎么能这么做?
在重要的情况下:
更新:
下面是我的web.xml当前的样子:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>CSC</display-name>
<!--
added for Spring Wicket Hibernate compatibility
From: http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
-->
<context-param>
<!-- tells Spring to look in the Class Path for applicationContext.xml -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<!-- Starts Spring -->
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- prevent hibernate LazyLoadingException -->
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>SessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<init-param>
<param-name>applicationFactoryClassName</param-name>
<param-value>org.apache.wicket.SpringWebApplicationFactory</param-value>
</init-param>
<init-param>
<param-name>applicationBean</param-name>
<param-value>wicketApplication</param-value>
</init-param>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>
us.ak.state.revenue.cssd.Personnel.QuickStartApplication
</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>contextpath</param-name>
<param-value>CSC</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>ISO-8859-1</param-value>
</init-param>
</filter>
<!--Atmosphere support, to remove the Ajax Updating Bug CSC-2 -->
<servlet>
<description>MeteorServlet</description>
<servlet-name>CSC</servlet-name>
<servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.filter</param-name>
<param-value>org.apache.wicket.protocol.http.WicketFilter</param-value>
</init-param>
<!-- directory settings -->
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereHandler.contextRoot</param-name>
<param-value>CSC</param-value>
</init-param>
<!-- Abilities -->
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.sessionSupport</param-name>
<param-value>true</param-value>
</init-param>
<!-- let Atmosphere handle keep alive,
make sure broadcast happens AFTER AJAX stuff -->
<init-param>
<param-name>
org.atmosphere.cpr.AtmosphereInterceptor
</param-name>
<param-value>
org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor,
org.atmosphere.interceptor.BroadcastOnPostAtmosphereInterceptor
</param-value>
</init-param>
<!-- shouldn't this be defaultContentType? sets Content-Type header default -->
<init-param>
<param-name>org.atmosphere.cpr.defaultContextType</param-name>
<param-value>text/plain</param-value>
</init-param>
<init-param>
<param-name>filterMappingUrlPattern</param-name>
<param-value>/*</param-value>
</init-param>
<!-- minimize memory share broadcaster -->
<init-param>
<param-name>org.atmosphere.cpr.broadcaster.shareableThreadPool</param-name>
<param-value>true</param-value>
</init-param>
<!-- error recovery -->
<init-param>
<param-name>
org.atmosphere.cpr.recoverFromDestroyedBroadcaster
</param-name>
<param-value>true</param-value>
</init-param>
<!-- wicket filter settings -->
<init-param>
<param-name>applicationFactoryClassName</param-name>
<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
</init-param>
<init-param>
<param-name>applicationBean</param-name>
<param-value>wicketApplication</param-value>
</init-param>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>us.ak.state.revenue.cssd.QuickStartApplication</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>contextpath</param-name>
<param-value>CSC</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>ISO-8859-1</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CSC</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/x-icon</mime-type>
</mime-mapping>
</web-app>P.S.:也许wicket知道,1.5仍然是一个过滤器还是一个servlet?
发布于 2012-11-15 20:26:40
不知道这个具体情况,但通常只是在框架(即Wicket)映射之前向web.xml添加定义和映射:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/mystuff</url-pattern>
</servlet-mapping>https://stackoverflow.com/questions/13404523
复制相似问题