Hello everyone.

I have just downloaded Sling, and am very impressed with it. I am planning
on using it in conjunction with an Eclipse plugin to crowd source
information about open source projects.

I am having the usual teething problems that I get whenever I use an open
source product, and I am hoping to get some assistance. I have spent three
days getting going, so I have tried quite a few combinations.

Some general information for you "getting going with sling in 15 minutes"
was very helpful. I have a version of Sling built from the source code using
Maven, and a second which is the standalone Jar. On both of them the
following curl command didn't work:

curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some
title" http://localhost:8080/content/mynode


I had to replace it with:


curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some
title" http://localhost:8080/mynode


At the moment my Sling-fu is weak and I am not sure if this is some
configuration problem.
---------------

I am now at the point at which I feel the master of Sling (pride comes
before a fall) using Curl, so I have moved to Java. I have tried a number of
Java libraries include the Apache HttpClient, http-unit and Rest-assured. I
am now at the point at which I can get information out of Sling that I put
in with Curl, but I am unable to programatically add it. Specifically I can
create the node, but the attributes do not appear. Fairly obviously I am
missing some critical configuration

So I have the following questions:

   - ESP looks very nice. Where can I find information on how to use it. I
   have found some samples using it, but have not been very successful in
   finding tutorials / reference material.
   - What is the Java side client software that you recommend for use with
   Sling, and do you have any example code?
   - Can you advise why the following code does not set param1=value1,
   param2=value2?


import org.apache.http.*;
public class PopulateRepository {
public static void main(String[] args) throws Exception {
BasicCredentialsProvider credentialsProvider = new
BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new
UsernamePasswordCredentials("admin", "admin"));
DefaultHttpClient client = new DefaultHttpClient();
client.setCredentialsProvider(credentialsProvider);

String nodeName = "newNodeName";
List<NameValuePair> formParams = Arrays.<NameValuePair> asList(new
BasicNameValuePair("param1", "value1"), new BasicNameValuePair("param2",
"value2"));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");
HttpPut action = new HttpPut("http://localhost:8080/"; + nodeName);
HttpResponse response = client.execute(action);
       }}

Thanks for making such an interesting product

Reply via email to