This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get around the single request-response thing  RSS feed

 
Iris Hoekstra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is likely that I am not the first to wrestle with this problem but I can't find a solution anywhere so here goes...

I have written a servlet that receives a request from the browser and then uses RequestDispatcher to forward its request to another servlet in another web application. This works fine.

Now, the good people at my office tell me to make the servlet respond immediately after it receives its request from the browser, before it does everything else it has to do. Obviously I cannot send a response to the browser and then forward the request. Has anyone dealt with this problem before?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respond with what? And what does the second servlet do and how is it supposed to interact weith the first response?

Need a bit more clarity.
 
Iris Hoekstra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

It should respond with a simple string saying "started" or something.

The second servlet (which is in another web app) calls a class that digs through a DB2 database and sends some things it finds there to yet another database. Then the servlet forwards back to the first app where a report of what happened is saved. The whole point of everything is to keep the two databases synchronized.

Hope I'm making sense. I could post code but I don't really know what to choose since there is a ton of it and most of it is very specific to our situation.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words, they want an "I'm working on it" page to display while the second web app is contacted?

If so, you might consider just having the JSP page that will initiate the original request have a hidden div, containing a "working..." type of message, that you display (using JavaScript) just before the request is submitted.

That way, you avoid having to do any shenanigans with your existing servlet.
 
Iris Hoekstra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
In other words, they want an "I'm working on it" page to display while the second web app is contacted?


Exactly!

The hidden div is not a bad idea but I forgot to mention that the initial request is not fired by a person but by an application on our mainframe. In other words, there is no click on a button or anything, there isn't even a screen, the thing on the mainframe just contacts an URL. If I send back a jsp or write to the outputstream, it is able to read this. But I don't think there is a way to do this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then I'm confused again. If there is no screen, who are you trying to show the message to and how?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!