PrettyFaces:每次请求都表现不佳

时间:2018-03-27 11:23:12

标签: jsf jsf-2.2 mojarra prettyfaces

在漂亮的论坛(https://www.ocpsoft.org/support/forum/prettyfaces-users/)中注册新用户目前似乎不起作用,所以我在这里寻求帮助:

我们开始在jsf 2.2项目中包含最新的prettyfaces 3.4.2,并且在每个POST和GET请求中都认识到性能很差。

我们删除了所有自定义过滤器和servlet-listener,以便配置文件中没有任何特殊内容,但是prettyfaces仍然无法使用,尽管重写引擎似乎一般都可以工作:

http://localhost:8080/vision9/member/576

删除漂亮的依赖项后,一切都会回到"正常"状态...

有没有人提示这个问题?

更新

当项目阶段为生产时,性能才合适。设置以下上下文 - 参数 https://www.ocpsoft.org/support/topic/huge-performance-drop-even-with-empty-config/ 没有解决性能问题:

 <context-param>
    <param-name>org.ocpsoft.rewrite.config.CONFIG_RELOADING</param-name>
    <param-value>false</param-value>
</context-param>
<context-param>
  <param-name>org.ocpsoft.rewrite.annotation.BASE_PACKAGES</param-name>
  <param-value>none</param-value>
</context-param>

这是我们的配置文件:

服务器启动期间

console-info:

 INFORMATION: RewriteFilter starting up...    
 Rewrite 3.4.2.Final initialized.
 RewritePhaseListener starting up.

的pom.xml:

<dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>2.6.8</version>
</dependency>   
<dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.2.14</version>
</dependency>       
<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>runtime</scope>
</dependency>
<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.0</version>
        <scope>compile</scope>
</dependency>   
<dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-servlet</artifactId>
        <version>3.4.2.Final</version>
</dependency>
<dependency>
        <groupId>org.ocpsoft.rewrite</groupId>
        <artifactId>rewrite-config-prettyfaces</artifactId>
        <version>3.4.2.Final</version>
</dependency>

的web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">
<display-name>vision9</display-name>
<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>        
</welcome-file-list>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/javax.faces.resource/*</url-pattern>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>      
</context-param>
<context-param>     
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
</context-param>
<context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.FACELETS_DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <param-name>org.omnifaces.FACES_VIEWS_SCAN_PATHS</param-name>
    <param-value>/*.xhtml</param-value>
</context-param>

<session-config>
    <session-timeout>30</session-timeout>
    <tracking-mode>COOKIE</tracking-mode>
</session-config>   
</web-app>

漂亮-config.xml中:

 <pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
                  http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">


<url-mapping id="members">
     <pattern value="/member/#{memberId}" />
    <view-id value="/member.xhtml" />
</url-mapping>

</pretty-config>

faces-config.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">

<application>   
    <locale-config>
        <default-locale>de</default-locale>
    </locale-config>

    <resource-bundle>
        <base-name>messages</base-name>
        <var>msg</var>
    </resource-bundle>

    <resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>

</application>

0 个答案:

没有答案