Resolved.

Finally I use Apache HttpClient for my requests.

The problem is that HttpURLConnection always calls 
CredentialManagerAuthenticator when authentication fails.

"... HttpURLConnection will first try to invoke a request without any 
authentication headers set. If the server requires authentication, the 
initial request will fail with a 401, "Unathorized" response code. The 
HttpURLConnection implementation then looks at the WWW-Authenticate 
header to see whether Basic or Digest Authentication should be used and 
retries the request."

There is an issue to provide an Authenticator with 
"allowUserInteraction" property from the connection:
https://bugs.openjdk.java.net/browse/JDK-6373620

Cheers,

Dmitry

On 3/3/2014 12:36 PM, Dmitry wrote:
> Hello,
>
> Working on my BioSWR plugin I try to check an authorization via
> HttpURLConnection.
>
> The code looks like:
>
> URI uri =
> URI.create("http://inb.bsc.es/BioSWR/rest/service/deregister/00000000000000000000000000000000";);
> HttpURLConnection connection = (HttpURLConnection)
> uri.toURL().openConnection();
> connection.setRequestProperty ("Authorization", authorization);
> connection.connect();
> int code = connection.getResponseCode();
>
> The problem (?) is that this is intercepted by Taverna credential manager.
> Probably I can use Taverna's manager somehow?
>
> Kind regards,
>
> Dmitry
>
> ------------------------------------------------------------------------------
> Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
> _______________________________________________
> taverna-hackers mailing list
> taverna-hackers@lists.sourceforge.net
> Web site: http://www.taverna.org.uk
> Mailing lists: http://www.taverna.org.uk/about/contact-us/
> Developers Guide: http://www.taverna.org.uk/developers/
>
>


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
taverna-hackers mailing list
taverna-hackers@lists.sourceforge.net
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

Reply via email to