Friday Feb 11, 2011

New Network Settings API in NetBeans 7.0 RCP

Network Settings API has been recently added into NetBeans 7.0 RCP to allow RCP users to access a network proxy setting. The native launchers of NetBeans Platform detects network settings, mainly a network proxy settings, from operating system. This setting if found any, is the initial for NetBeans plugins when accessing the network. End-users of application (or IDE) can customize these settings in Tools|Options dialog.

A note: Since Beta2 NetBeans 7.0 can interpret also PAC like setting, i.e. automatic proxy configuration URL which provides proxies dynamically according to asked URL.

Network settings are absolutely transparent to plugins built on RCP, these plugins don't need to care of it, RCP installs own java.net.ProxySelector which returns network proxies according of settings in NetBeans and plugins don't need to specify a proxy. However, in some cases a plugin need to know the network setting (e.g. if they are using a external tool and need to setup it for accessing network). For these cases there is Network Settings API as part of Utilities API.

Using this API is quite easy, just call NetworkSettings.getProxyHost(java.net.URI u) for given URI to get a host name of network proxy, use similar method for getting a proxy port. In case if a proxy requires user authentication, there are the methods for get username and password.

About

Rechtacek's

Search

Categories
Archives
« February 2011
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
     
       
Today