Bruce,

How you would do this depends in part on what that servlet does that's 
listening at /var/cars/

If you have all the data that is supposed to be at a particular path then 
removing that custom servlet and using the built in content creation process 
detailed at 
http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html
Is probably your best bet. 

So that something like this

curl -u admin:admin -F key1=value1 -F key2=value2 -F key3=value3 -F 
data=@filename localhost:8080/var/cars/fiat/124-F/1970

would generate that file structure, add all the keys and values as properties 
on the 1970 node and put your file beneath 1970.

-Jason

-----Original Message-----
From: Bruce Edge [mailto:bruce.e...@nextissuemedia.com] 
Sent: Friday, November 14, 2014 10:23 AM
To: users@sling.apache.org
Subject: SlingServlet paths/resourceType/etc for POST to nonexistent URLs in JCR

I have a SlingServlet working with a fixed length path, using 
sling.servlet.paths=/var/cars.

Under this I have a fixed format hierarchy consisting of make, model, year. I 
can populate by passing make, model, year and data as POST parameters.
curl -u admin:admin -F make=fiat -F model=124 -F year=1970 -F data=@filename 
localhost:8080/var/cars/

I'd like to handle POSTs to any path below the servlet's base path, e.g.:
/var/cars/{make}/{model}/{year}
eg:
curl -u admin:admin  -F date=@filename localhost:8080 
/var/cars/content/fiat/124/1970

I don't see a way to specify paths beyond the base without something kludgy 
like appending the make/model/year after a selector, i.e.:
/var/cars.json/fiat/124/1970

What's the recommended SlingServlet solution for pushing data into a sparse 
tree with lots of path name components?

-Bruce

Reply via email to