problem while connecting to site using proxy server in weblogic 8.1
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_v
Posted On:   Tuesday, December 2, 2003 02:21 AM

Hi All, I am able to connect to the site www.testtest.com when i am running the below program out side a bea weblogic server as standalone program. but i couldn't able to connect to the www.testtest.com when i am accessing thru a progam that was running in weblogic server. my internet connection is via a proxy server. i am getting the below exception Tried all: '1' addresses, but could not connect over HTTP to server: 'www.testtest.com', port: '80' I am using weblogic server 8.1. Pls help me out in solving this. import java.io.*; public class testurl { public static void main(String[] args) { try { String username = "username"; Str   More>>

Hi All,

I am able to connect to the site www.testtest.com when i am running the below program out side a bea weblogic server as standalone program. but i couldn't able to connect to the www.testtest.com when i am accessing thru a progam that was running in weblogic server. my internet connection is via a proxy server. i am getting the below exception

Tried all: '1' addresses, but could not connect over HTTP to server: 'www.testtest.com', port: '80'

I am using weblogic server 8.1. Pls help me out in solving this.

import java.io.*;

public class testurl
{

public static void main(String[] args)
{
try
{
String username = "username";
String password = "password";
String proxy_internet_address = "111.111.12.12"; String proxy_internet_port = "80";
String urlString ="http://www.testtest.com/"; java.net.Authenticator.setDefault(new SimpleAuthenticator(username,password));
java.net.URL url = new java.net.URL(urlString);
java.util.Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost",proxy_internet_address);
systemProperties.setProperty("http.proxyPort",proxy_internet_port);
java.net.HttpURLConnection aConnection = (java.net.HttpURLConnection)(url.openConnection());
aConnection.setDoInput(true);
aConnection.setDoOutput(true);
aConnection.setUseCaches(false);
aConnection.connect();
java.io.InputStreamReader insr = new java.io.InputStreamReader(aConnection.getInputStream());
java.io.BufferedReader br = new java.io.BufferedReader(insr);
String s="";
String textString =null;
while((textString = br.readLine())!=null)
{ s = s + textString; }//end of while
br.close();
aConnection.disconnect();
PrintWriter pw = new PrintWriter(new FileOutputStream("test.html"));
pw.println(s);
pw.close();
}catch(Exception e)
{ System.out.println(e.toString()); }
}
}

   <<Less
About | Sitemap | Contact