progress messages from server

Discussion in 'Java' started by Roedy Green, Oct 23, 2003.

  1. Roedy Green

    Roedy Green Guest

    A customer of mine has asked how you best arrange for progress
    messages from a server for something that takes a long time to
    complete if you use plain HTTP.

    Do you just keep sending HTTP packets back to repaint one HTML frame,
    or is there something more to it?

    We was going to have me write some client side code to manage it, but
    he wanted this to work also in very old machines without decent Java,
    so I though the thin approach might work better.

    Is there a tutorial that explains the HTTP protocol on such matters?

    Likely the server side will NOT be Java.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Oct 23, 2003
    #1
    1. Advertising

  2. Roedy Green

    bm Guest

    Either you are going to poll the server every so often to find if the job
    is done that means you have to implement presistent sessions using
    cookies or session ids. This is not a good approach. Every client-server
    book would tell you not to poll the server.

    Or, have the server to keep a presistent session, same as the other choice,
    and update the status by sending the client http messages which means you
    have to do multi-threading on the server code. So much coding and change
    for such a small feature. Not worth the effort.

    Or, make your life easier. There are too many unknown variables here to now
    how long each operation would take. How are you going to make a progress
    bar anyway? Unless you set the progress based on the number of tasks that
    need
    to be accomplished to finish the job. So either partition the job and send
    each
    task to the server separately and show the progress that way in the client.
    Or
    if there is only one task to do, then have a simple flashing text saying
    'Please wait for such and such task to complete. This operation
    may take so and so much time. Please be patient. If the
    operation takes a long time, click the link below
    http://..... '
    Simple, easy and elegent.

    hope this saves you a lot of grief.


    "Roedy Green" <> wrote in message
    news:...
    > A customer of mine has asked how you best arrange for progress
    > messages from a server for something that takes a long time to
    > complete if you use plain HTTP.
    >
    > Do you just keep sending HTTP packets back to repaint one HTML frame,
    > or is there something more to it?
    >
    > We was going to have me write some client side code to manage it, but
    > he wanted this to work also in very old machines without decent Java,
    > so I though the thin approach might work better.
    >
    > Is there a tutorial that explains the HTTP protocol on such matters?
    >
    > Likely the server side will NOT be Java.
    >
    > --
    > Canadian Mind Products, Roedy Green.
    > Coaching, problem solving, economical contract programming.
    > See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    bm, Oct 23, 2003
    #2
    1. Advertising

  3. Roedy Green

    Roedy Green Guest

    On Thu, 23 Oct 2003 05:46:29 GMT, "bm" <>
    wrote or quoted :

    >Or, make your life easier. There are too many unknown variables here to now
    >how long each operation would take. How are you going to make a progress
    >bar anyway? Unless you set the progress based on the number of tasks that
    >need
    >to be accomplished to finish the job. So either partition the job and send
    >each
    >task to the server separately and show the progress that way in the client.


    The progress is a series of status messages.
    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Oct 23, 2003
    #3
  4. Roedy Green

    bm Guest

    If you want the business logic strictly in the server, then do the
    tasks in the server and send a status message in HTML to the
    client after completing each individual task. A servlet with
    session enabled would do the trick.

    Otherwise, put the logic in the client using multiple calls to the
    server. I think this approach would be more complicated. You
    have to think about synchronizing session and transaction logic
    between server and client.


    "Roedy Green" <> wrote in message
    news:...
    > On Thu, 23 Oct 2003 05:46:29 GMT, "bm" <>
    > wrote or quoted :
    >
    > >Or, make your life easier. There are too many unknown variables here to

    now
    > >how long each operation would take. How are you going to make a progress
    > >bar anyway? Unless you set the progress based on the number of tasks that
    > >need
    > >to be accomplished to finish the job. So either partition the job and

    send
    > >each
    > >task to the server separately and show the progress that way in the

    client.
    >
    > The progress is a series of status messages.
    > --
    > Canadian Mind Products, Roedy Green.
    > Coaching, problem solving, economical contract programming.
    > See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    bm, Oct 23, 2003
    #4
  5. Roedy Green wrote:
    > A customer of mine has asked how you best arrange for progress
    > messages from a server for something that takes a long time to
    > complete if you use plain HTTP.
    >
    > Do you just keep sending HTTP packets back to repaint one HTML frame,
    > or is there something more to it?


    It's a bit of a hack, but it should work: keep one HTTP connection
    for a page that's not visible (e.g. to a 0x0 pixel frame)
    open all the time by steadily sending a little data through it so that
    it does not time out. When you want to display a status message,
    send a javascript command that updates another frame.
     
    Michael Borgwardt, Oct 24, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roy Chastain
    Replies:
    2
    Views:
    442
    Sunwest Technologies
    Jun 1, 2004
  2. Kamil Koci
    Replies:
    0
    Views:
    451
    Kamil Koci
    Jul 15, 2004
  3. Charlie Zhang
    Replies:
    3
    Views:
    1,297
    Paul Lutus
    Aug 16, 2004
  4. RSH
    Replies:
    0
    Views:
    367
  5. Ravikanth
    Replies:
    3
    Views:
    436
    Flash Gordon
    Nov 28, 2008
Loading...

Share This Page