Hi Reinhard,

when I try providing the username and password like you suggested (
http:un:[email protected]/some.xslt), I get a 401 from apache. However, using
URLConnection and setting the request property manually as mentioned in the
previous mails works fine:
...
     String encoding = new sun.misc.BASE64Encoder().
>
>     encode((username + ":" + password).getBytes());
>     URLConnection uc = url.openConnection();
>     uc.setRequestProperty("Authorization", "Basic " + encoding);
>      XMLUtils.toSax(uc.getInputStream(), this.getXMLConsumer());

...

Cheers, Nils

On Mon, Apr 27, 2009 at 10:26 PM, Reinhard Pötz <[email protected]> wrote:

> Nils Preusker wrote:
> > Hi all,
> >
> > I just started trying out cocoon 3 alpha 1 and I'm wondering if there is
> > a solution for the following scenario: I'm retrieving all my XML and
> > XSLT content via URLs that require authentication. Without the
> > authentication I could simply create a pipeline like this:
> > ...
> > Pipeline pipeline = new NonCachingPipeline();
> > pipeline.addComponent(new StringGenerator("<x></x>"));
> > pipeline.addComponent(new XSLTTransformer(new
> > URL("http://example.com/somexslt.xslt";)));
> > pipeline.addComponent(new XMLSerializer());
> >
> > ByteArrayOutputStream baos = new ByteArrayOutputStream();
> > pipeline.setup(baos);
> >
> > pipeline.execute();
> > ...
> > That's almost the same as the example on the cocoon website. The only
> > difference is that instead of a file I'm using a URL to provide the
> > XSLT. This works if I disable authentication for my XML/XSLT repository.
> > But when I enable authentication, I'll end up with an exception and a
> > 401 from apache somewhere in the stack trace...
> >
> > So in short: I'm wondering if there is a way to create an
> > XSLTTransformer that can retrieve data from URLs that require
> > authentication?
> >
> > Any help would be greatly appreciated! Cheers, Nils
>
> Hi Nils,
>
> AFAIK the Java URL object supports RFC1738: See
> http://tools.ietf.org/html/rfc1738#section-3.1
>
> Could you please try
>
> http://username:[email protected]/somexslt.xslt
>
> Please report back if that works for you. Thanks!
>
> --
> Reinhard Pötz                           Managing Director, {Indoqa} GmbH
>                         http://www.indoqa.com/en/people/reinhard.poetz/
>
> Member of the Apache Software Foundation
> Apache Cocoon Committer, PMC member                  [email protected]
> ________________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to