Hi Phil

Check out the integration tests, as Bertrand suggested. In the class
AbstractAuthenticatedTest[0] there is pretty much the same code you're
trying to write. I think that should get you going.

Regards
Julian

[0] 
http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/AbstractAuthenticatedTest.java




On Fri, Jul 8, 2011 at 11:19 AM, Alexander Klimetschek
<aklim...@adobe.com> wrote:
> On 08.07.11 10:39, "Phil Rice" <phil.rice.erud...@googlemail.com> wrote:
>>DefaultHttpClient client = new DefaultHttpClient();
>>client.getCredentialsProvider().setCredentials(new AuthScope("localhost",
>>8080), new UsernamePasswordCredentials("admin", "admin"));
>
> I guess you need to use preemptive auth:
>
> client.getParams().setAuthenticationPreemptive(true);
>
> http://hc.apache.org/httpclient-3.x/authentication.html
>
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> Developer // Adobe (Day) // Berlin - Basel
>
>
>
>
>

Reply via email to