Discussions

Web tier: servlets, JSP, Web frameworks: Multiple response for one HTTP request

  1. Multiple response for one HTTP request (3 messages)

    The app that we'er building need to send back one HTTP response to one HTTP request, optionally followed by follow-up HTTP responses that might be seconds or even minutes late. What's a good way/tool to do this? Thanks.
  2. Multiple response for one HTTP request[ Go to top ]

    You mention about the second response being optional follow-up response. Maybe you should look at asynchronous processing such as JMS or Message-Driven-bean
  3. Multiple response for one HTTP request[ Go to top ]

    The problem is that the follow-up response needs to go to the browser that issued the riginal HTTP request. It would be better if the follow-up response is also an HTTP response, but it does not have to be. Does the servlet model or other frameworks do this?
  4. Multiple response for one HTTP request[ Go to top ]

    The only way to do this as an HTTP response is to keep the connection open from the browser, and the servlet thread running, and keep writing responses back periodically. Obviously, this is not scalable.

    A second option is to write a socket listener on the browser (possible with applets, not if you just have HTML+Javascript) and have the server connect back when it has follow-up responses.

    Someone suggested using JMS. You can send messages to a specific target with JMS. You can publish the message from the server with a message attribute indicating who it's meant for, and have the subscribers (browsers) use selectors to filter on the attribute.

    If that's not acceptable from a security perspective, you can create temporary queues/topics dynamically. I believe it (creating dynamic queues) is not J2EE standard, but app servers do support it. I know weblogic does.

    - Ravi