2 Replies Latest reply on Jun 4, 2007 2:35 PM by tazman

    URLRewriteFilter and Ajax4JSF

    tazman

      Hi all,

      I have a hard problem that I could not overcome:

      I recently started using URLRewriteFilter (from tuckey.org) for my Seam/Ajax4JSF application. Now I cannot get Ajax4JSF to work. The problem is that the content-type of the ajax response is not text/xml anymore.

      Before beginning to use the URLRewriteFilter, whenever Ajax4JSF got an ajax repsonse, the response had "text/xml" as content-type (from a:log):

      debug[21:00:59,812]: Response with content-type: text/xml;charset=UTF-8
      debug[21:00:59,812]: Full response content: <?xml version="1.0"?> <html


      Now the content type is "application/xhtml+xml" (default for facelet pages):
      debug[21:14:30,157]: Response with content-type: application/xhtml+xml;charset=UTF-8
      debug[21:14:30,157]: Full response content: <span id="EmailError">
      ...
      error[21:14:30,167]: Error parsing XML
      error[21:14:30,167]: Parse Error: XML Parsing Error: junk after document element


      Can someone help?

      tazman

        • 1. Re: URLRewriteFilter and Ajax4JSF
          ilya_shaikovsky

          Try to use f:view on your pages with contentType="text/xml"

          • 2. Re: URLRewriteFilter and Ajax4JSF
            tazman

            Using f:view with contentType="text/xml" produces the correct content-type but the response content is still not valid. Here is the new response I'm getting:

            debug[20:15:58,259]: Response with content-type: text/xml;charset=UTF-8
            debug[20:15:58,259]: Full response content: <span id="emailError">
            ...
            error[20:15:58,269]: Error parsing XML
            error[20:15:58,269]: Parse Error: XML Parsing Error: junk after document element


            The respsonse doesn't have either XML preamble or html tag. Why doesn't ajax4jsf generate these?

            This is the rewrite rule I'm trying to execute:

            <rule>
             <from>^/article/(.+)$</from>
             <to>/article.seam?id=$1</to>
            </rule>


            According to the UrlRewriteFilter manual, this rule internally forwards the request by calling

            RequestDispatcher rq = request.getRequestDispatcher([to value]);
            rq.forward(request, response);


            Any help is appreciated.

            tazman