cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: How do I use FileGenerator to get source from a URL that requires authentication (username/ password challenge)/
Date Sun, 29 Apr 2007 09:05:04 GMT
On 27.04.2007 04:49, Joseph White wrote:
> I would expect the the basic authentication scheme to be used within the
> FileGenerator .. but I don't know where to pass in the username:password 
> for
> my case using the username:password@host:port directly in a browser to the
> site I am interested in does not work.  Are you saying that the cocoon
> FileGenerator will strip the username:password part and, in effect to the
> following:
>   1. URL url = new URL(urlstring);
>   2. String userPassword = theUsername + ":" + thePassword;
>   3. String encoding = new sun.misc.BASE64Encoder().encode(
>   userPassword.getBytes());
>   4. URLConnection uc = url.openConnection();
>   5. uc.setRequestProperty("Authorizatio","Basic " + encoding);
>   6. ...

Hi Joseph,

it took some time until I found the time to find out who does what:
"username:password@host:port" is indeed mentioned in the actual standard 
[1]. And Cocoon's source resolving (based on/ using Apache Excalibur 
source resolving) does indeed execute the code you wrote above [2]. The 
rest is done by JDK's and URLStreamHandler.
So it should indeed work the way I wrote.

If it does not work for you when directly used in the browser it might 
be that another URL handling is used on the server you are requesting 
the page from. But FileGenerator uses the way described.


     section 3.2.2. Server-based Naming Authority
     starting line 160

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message