0 Replies Latest reply on Sep 18, 2009 9:57 AM by khanrahan

    Setting content-type response header in BlazeDS

    khanrahan

      Per this JIRA ticket, http://bugs.adobe.com/jira/browse/BLZ-428 , there is a suggested fix that includes setting the response content-type header to text/xml.

       

      The JIRA ticket name is

      pinging endpoint Returns a HTTP: Status 200 in ie8

       

      and the suggested fix is:

      ---------

      The problem appears to be completely worked around by setting the following headers in our HTTP responses to Flash:

      Content-Type: text/xml; charset=UTF-8
      Cache-Control: no-cache

      --------

       

      What is the best way to do this is if using BlazeDS?

       

      I have tried to set the content-type within my data service desitnation class, by accessing the HttpServletResponse from the FlexContext class, however this does not work.  The content-type is still "application/x-amf" in the response.    I am assuming that BlazeDS sets the content-type sometime after my data service desination code is invoked.

       

      I have also tried to create a servlet filter and set the content-type header both before and after (in a finally block) my data service code is invoked, however neither of these approaches successfully ended up with a content-type of "text/xml" in the response.  My sense is that setting the content-type prior to the data service destination code is too early in the chain and setting in the finally block is too late (per the servlet spec you cannot set the content-type after getWriter() has been called).

       

      Any ideas are appreciated.

       

      Also any other ideas on how to solve the general IE8 issue described in the bug above are appreciated.

       

      I am using...

       

      BlazeDS version: 3.2.0.3978

      Flex SDK version: 3.4

      App Server: JBoss 4.5

      Java: 1.5_16

       

      Thanks,

      Kevin