Try this:
try{
URL url=new URL(SomeURL);
InputStream my_InputStream=url.openStream();
my_InputStream.close();
}catch(Exception e){
res.sendRedirect(errorPage);
return;
}
res.sendRedirect(someURL);
.......
=================================
Works for me... :-)
--Shrisha
----- Original Message -----
From: "Andy Purshottam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 27, 2000 6:14 PM
Subject: Re: sendRedirect: Catching unknown host/timeout etc
> It's done on the _client_ side.
> How is the server supposed to know
> what the client can do?
>
> The only thing I can think of is not doing
> a redirect, but instead sending a page of javascript
> that would do the page fetch and catch errors.
> And for info about that, go to a client side javascript list.
> Andy
>
> -----Original Message-----
> From: Sushil Singh [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 27, 2000 5:55 PM
> To: [EMAIL PROTECTED]
> Subject: Re: sendRedirect: Catching unknown host/timeout etc
>
>
> Is there any simple way to check before performing the redirection?
>
> Andy Purshottam wrote:
>
> > My understanding is that re-direction is done on the
> > client sde, by the browser. So catching problems in re-direction
> > would require client side support, ie probably javascript, if
> > it was possible.
> >
> > Andy
> >
> > -----Original Message-----
> > From: Sushil Singh [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, November 27, 2000 5:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: sendRedirect: Catching unknown host/timeout etc
> >
> > Hi,
> >
> > Since my application is redirecting to a third party site, I would like
> > to display a user-friendly page if there is any problem in that site,
> > like site is down, connection timeout or even unknown host etc. But I
> > am unable to catch these types of error, I am using following code:
> > try {
> > response.sendRedirect("www.xyz.com");
> > } catch (Exception e) {
> > System.out.println("Some error occurred....");
> > }
> >
> > Is there any way to check before redirecting whether site is up,
> > existing etc. Any help will be highly appreciated.
> >
> > Thanks in advance.
> >
> > Sushil
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets