DaniSb170 / nctoolbox

Automatically exported from code.google.com/p/nctoolbox
0 stars 0 forks source link

Using proxy with nctoolbox #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
I have a problem setting the proxy with the actual nctoolbox 
(acrosby-nctoolbox_recent-e6d3a05). When I use the setproxy function I get an 
error Message from the ucar class that the setHHtpClient method is not 
available. Does anybody knows a workaround. I have no possibility to disable 
the proxy in our institute.

Best regards

What steps will reproduce the problem?
1. setproxy('http:/myproxy',3128)

What is the expected output? What do you see instead?

Error output:
The class ucar.nc2.dataset.NetcdfDataset has no property or method named 
'setHttpClient'.

Error in setproxy (line 17)
ucar.nc2.dataset.NetcdfDataset.setHttpClient(httpClient); 

Typing in:
httpClient.getHostConfiguration()

ans =

HostConfiguration[proxyHost=http://10.13.13.2:3128]

What version of the product are you using? On what operating system?
Win 7 / Matlab 2011b

Please provide any additional information below.

Original issue reported on code.google.com by aglo...@email.de on 15 Nov 2011 at 9:23

GoogleCodeExporter commented 8 years ago
It looks like the HTTP session management API's used by NetCDF-Java are 
changing. They're currently migrating from HttpClient 
(http://hc.apache.org/httpclient-3.x/index.html) to HttpComponents 
(http://hc.apache.org/); the full details are at 
http://www.unidata.ucar.edu/software/netcdf-java/reference/HTTPauthentication.ht
ml

Somewhere in the transition they've removed the setHttpClient method on 
NetcdfDataset. I'm looking at the Thredds (i.e NetCDF java) source code, but I 
can't find where they're managing the HTTP client anymore. I'll post a note to 
the netcdf users list.

Original comment by bschlin...@gmail.com on 15 Nov 2011 at 10:37

GoogleCodeExporter commented 8 years ago
I posted the following to netcdf-java at unidata dot ucar dot edu:

"Hi All,

I used to be able to set a proxy for the network connections used by 
NetCDF-Java with the following:

httpClient = org.apache.commons.httpclient.HttpClient();
httpClient.getHostConfiguration().setProxy(proxyname, port);
ucar.nc2.dataset.NetcdfDataset.setHttpClient(httpClient);

However, the setHttpClient method no longer exists. The docs I found about 
this, at 
http://www.unidata.ucar.edu/software/netcdf-java/reference/HTTPauthentication.ht
ml, basically say the same thing, i.e. use the setHttpClient method. What's the 
current recommendation for setting a network proxy?

Thanks

--
Brian Schlining"

Original comment by bschlin...@gmail.com on 15 Nov 2011 at 10:48

GoogleCodeExporter commented 8 years ago
From ucar:

Brian-
I provided a fix that will go into
a minor release of 4.2; should be available
shortly.

Basically there will be two procedures
1. HTTPSession.setGlobalSimpleProxy(String host, int port)
This is a static method that sets the proxy for all
connections.
2. HTTPSession.setSimpleProxy(String host, int port)
This is an instance method that sets the proxy for a
given connection.
The remaining issue is how to get the HTTPSession instance.
Do you normally use the HttpClientManager class to set up
connections?

=Dennis Heimbigner

This change appears in NetCDF-Java 4.2.28. I've updated 'setproxy.m' to set a 
global proxy. That should resolve this issue.

Original comment by bschlin...@gmail.com on 19 Dec 2011 at 6:46