Announcement Announcement Module
Collapse
No announcement yet.
Strange side effects... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange side effects...

    Hi all,

    I'm working with a AbstractWizardFormController.
    Calling the processFinish and according to user answer I display a pdfView or an ExcelView...

    No problem with the former but the latter play me a trick...

    First, without adding any header, a popup ask me whether I want to display export.htm in my browser or record it on my filesystem, as export.htm is the url mapped on my controller.

    So I add
    Code:
    response.setHeader("Content-Disposition", "inline; filename=export.xls");
    and here come the side effect, nothing is displayed nor a popup and I'm back to the first page of my wizard.

    Thank you in advance for any help...

    Steph

  • #2
    Huhu,

    In fact, it seem's it does'nt work much with the pdf view too.

    Under Mozilla FF, all work good, but under IE, it try to open the file as export.htm without using accrobat pdf plugging. (So i've got a lot of symbol in a web page)

    And if I add
    Code:
    response.setHeader("Content-Disposition", "attachment;filename=letter.pdf");
    An exception append :

    ClientAbortException: java.net.SocketException: Broken pipe
    at org.apache.coyote.tomcat5.OutputBuffer.realWriteBy tes(OutputBuffer.java:373)
    at org.apache.tomcat.util.buf.ByteChunk.append(ByteCh unk.java:323)
    at org.apache.coyote.tomcat5.OutputBuffer.writeBytes( OutputBuffer.java:401)
    at org.apache.coyote.tomcat5.OutputBuffer.write(Outpu tBuffer.java:388)
    at org.apache.coyote.tomcat5.CoyoteOutputStream.write (CoyoteOutputStream.java:76)
    at java.io.ByteArrayOutputStream.writeTo(ByteArrayOut putStream.java:112)
    at org.springframework.web.servlet.view.document.Abst ractPdfView.renderMergedOutputModel(AbstractPdfVie w.java:96)
    at org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
    at org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:917)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:696)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:623)
    at org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:384)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:353)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    at sun.reflect.GeneratedMethodAccessor1406.invoke(Unk nown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.java:241)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject .java:499)
    at org.apache.catalina.security.SecurityUtil.execute( SecurityUtil.java:268)
    at org.apache.catalina.security.SecurityUtil.doAsPriv ilege(SecurityUtil.java:157)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.ac cess$000(ApplicationFilterChain.java:50)
    at org.apache.catalina.core.ApplicationFilterChain$1. run(ApplicationFilterChain.java:140)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:136)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:296)
    at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:372)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:694)
    at org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:626)
    at org.apache.jk.common.SocketConnection.runIt(Channe lSocket.java:807)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:644)
    at java.lang.Thread.run(Thread.java:536)
    Am I doing something wrong ?

    Thanks

    Steph

    Comment


    • #3
      This is a well known problem with IE.

      It ignores the mime type and only uses the file extension to determine what client side application to open.

      You'll need to open the export file as export.pdf and not export.htm.

      This goes for any file you want to open in IE, not just PDFs.

      IE will also request the PDF twice (WTF?) for some reason best known to Microsoft so be aware of that if your PDF is expensive to produce.

      Comment


      • #4
        Thanks,

        This is well fix...

        Just an open question :

        The Content-Disposition should set the filename for browser purpose... Why doesn't it work by this way ?
        Server problem ? (Jonas 4.1.2)
        Browser problem ?

        and what about this exception ?

        ClientAbortException: java.net.SocketException: Broken pipe
        Thanks

        Steph

        Comment

        Working...
        X