This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes http response problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "http response problem" Watch "http response problem" New topic
Author

http response problem

Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
Hi,
I am using out object of PrintWriter class to write response message to the client m/c.but some of the clients are unable to see it.[I am using css,javascript and content[html] objects and passing them to response by out.println()]but from some clients' browser it is not seen.i.e no login page is shown.I have inspected my code and sure that code written for showing login html is correctly called and executed.I am confused because some clients are able to see the login page but some are not.Is it due to some problem related to printwriter class[out object] which is unable to write the response back to the HttpResponse object?
Please reply soon... to my mail bunty.nil@gmail.com or here.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Souvik,

What did the clients see ? any error ? blank page ? whats the view source of it?


.I am confused because some clients are able to see the login page but some are not.Is it due to some problem related to printwriter class[out object] which is unable to write the response back to the HttpResponse object?


It cant be. response writer behaves same for all client
Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
client is getting blank page and waiting for long to get any response.After few minutes browser is showing timeout error.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


There are many cases to be evaluated.. check logs for any errors ? app log , context log or SOP .
if logs are fine , then issue can be only sorted through brainstorming questions..
What browsers do they use ? do they same clients alternate behavior? or is the problem with same clients.
Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
problem is with the client .not with the browser.Some client can access it peacefully.but some are not.Is it due to firewall issue which drops the response object?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


firewall wouldn't allow the site itself to be accessed.

problem is with the client .not with the browser.


What do you mean by client then?

Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
client means those who are accessing the application.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
One possible cause of a blank page is failure to flush and close the output stream. Your client browser may be waiting for the final chunk of output - which it never gets because you didnt close the output stream.

Bill
Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
If this happens then it must be same for all the clients. Right? but some client can access without any problem.and some are not.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
If this happens then it must be same for all the clients. Right?


Only if they are using identical browsers with identical settings performing identical requests.

Did you actually check your code to see if all possible paths result in closing the output stream? Did you check the logs for errors? Did you "view source" to see if any output has been received? When you have experienced servlet developers giving suggestions, you should follow up.


Bill
Souvik Basu
Greenhorn

Joined: Aug 22, 2009
Posts: 7
Yes all of them are using same browsers.But don't know about the settings.Yes output streams are closed.Those who are not been able to access,when they try to "view source" nothing is showing [probably nothing is responded back].Is it possible that due to some difference in settings browsers will behave differently?If it is so, then please tell me what to do to change the settings.And this problem is occurring mainly in the corporate access.Is it due to the fact that corporate firewall setting is blocking our response?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I would expect a corporate firewall to prevent the request from going through in the first place - once the request has been allowed, the response should be allowed, assuming everything is HTTP requests on port 80.

client is getting blank page and waiting for long to get any response.After few minutes browser is showing timeout error.


Perhaps your code is throwing an exception which is not being properly recorded. I have yet to see where you examined all the log files and found no errors.

Am I correct in assuming that this "login page" does not involve database access for the initial display?

Bill
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Souvik Basu wrote:Yes all of them are using same browsers.But don't know about the settings.Yes output streams are closed.Those who are not been able to access,when they try to "view source" nothing is showing [probably nothing is responded back].Is it possible that due to some difference in settings browsers will behave differently?If it is so, then please tell me what to do to change the settings.And this problem is occurring mainly in the corporate access.Is it due to the fact that corporate firewall setting is blocking our response?


If you still suspect firewall , access simple html and see if you get the complete html page , then there is no issue with firewall , but with the browser settings..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: http response problem
 
Similar Threads
HTTP Status 405 - HTTP method GET is not supported by this URL
getWriter() has already been called for this response
Servlets with JDBC connection
Ajax invalid Jason response with current page HTML
jQuery getJSON question