Vor kurzem wurde die PrimeFaces-Komponente 'idleMonitor' getestet.
<!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>
Problem
Nach 10 Sekunden meldet die Konsole
java.io.IOException: Nicht im GZIP-Format
. Das ist seltsam, was GZIP mit der 'idleMonitor'-Komponente tun soll?
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)
Lösung
Um dies zu beheben, wickeln Sie einfach alle PrimeFaces-Komponenten mit dem `form'-Tag ein. Keine Ahnung warum, aber es hat das Problem gelöst.
<!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>
Referenzen
idleMonitor Schaufenster]