• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help : proxy server !!!!

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am trying to get thru the proxy server which requires authentication.
Here is my code but I am getting hangs in between.
Can anyone helps me out:
HttpConnection c = (HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.GET);
String password = "username : password";
base=new Base64Encoder();
String encodedPassword = base.encode(password);
c.setRequestProperty( "Proxy-Authorization", "Basic" +encodedPassword );
c.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Confirguration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
is = c.openDataInputStream(); //It hangs here throws IOException
len = c.getLength();
if( len != -1)
{
// Read exactly Content-Length bytes
for(int i =0 ; i < len ; i++ )
{
System.out.println("4");
if((ch = is.read()) != -1)
{
System.out.println("5");
b.append((char) ch);
}
}
}
else
{
//Read until the connection is closed.
while ((ch = is.read()) != -1)
{
len = is.available() ;
b.append((char)ch);
}
}
Can anyone help..
any help will be great..
thanks,
[ July 24, 2002: Message edited by: Ashley Love ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic