[
http://jira.jboss.com/jira/browse/RF-3013?page=comments#action_12408221 ]
Jens Behrens commented on RF-3013:
----------------------------------
Hmm...I just tried sth with the BaseFilter and now it works.
I wondered why the response in the js script was alway 200 and tried to set the status in
BaseFilter to 204 instead of 202 but nothing happened (200 in js).
Then I saw the content-length of 0 and changed that, plus an empty string passed to the
PrintWriter of the response.
After that it worked and I tried it without passing the empty string, and it worked
again.
So actually the only thing I changed was setting the content-length of http response to 1
instead of 0.
Is this a normal behaviour or a bug in servlet api?
I googled and found following:
http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg75253.html
https://issues.apache.org/bugzilla/show_bug.cgi?id=32604
Actually when calling setContentLength of response to 0, the response gets committed and
no more response header can be set.
So only the order of calling the methods should be changed, so that first the http status
is set and then the content-length is set to 0:
(...)
if (httpServletRequest.getMethod().equals("HEAD")
&& null != ajaxPushHeader) {
PushEventsCounter listener = eventsManager
.getListener(ajaxPushHeader);
// To avoid XmlHttpRequest parsing exceptions.
httpServletResponse.setContentType("text/plain");
httpServletResponse.setContentLength(0); <-----THIS NEEDS TO BE MOVED AFTER THE
FOLLOWING IF-CLAUSE
if (listener.isPerformed()) {
listener.processed();
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
if (log.isDebugEnabled()) {
log
.debug("Occurs event for a id "
+ ajaxPushHeader);
}
} else {
// Response code - 'No content'
httpServletResponse.setStatus(HttpServletResponse.SC_ACCEPTED);
if (log.isDebugEnabled()) {
log.debug("No event for a id " + ajaxPushHeader);
}
}
} else
(...)
But I really think this is more a bug than a feature, because response header should be
set in any order, but the above is a good workaround for now.
a4j:push ALWAYS (not only if event occurs) rerendering specified
components...
------------------------------------------------------------------------------
Key: RF-3013
URL:
http://jira.jboss.com/jira/browse/RF-3013
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.0.SR1, 3.2.1
Environment: JDK 1.6
JBOSS 4.0.3 SP1
Facelets
JSF-RI
Reporter: Jens Behrens
Assigned To: Alexander Smirnov
Priority: Critical
Fix For: 3.2.1
I tried the new classes from asmirnov, fixing the issue
http://jira.jboss.com/jira/browse/RF-2960
The eventProducer method is getting called now, but actually rerendering of specified
components is happening always and not only if an event occurs via onEvent method of the
listener...
The component has interval 3000, so every 3 seconds the msg component is rerendered
instead of checking if there actually is an event in queue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira