aspose file tools*
The moose likes Servlets and the fly likes How to Close the Response Object at ServerSide? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to Close the Response Object at ServerSide?" Watch "How to Close the Response Object at ServerSide?" New topic
Author

How to Close the Response Object at ServerSide?

tony mao
Greenhorn

Joined: Dec 03, 2001
Posts: 15
First i get the response object at the user connect to my servlet, then i will hold it for a period of time, and when the user is switch the page then i should close the response object.
What only can i do is to close the ServletOutputStream object from the response.
But the problem is that the connection between browser and web server is still alive, so when i refresh the page then the connection quickly up to the limitation of the setting of the web server, then browser will give me the error page: say that "There are too many people accessing the Web site at this time."
I want to close the connection between the browser and web server, can the servlet API support it? or how to set the web server to support it?
any reply is appreciated, thanks.
-- tony
liang gu
Ranch Hand

Joined: Nov 05, 2001
Posts: 89
The connection between the browser and the web server, is not permanent, and usually is short lived. Once the page finished the download, the connection is closed, unless you are using the "PUSH" technology.
Close the Response object, has nothing to do with the problem you are facing. If you close the output stream of the Response object, it just means the end of content sent to the browser. You do this only when you want to shut cut the content sent to the browser.(Say you have very long code, and you want to shut cut the content in the middle of the code)
The problem "too many users connected the server" is caused by some other reasons.
Liang
[ November 18, 2002: Message edited by: liang gu ]
tony mao
Greenhorn

Joined: Dec 03, 2001
Posts: 15
So nice to see ur reply, thanks.
>>you are using the "PUSH" technology.
yes i use the push method to send message content to the browser, so i have to hold the out put stream of the current response.
But how can i close the response? just close the output stream? Could u give me other ideas?
>>The problem "too many users connected the server" is caused by some other reasons.
Maybe it is not the problem with my code, but the with my server's connection settings.Now my web server's connection limitation is 10, say that when i hold the 10 response which is in use, then the web server will tell me "too many user in this site".
I am wondering that is there any performance problem using the push method to send message to browser?
Hope u can write down ur ideas, thanks
-- tony
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Close the Response Object at ServerSide?