Récemment, test sur le composant
idleMonitor
de PrimeFaces.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h1>PrimeFaces and idleMonitor</h1>
<p:growl id="messages" showDetail="true" sticky="true"/>
<p:idleMonitor timeout="10000" update="messages">
<p:ajax event="idle" listener="#{idleBean.idleListener}" update="messages"/>
</p:idleMonitor>
</h:body>
</html>
Problème
Après 10 secondes, la console vous invite
java.io.IOException: Not in GZIP format
? C’est bizarre, quel GZIP faire avec le composant
idleMonitor
?
INFO: Server startup in 4279 ms
Aug 8, 2012 2:42:48 PM com.sun.faces.renderkit.ClientSideStateHelper doGetState
SEVERE: Not in GZIP format
java.io.IOException: Not in GZIP format
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:141)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:56)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:65)
Solution
Pour résoudre ce problème, enveloppez simplement tous les composants PrimeFaces avec la balise
form
. Aucune idée pourquoi, mais ça a résolu le problème.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h1>PrimeFaces and idleMonitor</h1>
<h:form>
<p:growl id="messages" showDetail="true" sticky="true"/>
<p:idleMonitor timeout="10000" update="messages">
<p:ajax event="idle" listener="#{idleBean.idleListener}" update="messages"/>
</p:idleMonitor>
</h:form>
</h:body>
</html>