Setting content-type response header in BlazeDS

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

Hi,
in the meantime I found a "known issue" that seems to be related to my problem but it is said to be fixed with 10.0 MP1 (and we use 10.3):
ChangeRequest number: CR316761, CR318708
Description. The servlet container used to append charset=ISO-8859-1 to the HTTP Header contentType in the response for non-JSP pages with any charset contents. This would result in improper display of multibyte characters.
This problem has been resolved.
Maybe the information is wrong. I will examine the CR and may apply them on our 10.3 environment but I would be glad if some oracle/bea engineer would intervene here.
Cheers
Thorsten

Similar Messages

  • Set content type on header doesn't work on servlet filter

    I am trying the following filter:
    chain.doFilter(req, responseWrapper);
    and im trying to set the content type:
    response.SetHeader("Content-Type","text/plain");
    But it doesn't seem to set it.
    I have the wrapper as:
    private ByteArrayOutputStream     output;
         private int                              contentLength;
         private String                         contentType;
         private CharArrayWriter               myOut;
         private int                              mode;
         public JPServletResponseWrapper(HttpServletResponse response) {
              super(response);
              output = new ByteArrayOutputStream();
              this.myOut = new CharArrayWriter();
         public ServletOutputStream getOutputStream() throws IOException {
              this.setMode(2);
              return new JPServletOutputStream(output);
         public PrintWriter getWriter() throws IOException {
              this.setMode(1);
              return new PrintWriter(this.myOut);
         public byte[] getData() {
              return output.toByteArray();
         public int getContentLenght() {
              return this.contentLength;
         public void setContentLength(int len) {
              this.contentLength = len;
              super.setContentLength(len);
         public String getContentType() {
              return this.contentType;
         public void setContentType(String type) {
              this.contentType = type;
              super.setContentType(type);
         public int getMode() {
              return mode;
         public void setMode(int mode) {
              this.mode = mode;
         public String toString() {
              return myOut.toString();
    The page is being displayed as text/html and not as text/plain.
    Is there any reason?

    Hello,
    I think RowOrdinal is the problem. You can try below suggestion:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/634b3f24-b009-415d-8b45-40c11105b803/bug-in-creating-more-columns-in-sharepoint-list-filters?forum=sharepointdevelopmentlegacy
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Set content type in respone

    Hi,
    I am using velocity model and to set the content type of response as csv report i am setting content type of response as
    $response.setContentType("application/vnd.ms-excel")
    This stmt opens up open-save download dialog box. But the problem is a new internet browser window also opens up. I want to hide this newly opened browser till i click on open button.
    How i can hide or disable this IE window.

    Ritu,
    U specified only content type , try to specifiy attributes like attachment where u can rid of the IE explorer.
    if u have any other doubts u r most welcome giving me a mail [email protected]
    Thanks.
    Sravan

  • How to set content type while sending an email?

    Hello,
    I want to set content type text/html while send an email using org.apache.commons.httpclient api. I am using MultipartPostMethod method. and i am set using object of multipartpostmethod like post.
    and post.setRequestHeader("Content-Type","text/html").
    but it wont work.
    so please give me a proper solution.
    example::
    MultipartPostMethod post = new MultipartPostMethod("url");
    post.addParameter("msgbody","html message");
    post.setRequestHeader("Content-Type","text/html");
    Regards,
    Bhavesh Kharwa

    Actually, I'm writing a "HashMap" from servlet to applet. I have used your suggested content type "application/octet-stream" and another "appication/x-java-serialized-object" to try it. But in applet side, when I use (HashMap)in.readObject(), it always gives me a exception as:"java.util.HashMap; IllegalAccessException". Why?
    Thankd.

  • I download itext  for convert jsp to PDF. How to set content type for PDF.

    I download itext for convert jsp to PDF. How to set content type for PDF. I try
    <%@ page contentType = "application/pdf;charset=TIS-620" %>
    , but the page does not PDF.
    Thank.

    PDF files are usually binary files, JSPs are not well-suited for binary content.
    (If you download the result of your JSP you'll see that it is not a valid PDF file; it will have probably a lot of whitespace and linefeeds, that will choke your PDF reader.). The first few characters must be
    "%PDF-" without whitespace.
    You can try using PDF files encoded as text - check if you can use text-encoded PDFs in iText.
    Try using a Servlet instead.

  • No Content type in header error

    Hi
    getting the error "No content type in header" after i gave credentials in my home screen .
    But i can able to run generic application
    and while starting my jdev am  getting some firewall warning messages
    as "Windows firewall blocked some of the features of jdev on all public ,private and domain networks"
    Is there any connection between these too ??
    Please help me in this
    TIA

    User, How should we possibly answer this?
    You not even shared the minimal information like jdev version. What kind of application is it? Credentials mean security. Which kind of security?
    Reading your stack trace I see 'portal', 'webservice', 'ADFC-10001: cannot instantiate class 'com.smartworkplace.reseravations.home.HomePageReservations' so there are plenty of hints for you to follow up.
    For us to help you need to provide more detailed information.
    Timo

  • Document Set Content Type Workflow

    I have a document library in Share Point 2013 that is using Document Sets.  I need to set up a workflow under the document content type that would send an e-mail if documents have not been uploaded by a specific due date in the document set.  Any
    Help will be greatly appreciated.

    Hi,
    Based on your description, my understanding is that you want to send an email if there is no document uploaded to the document set by a specific due date in the document set.
    I recommend to create retention policy on the document set content type in the library to start the workflow at the due date.
    The workflow can be created as the image below:
    Firstly, get the max id in the library for using in the loop condition in the workflow:
    You can follow the link below for details:
    http://social.technet.microsoft.com/Forums/en-US/a8a890b5-f5fb-447f-b96f-9f3abdb7e178/forum-faq-sharepoint-2013-extracting-values-from-a-multivalue-enabled-lookup-column-and-merge?forum=sharepointgeneral
    Secondly, we need to loop through the items in the library and then check if there are documents(including folders)
     existed inside the document set which is called text for example.
    Please change the string “/sites/victoria/lib set/” in the Replace Substring in String step to be the relative URL of your library and make sure that there is a space before the document set name in the if condition in the workflow as the image below shows:
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Setting webservice response content type / charset header

    I have a webservice .war file.
    I need to set the content-type/charset http header and add another http header. I wrote a filter to do that and had partial success. The other header (pics-label) is indeed sent in the response with the correct value. However, setting the content type proved to be another matter.
    I read through the documentation that one can set the system property weblogic.webservice.i18n.charset=utf-8. However, this doesn't seem to work. The filter setting the header also doesn't work. It seems that weblogic has the final word on that. Only when I set the <web-service> element attribute charset="UTF-8" does the header gets back to the client.
    Due to deployment/build related issues which I won't get into, this is most annoying.
    If anyone has encountered a similiar issue and have a solution/workaround/thoughts I'll be glad to hear about it.
    P.S.
    Also tried -Dfile.encoding=UTF-8 but didn't do any good.
    Thanks.

    you don't define a charset for non-text file types. Excel files are not text files.

  • Tomcat always generates charset in Content-Type http header !!!

    Dear All! I need urgent help with a problem I met with and any suggestion are very appreciated!
    The problem is:
    We are using Tomcat as a web server (and JSP engine), and we would like to use a user control written in C# 2.0 on one of our pages. I've developed such component and tested it using JBuilderX (in fact it resides inside a JSP page). Everything is working fine while debugging using JBuilder, but when I tried to deploy the solution - I got a problem, my dll was not downloaded properly. Let me illustrate this with a test example. I wrote a test html page:
    <html > <head> <title>Test</title> </head> <body> <object id="MyControl" height="300" width="550" classid="http://localhost:8080/MyDLL.dll#WindowsControlLibrary1.UserControl1"> </object> </body> </html>
    When I tried to open it I did not get my control loaded. I check the headers of the server http response and found that Tomcat added the following string as
    Content-Type: application/x-msdownload;charset=ISO-8859-1
    I'm positive that in this case Content-Type should look like
    Content-Type: application/x-msdownload
    (or application/octet-stream if I would choose to define mime type for dll in server's web.xml as
    <mime-mapping> <extension>dll</extension> <mime-type>application/octet-stream</mime-type> </mime-mapping>
    - it does not matter as I understand )
    so Content-Type should not contain any charset for DLL part of response. NO charset=ISO-8859-1 !!
    But Tomcat adds it. :-( And I don't know how to prevent him doing that.
    On the other hand when I tried to open this page using Tomcat started from within JBuilder (port number in this case is different) - then everything was going good and control was downloaded to "Temporary Internet Files" and shown on the page.
    Content-Type field in this case was:
    Content-Type: application/x-msdownload
    without any charset.
    So, my question is: How to suppress Tomcat wish to add the "charset=ISO-8859-1" string to the Content-Type http response header?
    What should I do to load my test html page succesfully?
    Thanks in advance for you time and patience!
    Sincerely yours, Igor

    Back to the top

  • Setting Content-Type in .jspx file

    Hello,
    My application is not rendered by an HTML Browser.
    I need to set the contentType to application/x-ywidget+xml in my JSPX file.
    The content type returned is always text/xml !!!
    I have tried:
    1. To create a phaseListener and overloading before or after phase in ANY_PHASE
    FacesContext context = FacesContext.getCurrentInstance();
    ExternalContext extContext = context.getExternalContext();
    HttpServletResponse response =
    (HttpServletResponse)extContext.getResponse();
    String contentType = "application/x-ywidget+xml";
    response.setContentType(contentType);
    2. To add a new MimeType extension in web.xml and create my file under this extension
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.xygo</url-pattern>
    </servlet-mapping>
    <mime-mapping>
    <extension>xygo</extension>
    <mime-type>application/x-ywidget+xml</mime-type>
    </mime-mapping>

    Frank,
    Thanks you for you help.
    What i would like to do is to use a JSF library components to build YahooGO pages (Yahoo mobile widgets).
    For this my server needs to return an xml document with the application/x-ywidget+xml content type.
    Regarding you question i don't think that the target device understand the HTML.. on my mobile, it's J2ME application...
    Perhaps you can provide me some advices.
    Regards,
    Fred

  • Setting content type

    I am using servlet to display an Excel file to the browser.hence,for the same I need to set the content type.
    I make an object of file by:
    File file = new File("abc.xls");
    response.setContentType(application.getMimeType(file.getName()))which is giving the output as a garbled value.That is,it is not able to set the content type.
    but when I am using
    response.setContentType("application/vnd.ms-excel");It sets the content type.
    Any idea what is wrong with the first syntax?????//

    I think what you wrote and what I wrote is same.
    anyhow,the problem got solved using:
    response.setContentType(application.getMimeType(file.getName()));I added the following in web.xml
    <mime-mapping>
      <extension>xls</extension>
      <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>

  • Setting Content-Type when posting a SOAPMessage

    Hi,
    I have to change the Content-Type header before I send the SOAPMessage. But when I try to do that with code similar to the one below, the old header is used anyway. Any solution?
    SOAPMessage msg = createSOAPMessage();
    MimeHeaders headers = msg.getMimeHeaders();
    headers.setHeader("Content-Type", headers.getHeader("Content-Type")[0] + additionalParameters);
    SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
    SOAPConnection con = scf.createConnection();
    SOAPMessage reply = con.call(msg, "http://localhost:8080");

    I've found that when calling the saveChanges() method on a SOAPMessage instance that doesn't have any attachments, the 'Content-Type' header is set to 'text/xml; charset="utf-8"'. So what you should do is that you should be sure to set the 'Content-Type' header after any possible changes to the message have been saved.
    SOAPMessage msg = createSOAPMessage();// Modify message by adding elements...
    // Save the changes made to the message and then
    // change the "Content-Type" header...
    if (msg.saveRequired()) {
    msg.saveChanges();
    MimeHeaders headers = msg.getMimeHeaders();
    headers.setHeader("Content-Type",
    headers.getHeader("Content-Type")[0] +
    additionalParameters);
    SOAPConnectionFactory scf =
    SOAPConnectionFactory.newInstance();
    SOAPConnection con = scf.createConnection();
    SOAPMessage reply = con.call(msg,
    "http://localhost:8080");
    Hope this helps!
    BR
    Daniel

  • Mapviewer SVG and Content-Type http header

    Hello,
    We have a Mapviewer installation that seems to be serving up the wrong Content-Type header for the SVG charts. The map is being created correctly and we can get GIF's and such.
    The wrong Content-Type causes the Adobe SVG viewer to never render the SVG map successfully. When I save the SVG file to the desktop it opens perfectly or if I statically link it in to the web page from the sever it also opens perfectly. Is there some configuration that is missing somewhere on the mapviewer or the application server to correctly set the Content-Type ?
    Notice the content type of the failing map compared to a working SVG chart we have.
    HTTP/1.x 200 OK
    Content-Length: 41979
    Cache-Control: private
    Content-Type: application/octet-streamConnection: Keep-Alive
    Keep-Alive: timeout=5, max=999
    Server: Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server OracleAS-Web-Cache-10g/10.1.2.0.0 (N;ecid=92576875655,0)
    Last-Modified: Wed, 16 Aug 2006 20:31:58 GMT
    Date: Wed, 16 Aug 2006 20:32:01 GMT
    Accept-Ranges: bytes
    instead of a working SVG graphic
    HTTP/1.x 200 OK
    Date: Wed, 16 Aug 2006 20:35:32 GMT
    Server: Oracle9iAS/9.0.2 Oracle HTTP Server Oracle9iAS-Web-Cache/9.0.3
    Content-Length: 3831
    Content-Type: image/svg+xml; charset=utf-8Connection: Keep-Alive
    Keep-Alive: timeout=5, max=999
    This seems to be the last sticking point in successfully rolling out this mapviewer implementation. Any help would be greatly appreciated.
    Thanks, in advance.
    Thanks,
    Carl

    Hello,
    Thanks for the reply I've tried both SVG_URL and SVGZ_URL and used a http header sniffer to watch what's getting served up and the urls associated with MapViewer SVG are definitely getting served up with that wrong Content-Type.
    Our front end is an Oracle APEX environment were we use APEX's SVG charting on the same page and they are getting served up with the correct Content-Type and display correctly, which is nice cause I can watch the header difference's side by side, and we know the mapping itself is working right because we can get image files back
    Is there a sever config file or something like the httpd.conf for apache that needs to be set?
    Thanks for any help or insight
    Carl

  • Urgent: How to set content type on upload depending on target folder?

    Hi,
    i have to set the content type of a file uploaded via SMB depending on the folder the file is placed in. All files placed below a certain root directory have to be of my custom content type. All others should be stored as documents of type "Document". Is there an easy way to accomplish this task? I can't assume any specific file extensions and can therefore not register my custom content type to that extension.
    Any hints are welcome.
    Thanks.

    Hi,
    i have to set the content type of a file uploaded via SMB depending on the folder the file is placed in.All files placed below a certain root directory have to be of my custom content type.
    +++ Use an agent to verify the name and extension using the IfsEvent class and EVENTTYPE_CREATEINSTANCE
    All others should be stored as documents of type "Document". Is there an easy way to accomplish this task?
    +++ Those that aren't your custom content type move to a different folder using the agent.
    I can't assume any specific file extensions and can therefore not register my custom content type to that extension.
    +++I've found that registering content type only really affects things like how a browser knows what kind of file it's downloading/looking at (mime type) or how a renderer knows how to render it.
    Any hints are welcome.
    Thanks.

  • How to set content type for a JSF page

    Hi,
    I want to know is there any way we can specify the content type of a JSF page, like in JSPs we have the page attribute <%@ page contentType="application/vnd.ms-excel" %>
    In JSP we can create a html table with values and if we specify the contenType as application/vnd.ms-excel, we would get an excel file generated.
    But do we have something similar to this is JSF, as I am using Facelets I cannot use page directive in the xhtml file.
    I tried setting the content type in MangedBean's action as follows
    ((HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setContentType("application/vnd.ms-excel"); but it did'nt work.
    Thanks in advance.

    //add related mutip-part to combine parts
    MimeMultipart multipart = new MimeMultipart("related");
    //attach a pdf
    messageBodyPart = new MimeBodyPart();
    fds = new FileDataSource("h:/something.pdf");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.setFileName(fds.getName());
    multipart.addBodyPart(messageBodyPart);
    //add multipart to the message
    message.setContent(multipart);
    //send message
    Transport.send(message);

Maybe you are looking for

  • I give up

    Ok so as yall all know i have been posting up a storm on this thing and i have tried everything and my ipod is still not being read by Itunes so how would i send in the ipod or talk to a window litterate registered Apple rep. please share thoughts!!!

  • Urgent - Idoc type and the Message type

    Hello Its very urgent. I want to know the basic idoc type and the message type used for EDI 894 transmission (Delivery / Return Base Record). Please respond at the earliest. Thanks in advance

  • Removing Payment Draft

    HI I'm trying to remove a payment draft that I have on the system using the gollowing code however when getting to the .                                 oIncomingPaymentsDraft.GetByKey(GetDraftDocEntry)                                 oIncomingPaymen

  • BADI's in classic scenario after upgrading to SRM 07

    Hello, We are using the classic scenario, just finished upgrading the SRM 4.0 (server 5) to SRM 07. We are using ECC 6.0. We used the BADI's: BBP_CREAT_PO_BACK BBP_CREAT_RQ_BACK I have understood that in SRM 7.0 the BADI's that I have to use are: BBP

  • Problems with the function RFC_GET_TABLE_ENTRIES

    Hi experts,        We have a external application named P-Synch that is used when a user needs to change or unlock their password on our SAP system. The problem we are presenting is that in our PBP system the application is working fine but in our BW