dynamic file download with *long* response time - How to show "Save As" early?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • W.Guerlich

    dynamic file download with *long* response time - How to show "Save As" early?

    I've got a Java servlet that delivers large database resultsets
    transformed to Excel with the HSSF library. In some cases it takes
    more than 15 minutes before transformation is done and content can be
    delivered to the browser.

    I want to show the "Save As" dialog as early as possible so the user
    knows he's not lost and forgotten.

    I already tried to send the response headers immediately after
    receiving the request including content disposition and filename. Even
    though the browser receives those headers it just won't trigger the
    "Save As" dialog. This applies to both MS IE and Mozilla.

    Any ideas appreciated.
  • ak

    #2
    Re: dynamic file download with *long* response time - How to show "Save As" early?

    > I've got a Java servlet that delivers large database resultsets[color=blue]
    > transformed to Excel with the HSSF library. In some cases it takes
    > more than 15 minutes before transformation is done and content can be
    > delivered to the browser.[/color]

    for such long things you should redirect to some page which shows progress
    of
    your long operation (with JavaScript for example).

    --
    Andrei Kouznetsov
    http://uio.dev.java.net Unified I/O for Java
    http://reader.imagero.com Java image reader



    Comment

    • Nikolai Chuvakhin

      #3
      Re: dynamic file download with *long* response time - How to show "Save As" early?

      guerlich@t-online.de (W.Guerlich) wrote in message
      news:<38a20360. 0408040451.3a70 5cbe@posting.go ogle.com>...[color=blue]
      >
      > I've got a Java servlet that delivers large database resultsets
      > transformed to Excel with the HSSF library. In some cases it takes
      > more than 15 minutes before transformation is done and content can be
      > delivered to the browser.[/color]

      With this kind of response time, delivering the complete file
      via e-mail seems to be a much better idea...

      Cheers,
      NC

      Comment

      • Chung Leong

        #4
        Re: dynamic file download with *long* response time - How to show &quot;Save As&quot; early?


        "W.Guerlich " <guerlich@t-online.de> wrote in message
        news:38a20360.0 408040451.3a705 cbe@posting.goo gle.com...[color=blue]
        > I've got a Java servlet that delivers large database resultsets
        > transformed to Excel with the HSSF library. In some cases it takes
        > more than 15 minutes before transformation is done and content can be
        > delivered to the browser.
        >
        > I want to show the "Save As" dialog as early as possible so the user
        > knows he's not lost and forgotten.
        >
        > I already tried to send the response headers immediately after
        > receiving the request including content disposition and filename. Even
        > though the browser receives those headers it just won't trigger the
        > "Save As" dialog. This applies to both MS IE and Mozilla.
        >
        > Any ideas appreciated.[/color]

        One of those times when the HTTP response code 100 is of use?


        --
        Obey the Clown - http://www.conradish.net/bobo/


        Comment

        • Silvio Bierman

          #5
          Re: dynamic file download with *long* response time - How to show &quot;Save As&quot; early?


          "W.Guerlich " <guerlich@t-online.de> wrote in message
          news:38a20360.0 408040451.3a705 cbe@posting.goo gle.com...[color=blue]
          > I've got a Java servlet that delivers large database resultsets
          > transformed to Excel with the HSSF library. In some cases it takes
          > more than 15 minutes before transformation is done and content can be
          > delivered to the browser.
          >
          > I want to show the "Save As" dialog as early as possible so the user
          > knows he's not lost and forgotten.
          >
          > I already tried to send the response headers immediately after
          > receiving the request including content disposition and filename. Even
          > though the browser receives those headers it just won't trigger the
          > "Save As" dialog. This applies to both MS IE and Mozilla.
          >
          > Any ideas appreciated.[/color]

          That library keeps everything in memory until you close and write the
          document. It is useless for large resultsets.

          Use either tab/cr delimited data (which can be read by Excel as well) or
          generate Excel XML as a stream. That last option is only good for Excel 2003
          (2000 also supports a slightly different XML format).

          Silvio Bierman


          Comment

          • W.Guerlich

            #6
            Re: dynamic file download with *long* response time - How to show &quot;Save As&quot; early?

            "Silvio Bierman" <sbierman@jam bo-software.com> wrote:
            [color=blue]
            > That library keeps everything in memory until you close and write the
            > document. It is useless for large resultsets.
            >
            > Use either tab/cr delimited data (which can be read by Excel as well) or
            > generate Excel XML as a stream. That last option is only good for Excel 2003
            > (2000 also supports a slightly different XML format).[/color]

            On another occasion I successfully used such a hybrid HTML/XML format
            readable by Excel 2000. But this time the created Excel file must be
            compatible with Excel 97. Even though Excel 97 supports some kind of
            HTML format, too, it's not capable of preserving cell formatting.

            Since the first couple bytes of each generated Excel file always seem
            to be the same I thought about writing those bytes first and stripping
            them from the generated document later.

            From my observations I can tell that receiving the response header
            will make the readyState-property (MS IE only) of the current window
            go to "complete" for the browser then knows it's actually a file
            download it is receiving.

            But that still raises the question: What in the world makes the "Save
            As" dialog appear?

            Comment

            Working...