Forums Register Login

How can I redirect to an ERROR message page when server is down?

+Pie Number of slices to send: Send
Hi
In My application I need to redirect to an ERROR message page if the web server is down/crashed? Is there a way to handle this problem. Kindly help me in this regard.
Thanks & Regards
Anand.
+Pie Number of slices to send: Send
I hope for you that you mean that you want to give an error if a remote server is down?
As your JSP runs inside your webserver you cannot have it redirect to an errorpage if the webserver is down because the request would never lead to the JSP being executed if the server is down because the server doesn't get the request because it is down.
For a remote server, you can check the HTTP return code from a request to the server and raise an error if it's not in the 200 range.
+Pie Number of slices to send: Send
Thanks for your response.
Can you eloborate about this."For a remote server, you can check the HTTP return code from a request to the server and raise an error if it's not in the 200 range."
+Pie Number of slices to send: Send
When you do an HTTP request to a webserver, it sends back (as part of the response headers) a status code.
This status code is normally 200.
You're probably familiar with 404 (file not found), 403 (not allowed), and 500 (internal server error).
All those are errors you can trap.
Likewise, you should be able to define some means to determine that a server is not responding at all (possibly a timeout trying to talk to it could be used for that).
Look into HttpURLConnection
+Pie Number of slices to send: Send
Hi
Thanks For your response. Once the server is down there is no response to the browser. I think we can't find timeout. Kindly let me know is there a way to find the time out in the browser.
+Pie Number of slices to send: Send
 


Once the server is down there is no response to the browser.


No 403, 404, 500 etc.? So you do mean when the webserver that is serving your app fails you still want to be able to redirect? This is impossible.
+Pie Number of slices to send: Send
Yes you correct. Once the server is down browser won't get any response.
Is there a way to handle this one using proxy server?
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1557 times.
Similar Threads
redirect in a filter class
response.sendRedirect() not redirecting
Disable back button
Custom Error Page
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:01:04.