Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 85270 - API for proxy setting
API for proxy setting
Product: platform
Classification: Unclassified
Component: -- Other --
All All
: P3 (vote)
: 6.x
Assigned To: Jiri Rechtacek
OSLO plan60
Depends on:
Blocks: 75856 88355
  Show dependency treegraph
Reported: 2006-09-19 21:29 UTC by Peter Zavadsky
Modified: 2008-12-22 14:08 UTC (History)
9 users (show)

See Also:

proposed changes in the arch document (5.74 KB, patch)
2006-11-16 19:11 UTC, Jiri Rechtacek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2006-09-19 21:29:23 UTC
We'd need to have an API to be able to change/access the proxy setting
programatically and also be informed about the proxy changes (bound property),
(when made via NB).

The API might look like:

<b>As a client, do not implement this interface, it is a subject of future
enhancements)</b>. Retrieve its singleton implementation via, 
public interface SystemSettings {

    public final String PROP_PROXY_HOST = "proxyHost"; // NOI18N
    public final String PROP_PROXY_PORT = "proxyPort"; // NOI18N

    public void setProxyHost(String proxyHost);
    public String getProxyHost();

    public void setProxyPort(int proxyPort);
    public int getProxyPort();

    public void addPropertyChangeListener(PropertyChangeListener l);
    public void removePropertyChangeListener(PropertyChangeListener l);
    // And possibly also:
    public void addPropertyChangeListener(String propName,
PropertyChangeListener l);
    public void removePrpertyChangeListener(String propName,
PropertyChangeListener l);

Of course the above API is only a suggestion, you can come up with a better
Comment 1 _ rkubacki 2006-09-21 08:39:06 UTC
Maros and Milan will be interested in such API too. Versioning has to be able to
go through various proxies (or bypass them for local accesses) and similarly we
have various use cases in websvc&j2ee development where correct proxy setting
can affect functionality. Autoupdate and welcome screen are another clients.

Petr: can you explain your use cases? 
1. Why do you need to change proxy settings ? 
2. Why do you need to read them?
3. What is the motivatiom for listen to changes?

ad 1: IMO we need to make it working OOTB in most cases and there should be just
one place to edit this configuration. As we've improved automatic proxy
detection in 5.5 and trunk I want to know what important configurations/special
cases we are not covering yet.

ad 2: AFAIK websvc&j2ee wants to know these settings so that they can start
appserver with similar setting. 

Implementation: can't we use + Wouldn't
it be nice if defining in
$JDKHOME/jre/lib/ or as a system property could set correct values?

BTW: Currently it is possible to read actual settings from system properties but
if you try to modify these it will not by propagated into IDESetting and can be
later reverted back.
Comment 2 Peter Zavadsky 2006-09-21 18:03:06 UTC
Here are the motivation answers:

1. Why do you need to change proxy settings ? 
2. Why do you need to read them?
To both of the above question. I think there is some webservice module which
needed this to access this in order to present it to user in some of their
specific UI, and also allow the user to adjust it. (The module owner would be
better to explain it.)

In sum you might expect that also other modules might want present to the user
the proxy settings and allow to change it [instead of just providing some
message, go to Options and do the change there.].

3. What is the motivatiom for listen to changes?
This is needed in order in our designer which have an ability load images
specified by url, which depends on proxy settings. When user changes the proxy
we would need to be informed so we can try reload the images.
(There is a following bug, if proxy is not set, the images are not loaded first,
but after user sets the proxy, then images are still not loaded - there is no
event fired about that, if the event is there then we'd try to reload the images
- or possibly other resources).
Comment 3 _ rkubacki 2006-09-25 08:59:35 UTC
1. & 2. Please let the module owner explain it. So far it is too general

3. I'd like to defer an idea of oficial contract here if possible. More
important IMO is to make it working OOTB in most of cases. Then this will be low
priority and you correctly set proxy it is no longer a problem..
Comment 4 Maros Sandor 2006-11-06 10:56:26 UTC
Speaking for versioning modules:

1. Is this API intended to replace all possible proxy settings in the IDE? If
so, we'd like to have support for multiple proxies. I can imagine people use
different proxies for different CVS servers now (and we support it). The
configuration dialog and system settings may be advanced enough to provide this
support. For example, I'd like an API like this:

public SystemProxy getProxy(String host);
[optional] public void setProxy(String hostOrHostPattern, SystemProxy proxy);
[something like] public void showProxyDialog();

class SystemProxy {
  enum type;
  String host;
  int port;

Settings may be different for every CVS server.

And while we're at it, it would also be nice to provide users with a
SocketFactory that would automatically use proxies to connect to remote hosts, ie:
Socket proxiedSocket = Utilities.getSocketFactory().createSocket();

2. I can only see proxyHost and proxyPort. What about proxy TYPE? I mean we have
at least two commonly used types of proxies: HTTP (HTTPS) and SOCKS.

1. Why do you need to change proxy settings ? 

We do not need to, we would need an API for launching the proxy configuration
dialog. For example, in the Checkout Wizard we have a [Proxy configuration]
button. Also, when a CVS operation fails, the error dialog (among other things)
also offers possibility to change proxy settings (and retry the command)

2. Why do you need to read them?

We need to pass proxy settings to external tools, namely subversion executable.

3. What is the motivatiom for listen to changes?

We do not need this.
Comment 5 _ rkubacki 2006-11-06 12:07:53 UTC
When reading Maros' comment it seems to me that some kind of showProxyDialog() +
registering of our own ProxySelector so that it is possible to use{Proxy|Proxyselector} can work in versioning. 
Comment 6 _ rkubacki 2006-11-06 13:39:51 UTC
welcome screen - reads the settings and attaches a listener to be able to reload
feeds. It needs HTTP proxy only I guess.
Comment 7 Stanislav Aubrecht 2006-11-06 14:03:45 UTC
i'm missing the options to set proxy username and password.
Comment 8 Maros Sandor 2006-11-06 14:12:40 UTC
I forgot to mention this too, so in my example:
class SystemProxy {
  enum type;
  String host;
  int port;
  String username, password;
Comment 9 Maros Sandor 2006-11-06 15:30:59 UTC
To follow up on discussion with jrechtacek: other IDEs support per-host proxy
settings for Subversion and CVS, just as we do now. So I'd sugget we think twice
before dropping this feature.
Comment 10 Jiri Rechtacek 2006-11-13 19:44:48 UTC
Proposed solution:
1. provide platform's implementation of and register it
as default ProxySelector in running IDE

- the ProxySelector returns the proxy server to use when connecting to a URL.
This registered ProxySelector is called back on each URL request in IDE. The
ProxySelector is also accessible by ProxySelector.getDefault() for other
application, e.g. to acquire a proxy or any special utilisation.

2. set JDK's property to true
- the platform's implemetation of ProxySelector delegates to JDK's default
ProxySelector when set Use System Settings. The default ProxySelector supplies
detection of Proxy Settings on Windows and Gnome2.x platform, for other platform
will be use the way of detection in IDE launcher

3. manually customization of Proxy Settings
- allow to invoke the Proxy Customizer which is shared over IDE, only this
Customizer can modify Proxy Settings
- xDesign team calls for Options dialog as Proxy Customizer (this part will be
reviewed as separate issue 75856)
- Add an API for opening the Options dialog (issue 74855)

4. the platform implementation supports HTTP/HTTPS, SOCKS, Proxy Server with

I would like to integrate it in NB6.0/M5.
I attach the arch documents and proposed classes ASAP.
Thanks for review.
Comment 11 Jiri Rechtacek 2006-11-13 19:48:22 UTC
Note: the proposed implementation also removes Proxy specific SystemOptions from
Comment 12 Stanislav Aubrecht 2006-11-14 10:03:32 UTC
i'm missing some kind of listener to notify me that proxy settings has changed.

use case: welcome screen downloads some rss feeds from internet. if the download
fails because of invalid proxy settings the welcome screen shows a button to
adjust proxy settings. however the user can choose to set proxy settings in the
options dialog using the main menu instead. in that case the welcome screen
needs to be notified that it should try to reload its content.
Comment 13 Jiri Rechtacek 2006-11-14 17:25:36 UTC
> i'm missing some kind of listener to notify me that proxy settings has changed

There is possible to listen for changes on the Preferences node which contains
Proxy Settings. Only need to know the path to the Preferences node and names of
keys which mapping Proxy Settings. It should be a subject of a friend contract
i.e. the path and keys documented in arch documents.
Comment 14 Jiri Rechtacek 2006-11-16 19:11:30 UTC
Created attachment 36106 [details]
proposed changes in the arch document
Comment 15 Jiri Rechtacek 2006-11-17 13:00:06 UTC
If there are no more comments I'll integrate it to trunk tomorrow, with some
- no default for now. Need fix issue 89540
- no shared customizee designed yet, waiting for an new method in Options API -
issue 64350 and issue 74855 
- no Options UI can set SOCKS and Authentication Proxy, new UI spec. is coming
soon, the new infrastructure can read it
- several modules depends on System's properties like http.proxyHost,
http.proxyPort, the proposed implementation should use these System's properties
as well
Comment 16 Jiri Rechtacek 2006-11-19 13:34:59 UTC
cvs server: scheduling file `' for addition
cvs server: scheduling file `' for addition
cvs server: use 'cvs commit' to add these files permanently
Checking in core/src/org/netbeans/core/;
/shared/data/ccvs/repository/core/src/org/netbeans/core/,v  <--
new revision: 1.132; previous revision: 1.131
RCS file:
Checking in core/src/org/netbeans/core/;
initial revision: 1.1
RCS file:
Checking in core/src/org/netbeans/core/;
initial revision: 1.1
Checking in core/src/org/netbeans/core/;
new revision: 1.47; previous revision: 1.46
Removing core/src/org/netbeans/core/;
new revision: delete; previous revision: 1.5
Checking in core/src/org/netbeans/core/;
/shared/data/ccvs/repository/core/src/org/netbeans/core/,v  <--
new revision: 1.86; previous revision: 1.85
Checking in core/src/org/netbeans/core/;
new revision: 1.20; previous revision: 1.19
Checking in core/test/unit/src/org/netbeans/core/;
new revision: 1.8; previous revision: 1.7
Checking in core/test/unit/src/org/netbeans/core/;
new revision: 1.9; previous revision: 1.8
Checking in core/nbproject/;
/shared/data/ccvs/repository/core/nbproject/,v  <--
new revision: 1.29; previous revision: 1.28
Checking in core/arch/arch-core.xml;
/shared/data/ccvs/repository/core/arch/arch-core.xml,v  <--  arch-core.xml
new revision: 1.14; previous revision: 1.13
Checking in
new revision: 1.7; previous revision: 1.6

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo