You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Lucero, Dennis M" <de...@hp.com> on 2004/06/09 20:06:53 UTC

URL connections

I am having a strange problem. When I try and connect to a URL within
the struts framework (within an action class) I get errors.
 
Below is the code, this code works fine in a standalone java class
(main)  but in an action class I get an error when I try and 
Cast the connection,  any help is appreciated.
 
I do not get any exceptions thrown in the try blocks, and I get the
output con is NOT null
 
Thanks
 
 
---------------code -----------------------------
        String myUrl =
"https://onlinein.bankofamerica.com/cgi-bin/sso.login.controller";
 
        URL url = null;
 
        try{
        url = new URL(myUrl);
        }catch(Exception e){System.out.println(e.getMessage());}
 
        System.out.println("report url is:  " + url.toString());
        URLConnection con = null;
 
        try{
            con = url.openConnection();
        }catch(Exception e){System.out.println(e.getMessage());}
 
        if(con==null)
            System.out.println("con is null");
        else
            System.out.println("con is NOT null");
   
 
        HttpsURLConnection conn = (HttpsURLConnection)con;

 
 
 
 
 
 
------------end code ---------------------------
 
 
Because the world is round it turns me on
Because the wind is high it blows my mind
Because the sky is blue it makes me cry