BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-15-2008, 01:45 AM   #1
skynetchris
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: optus
Posts: 24
Default Handset application proxy handling

Please Login to Remove!

Hi guys,

I have an application that makes a http connection to a server, this works fine. The connection now must be made to a server that is behind a proxy. I've read in java you can use the Authenticator class to handle this. There are a few examples here and here.

My Code:
Code:
ProxyAuthenticator() { 
this.user = "user"; 
this.password = "test";
}

  public PasswordAuthentication 
  onAuthenticationChallenge(String description, boolean isUserIdRequired, boolean isFullAccess) {
    return new PasswordAuthentication(user.getBytes(), password.getBytes());
  }
  public byte[] onAuthenticationResponse(byte[] userName) {return null;}
}
The problem seems to be that in the Blackberry environment, you can't tell the sytem what to do when it is queried by a proxy:
Code:
and put these lines of code before your code opens an URLConnection-

Authenticator.setDefault(new ProxyAuthenticator("user", "password"));
System.setProperty("http.proxyHost", "proxy host");
System.setProperty("http.proxyPort", "port"); 

Now all calls will successfully pass through the proxy authentication.
Can anyone tell me what you have to do to 'register' your authenticator implementation with the system?
Offline  
Old 07-15-2008, 01:50 AM   #2
skynetchris
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: optus
Posts: 24
Default

please delete, posted under developer corner.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Vintage Mac Warehouse  3.5” Floppy Disk Solar Powered Calculator Company Swag picture

Vintage Mac Warehouse 3.5” Floppy Disk Solar Powered Calculator Company Swag

$51.80



Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ picture

Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ

$199.00



Vintage White APPLE IMAC EMC 1857 15

Vintage White APPLE IMAC EMC 1857 15" 20GB HDD Mac OSX 10.2 256MB RAM 500MHz

$85.00



Vintage MAC TOOLS 18MM Combination Wrench M18CW Metric 12 point **Made in USA** picture

Vintage MAC TOOLS 18MM Combination Wrench M18CW Metric 12 point **Made in USA**

$26.50



Vintage UNHOLTZ-DICKIE MAC-6C Equipment - Untested As-is picture

Vintage UNHOLTZ-DICKIE MAC-6C Equipment - Untested As-is

$71.99



VINTAGE RICHARD PETTY #43 MAC TOOLS RACING RED MAGNETIC 90's CAR FENDER COVER picture

VINTAGE RICHARD PETTY #43 MAC TOOLS RACING RED MAGNETIC 90's CAR FENDER COVER

$89.99







Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.