-
1. Re: Ajax-Request: Control the URL
benterich Dec 2, 2009 4:54 AM (in response to benterich)Any ideas?
Really depending on that, until now, Ajax just doesn't work for us.
To rephrase the problem:
Is it possible to control the URL for the request that is issued by RichFaces (via Ajax4JSF)?
Regards,
Christian -
2. Re: Ajax-Request: Control the URL
ilya_shaikovsky Dec 2, 2009 7:38 AM (in response to benterich)post for ajax request contains AJAXREQUEST variable.
-
3. Re: Ajax-Request: Control the URL
benterich Dec 4, 2009 4:43 AM (in response to benterich)Thank you Ilya, we take this now to decide, if we have an ajax request. So far it works, ajax request is routed correctly on the server and a (in my opinion) correct response is delivered to the browser.
Just the browser does not rerender as he should. In the a4j.log we get the ominous lines:
error[10:22:13,872]: Error parsing XML
error[10:22:13,872]: Parse Error: Document is empty
and nothing is rerendered. I'll post the complete log output for the response, maybe someone can help me with this:debug[10:22:13,871]: Response with content-type: text/html;charset=UTF-8 debug[10:22:13,871]: Full response content: <html lang="de"><head><title></title><meta name="Ajax-Update-Ids" content="docSearchForm:jq_pmDateFrom"><meta id="Ajax-Response" name="Ajax-Response" content="true"><meta name="Ajax-Update-Ids" content="docSearchForm:jq_pmDateFrom"><meta id="Ajax-Response" name="Ajax-Response" content="true"><link class="component" href="/org/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" rel="stylesheet" type="text/css"><link class="component" href="/org/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_.jsf" media="rich-extended-skinning" rel="stylesheet" type="text/css"><script src="/org.ajax4jsf.javascript.AjaxScript.jsf" type="text/javascript"> </script><script src="/org/richfaces/renderkit/html/scripts/jquery/jquery.js.jsf" type="text/javascript"> </script><script src="/org/richfaces/renderkit/html/scripts/skinning.js.jsf" type="text/javascript"> </script></head><body><input id="docSearchForm:jq_pmDateFrom" name="docSearchForm:jq_pmDateFrom" type="text" value="05.10.2009"><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="zCxxR1bustLziO9eOGlrLdz+VNNWG+jPPUcXRVccZFbdAP1pEMqRAwVqOPYICjVV7tMnLqhlUrypk7u1Yl6OEwZ9H71BkdcIe9KU18a2QkVHiTt2vckScCcILa9OkNyFrWSW1x90ak/UZGRJZ3+sG31We7bKnmTSwyWyq4TM4vknoYvEr/FYinH6L2MVZHQc"></span><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="zCxxR1bustLziO9eOGlrLdz+VNNWG+jPPUcXRVccZFbdAP1pEMqRAwVqOPYICjVV7tMnLqhlUrypk7u1Yl6OEwZ9H71BkdcIe9KU18a2QkVHiTt2vckScCcILa9OkNyFrWSW1x90ak/UZGRJZ3+sG31We7bKnmTSwyWyq4TM4vknoYvEr/FYinH6L2MVZHQc"></span></body></html> debug[10:22:13,872]: Header Ajax-Expired not found, search in <meta> error[10:22:13,872]: Error parsing XML error[10:22:13,872]: Parse Error: Document is empty
As far as I can see, the response is correct:
- correct content type
- complete html page
- correct update ids
- correct update content
The only thing I'm seeing is, that the response is not valid XHTML (meta and link tags are unbalanced). Could that be the problem? How could I fix this?
The A4J-Filter is configured to always parse (forceparser=true), but AJAX-requests should produce valid XML in any case, right? Normal requests are valid XHTML too.
Thanks for any pointers, regards.
Christian -
4. Re: Ajax-Request: Control the URL
benterich Dec 7, 2009 5:28 AM (in response to benterich)Unfortunately no progress for us - still stuck with this.
Ajax-Responses are not parsed - rerender does not work.
Can it be something with the configured parsers? I'll post the filter config asap.
Any help would be very welcome. -
5. Re: Ajax-Request: Control the URL
benterich Dec 7, 2009 5:43 AM (in response to benterich)Filter config in web.xml
<!-- JSF: AJAX 4 JSF Filter to enhance facelets with AJAX. Must be first in filter chain. --> <filter> <filter-name>ajax4jsfFilter</filter-name> <display-name>Ajax4jsf Filter</display-name> <description>Adds ajax functionality to the application</description> <filter-class>org.ajax4jsf.Filter</filter-class> <!-- Force XML parsing (or XSLT transformation will not work). --> <init-param> <param-name>forceparser</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>mime-type</param-name> <param-value>text/html</param-value> </init-param> </filter>
-
6. Re: Ajax-Request: Control the URL
nbelaevski Dec 7, 2009 6:11 AM (in response to benterich)Hi,
Try another mime-type, e.g. "application/xhtml+xml" -
7. Re: Ajax-Request: Control the URL
benterich Dec 7, 2009 8:22 AM (in response to benterich)Thanks for your answer. Unfortunately this produces this response:
debug[14:20:49,788]: Full response content: <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head></html> debug[14:20:49,789]: Header Ajax-Expired not found, search in <meta> error[14:20:49,789]: Error parsing XML error[14:20:49,790]: Parse Error: Document is empty
This does not look like a correct ajax response. -
8. Re: Ajax-Request: Control the URL
benterich Dec 8, 2009 3:53 AM (in response to benterich)Finally we got this right, it all depends on the content type. The webserver always produced text/html which is unrecognized by the javascript ajax layer of a4j. Tuning the webserver to pass ajax responses through wielded the correct result.
Thanks to everyone for support.