GeeCON Prague 2014*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes What happens to the request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "What happens to the request" Watch "What happens to the request" New topic
Author

What happens to the request

Roger Rustin
Greenhorn

Joined: Jul 08, 2004
Posts: 19
While working on the assignment I came across a scenario answer to which I would like to know as an architect(or a developer).

The user searches for a flight. The search process is resource intensive and most of the web sites displays some kind of 'in-progess' bar while the search is going on. Assume that while search is going on , I hit a back button and change the data and submit again.

My question is what happened to the first request. If the first requet is in the middle of heavy processing, will the processing continue?

Let's assume that just a second after the user hit the second submit the first processing got completed. Will the server send the response and the browser will drop that response since a new process was already invoked? Or the server will not send any response since a new process is already started.

So many questions. I'm just trying to understand the basics of how the web based applications work. If my question is not clear then please let me know.

Thanks.
- Roger
James Wang
Ranch Hand

Joined: Sep 04, 2003
Posts: 102
Roge,

I wish I understant your problem, you click the back button of the browse and re-send the request to web server,how does the server process?

If your want to prohibit this scenario, you may use token technology, it will prohibit this behavior fully, but I think it is not required to be considered, the exam is about the archecture, not the detail.


James<br /> <br />SCJP,SCWCD,SCBCD,SCDJWS,SCEA
Roger Rustin
Greenhorn

Joined: Jul 08, 2004
Posts: 19
My fault. Let me retry explaining the problem. By the way this question is for the discussion and not for the exam. The exam doesn't ask us to go in such depth.


Process A requires heavy operation on the server side. The user sends request1 which invokes process A. Let's call this particular instance of the process as A1.

While the process A1 is going on the user gets impatienct and hits the refresh button. What happens now. The request2 is sent which invokes process A again. Let's call this instance of the process A2.

1)Will the process intance A1 complete its full course or not? I mean will the process instance be interrupted since a new request has come.

2) Since the request2 is already received by the server will the server send the response to request1 to the browser only to find out that the browse will drop the respone since the browser is expecting response from request2.

3) Or the serve will complete the process A1 but will not send an HTTP response since a new request request2 has already been received.


Please keep in mind that I am not looking for a fix. We all know that struts offers token [save(token)] which can help mitigate the problem. I just want to know what happens to the abandoned process.

thanks.
- Roger
2)
Matt Lewis
Greenhorn

Joined: Jul 26, 2004
Posts: 8
As i understand it, because of the nature of HTTP, each request to a server from a browser is treated as a unique request. Therefore, request A will run to completion, as will request B on the server side. Design patterns such as the Synchronizer Token can be used to prevent the sending of duplicate requests.
 
GeeCON Prague 2014
 
subject: What happens to the request