| View previous topic :: View next topic |
| Author |
Message |
DenisC General User

Joined: 30 Oct 2006 Posts: 8
|
Posted: Thu Dec 28, 2006 10:27 am Post subject: Java Macro works in Linux, but not in Windows... why?? |
|
|
The company i work for requested a macro that fetches data in xml format in the company intranet and writes it in a Calc sheet. The macro is developed, and it works perfectly in Debian Linux. In Windows 2000 it dont work at all. And the problem is at the moment it tries to open a connection with a URL object.
| Code: |
public InputStream getRastreamento() {
try {
URL url = new URL(this.URL_RASTREAMENTO + "?Tipo=L&Resultado=" + tipoBusca.charAt(0) + "&Objetos="
+ objetos);
URLConnection con = url.openConnection();
return con.getInputStream();
} catch (...) |
The code above is without the exception handling, but the point is:
1) the macro works in linux.
2) when i run the code outside the OOo, it works. i get the data.
3) running inside a macro in the OOo Calc, it is giving me the following error message:
Server redirected too many times(20).
I think it might be something with the proxy settings (it should not use a proxy) but i cant pin it down. can anyone shed some light into it |
|
| Back to top |
|
 |
DenisC General User

Joined: 30 Oct 2006 Posts: 8
|
Posted: Fri Dec 29, 2006 3:07 am Post subject: |
|
|
OK. After some 12 hours browsing java documentation on the web, and bugging the java developers here at work, someone found out what was happening:
The deal is:
Linux handles the Http requests as-is. It will try to access the URL directly, thats why the intranet application worked perfectly in first try.
For a internet version of the same application, the proxy settings had to be supplied in the code:
| Code: | System.setProperty("proxySet","true");
System.setProperty("http.proxyHost","127.0.0.1");
System.setProperty("http.proxyPort","myNtlMapsPort"); |
Windows, on the other hand, sends all URL requests to the proxy. It has to be instructed NOT to use the proxy if its a intranet application:
| Code: | | System.setProperty("http.proxyHost", "") // "" = blank string. |
Both versions of my application work perfectly now, in Linux and Windows, and im getting a early New Year holliday.
=) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|