Thanks for the help Alex. Unfortunately that is one of the things that has
changed in the new API. Its no longer a method available from the
parameters. However the advice to follow the test framework was very good
and the following now works. I can rip this apart and reduce to to the
minimum working, which I will post for the benefit of anyone else trying to
do this.
DefaultHttpClient httpClient = new DefaultHttpClient();
RequestExecutor executor = new RequestExecutor(httpClient);
String nodeName = "slingNode1";
List<NameValuePair> formParams = Arrays.<NameValuePair> asList(new
BasicNameValuePair("param1", "value1"), new BasicNameValuePair("param2",
"value2"));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");
System.out.println(executor.execute(requestBuilder.buildPostRequest(nodeName).withEntity(entity).withCredentials("admin",
"admin")).getContent());
System.out.println(executor.execute(requestBuilder.buildGetRequest(nodeName
+ ".json")).getContent());
Once again thanks for all the help, and I look forward to seeing some of you
in September at Berlin.
Phil
On Fri, Jul 8, 2011 at 10:19 AM, Alexander Klimetschek
<[email protected]>wrote:
> On 08.07.11 10:39, "Phil Rice" <[email protected]> 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
>
>
>
>
>