Using ProxySelector to allow users to configure the proxy

2009-04-30 Thread Paulo Levi
Hi. I'm using my application on networks that have proxy, and others that do not. I'm trying to make a ProxySelector that will use the System proxy setting as default (just pass the select request to the delegate), and if that fails, showing a dialog to configure the proxy for this application ins

Re: Using ProxySelector to allow users to configure the proxy

2009-04-30 Thread Paulo Levi
I've just realized that i could have explained this much more cogently by just saying: "I want to detect if i'm behind a proxy firewall". I'm thinking of using: InetAddress address = InetAddress.getByName("http://google.com";); if (address.isReachable(2000)) { //yes }else{ //no } but even google

Re: Using ProxySelector to allow users to configure the proxy

2009-05-04 Thread Paulo Levi
Anyone read the first message at all? The problem is that other proxy requests are effectively ignored after a DIRECT connection even if it fails. What i am trying right now is implementing ProxySelector so that a "manual" proxy configuration is added at the end of the public List select(final URI

Re: Using ProxySelector to allow users to configure the proxy

2009-05-04 Thread Paulo Levi
But it's completely unintuitive! I can't know if i need to bother the user about proxy configuration before trying with no proxy, but trying to use that disallows the use of any other. Trying to wrap Proxy.NO_PROXY to circumvent that, even if technically possible, just makes the code fail in the n

Bug in URLConnection?

2009-12-01 Thread Paulo Levi
Test case: package util.net; import java.io.IOException; import java.net.MalformedURLException; import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.util.Collections; import java.

Re: Bug in URLConnection?

2009-12-02 Thread Paulo Levi
The problem is that the proxyselector is being called at all. I have a real use case where i use the proxy selector to request proxy information for the user. To do that i have to make a (very dirty) url connection to a set of sites one of which i assume to be always up. This is recursive. To avoid

Re: Bug in URLConnection?

2009-12-02 Thread Paulo Levi
What i mean too is i expected the User given proxy selector to be the default "then". After all the ProxySelector installation call is ProxySelector.setDefault(userProxySelector);

Re: Bug in URLConnection?

2009-12-02 Thread Paulo Levi
Besides sending a Proxy to the connection should mean that the connection is going to use that proxy if any? Why ask the proxy selector anything?

Fwd: Bug in URLConnection?

2009-12-04 Thread Paulo Levi
-- Forwarded message -- From: Paulo Levi Date: Fri, Dec 4, 2009 at 9:57 PM Subject: Re: Bug in URLConnection? To: Christopher Hegarty -Sun Microsystems Ireland < christopher.hega...@sun.com> The problem is that the user (or any really) proxyselector is being called at all

Re: Fwd: Bug in URLConnection?

2009-12-07 Thread Paulo Levi
Huh? But it throws StackOverflowError. after installing UserProxySelector and calling any method. Just to be clear it is the right class, it is attached. My java version: E:\java\bin>java -version java version "1.6.0_14-ea" Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b04) Java HotSpot(TM) Cl

Re: Fwd: Bug in URLConnection?

2009-12-07 Thread Paulo Levi
ProxySelector) so it shouldn't recurse so no StackOverflowException. Saving the original proxy selector is just not to affect any other tests. On Mon, Dec 7, 2009 at 3:43 PM, Paulo Levi wrote: > Huh? > But it throws StackOverflowError. after installing UserProxySelector and > call

ImageIO hanging on TCP CLOSE_WAIT state on reading a url and closing the JVM?

2009-12-30 Thread Paulo Levi
Hi. I have a ThreadPoolExecutor that is using a thread factory that creates deamon threads. On these threads i do ImageIO.read(someURL). On a dual core machine i'm seeing hangs when i close my application and the JVM is in the ImageIO.read(URL) (i think on native code). My rationale is the follow

Re: ImageIO hanging on TCP CLOSE_WAIT state on reading a url and closing the JVM?

2009-12-30 Thread Paulo Levi
Correction. Not all tcp connections appear to need to be in CLOSE_WAIT in case of hang. I just tried again with the processor affinity set to 1 processor and i saw two established connections.

Re: ImageIO hanging on TCP CLOSE_WAIT state on reading a url and closing the JVM?

2009-12-30 Thread Paulo Levi
Also i noticed something. jps (and netbeans when debugging - but it still hangs) think that the process is finished while the windows taskmanager/process explorer shows it still. This would appear to be consistent with not being able to get a thread dump. This is a very strange state for a program

Re: ImageIO hanging on TCP CLOSE_WAIT state on reading a url and closing the JVM?

2009-12-30 Thread Paulo Levi
I believe i have isolated this, and it is in my code sorry: Apparently my ThreadPoolExecutor subclass misbehaves when the queue is full of pending tasks and a shutdown (by system.exit or normal termination of all windows) occurs, even if the threadfactory it uses marks the threads as daemon threads

Why does the new File(URI) constructor restricts the uri to hierarchical?

2011-05-14 Thread Paulo Levi
I have a mapping from uri to real files, and to i was hoping to use that constructor to do the work, however it says it only accepts, "absolute, hierarchical URI with a scheme equal to "file"" Now, many times on html files the uri would be the second notion of hierarchical from the javadoc "A *h

Re: Why does the new File(URI) constructor restricts the uri to hierarchical?

2011-05-16 Thread Paulo Levi
Yes, they are relative to the current directory of the file normally (the current dir won't work since the file might not be there). I was just surprised at the inflexibility since the file: scheme is not used on the net. I understand that trying to convert from relative (without scheme) to file i

Re: Why does the new File(URI) constructor restricts the uri to hierarchical?

2011-05-17 Thread Paulo Levi
That's not what i meant. Relative to the "parent directory of the file".

Re: Why does the new File(URI) constructor restricts the uri to hierarchical?

2011-05-17 Thread Paulo Levi
Which may be anywhere. > >