我正在将我们的应用程序从JEE5 / Icefaces 1.8.2升级到JEE6 / Icefaces 3.3。我按照我在这里找到的材料: Migrating from JSF 1.2 to JSF 2.0 以及提供的Icefaces:http://www.icesoft.org/wiki/display/ICE/ICEfaces+1.x+Compatibility
所以现在我可以将我的应用程序成功部署到GlassFish 3。
这是web.xml:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>pdb</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>/icefaces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.icefaces.ace.theme</param-name>
<param-value>rime</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>com.sun.faces.defaultResourceMaxAge</param-name>
<param-value>604800</param-value>
</context-param>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/index.html</location>
</error-page>
<!-- ICE FACES ADDED -->
<!-- Facelets Custom Components -->
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/facelets/imsref_common_taglib.xml;/WEB-INF/facelets/imsref_pdb_taglib.xml</param-value>
</context-param>
<listener>
<listener-class>LifeCycleListener</listener-class>
</listener>
<filter>
<filter-name>RedirectFilter</filter-name>
<filter-class>RedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RedirectFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>Transactions</filter-name>
<filter-class>TransactionalFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Transactions</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<!--Security Settings-->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>pdb-auth-realm</realm-name>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/loginerror.jsf</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>pdb</web-resource-name>
<url-pattern>/secure/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<!--Security constraint so only admin role can access the monitoring page-->
<security-constraint>
<web-resource-collection>
<web-resource-name>monitoring</web-resource-name>
<url-pattern>/monitoring</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Administrator. Is the super-user. Can do everything. This role includes all other roles.</description>
<role-name>admin</role-name>
</security-role>
<mime-mapping>
<extension>aspx</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
</web-app>
现在我导航到
https://localhost:8181/pdb/secure/main.jspx
我被重定向到登录页面,但只加载了jsf组件。没有加载.css,当我导航到资源时,来自服务器的响应始终是Content-Length“0”但状态200.对于任何图像都是相同的。
当我对我们的领域进行身份验证时,我可以在/ pdb /之后输入任何URL(例如任何垃圾网址)
https://localhost:8181/pdb/somenonexistantpage
,服务器以200 OK和Content-Length“0”
响应申请结构如下:
WEB-INF\login.xhtml
WEB-INF\index.xhtml
WEB-INF\loginerror.xhtml
WEB-INF\css\<custom css>
WEB-INF\resources\components\<components>
WEB-INF\resources\images\<images>
WEB-INF\resources\icons\<icons>
WEB-INF\secure\<all .xhtml jsf pages>
GET请求:
https://localhost:8181/pdb/xmlhttp/css/rime/rime.css
仅返回以下内容:
Content-Length:"0"
Date:"Tue, 19 Nov 2013 19:31:32 GMT"
Server:"GlassFish Server Open Source Edition 3.1.2.2"
X-Powered-By:"Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.2.2 Java/Oracle Corporation/1.7)"
答案 0 :(得分:0)
要关闭此问题的循环,我的TransactionFilter失败了,我们从未链接过滤器,因此资源servlet永远不会被命中。我确保了以下代码行:
chain.doFilter(req, resp);
正在执行,资源最终被正确加载。几个星期前我解决了这个问题,但我认为这就是问题所在。