Check out Java Tips 42, 46, and 47at javaworld, they cover this subject
pretty well for both Java1.1 and 1.2 environments.

http://www.javaworld.com/javaworld/javatips/jw-javatip42.html
http://www.javaworld.com/javaworld/javatips/jw-javatip46.html
http://www.javaworld.com/javaworld/javatips/jw-javatip47.html

--Jeff


----- Original Message -----
From: Sean Snyders <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 20, 1999 12:00 PM
Subject: retrieving URL's from servlet through firewall ?


> Hey all,
>
> I'm trying to retrieve a URL from my servlet using the URL class
> and then making a inputreader from the URL.openstream, etc.
>
> The problem I have is how to do this through the firewall and the proxy
for
> that.
> I've got no idea so, please, any help is appreciated.
>
> Even though I 'open' my account with the firewall so that it doesn't ask
me
> the user name and passwd (like within a browser) I still get an
IOException
> using the following code:
> -----------------
> try
>   {
>    search_url = new URL(Query);
>    File outFile = new File(fileName);
>    PrintWriter outStream = new PrintWriter(new FileWriter(outFile));
>    BufferedReader inStream = new BufferedReader(new
> InputStreamReader(search_url.openStream()));
>    String line;
>    while ((line = inStream.readLine())!= null)
>    {
>       outStream.println(line);
>    }
>    inStream.close();
>    outStream.close();
>  } catch (MalformedURLException ex)
>   {
>    dbWin.println(col,"Error in doSearch: MalformedURLException occured.");
>  } catch (NoRouteToHostException ex)
>  {
>    dbWin.println(col,"Error in doSearch: NoRouteToHostException
occurred.");
>  } catch (IOException ex)
>   {
>     dbWin.println(col,"Error in doSearch: IOException occurred.");
>   }
> ------------
>
> Sorry for the long code excerpt.
>
> Thanx,
> Sean.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to