You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Bruce Edge <br...@nextissuemedia.com> on 2014/11/14 16:23:25 UTC
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
Re: SlingServlet paths/resourceType/etc for POST to nonexistent URLs
in JCR
Posted by Bruce Edge <br...@nextissuemedia.com>.
Never mind on this. I opted for a event handler for a watch folder and a JobConsumer to do the actual work. (One of Bertrand's original suggestions)
One thing I have to comment on regrading working with sling as compared to spring or any other java framework. It just works. I'm amazed at how little fuss it took to get this working. No pondering for hours of multiple xml files wondering what magic incantation I'm missing.
Thanks for the great support too. Everyone on this NG is extremely helpful.
-Bruce
From: Bruce Edge <br...@nextissuemedia.com>>
Reply-To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Date: Friday, November 14, 2014 at 11:39 AM
To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Subject: Re: SlingServlet paths/resourceType/etc for POST to nonexistent URLs in JCR
I went with the servlet option initially because I need to process the posted data file before writing into the JCR. The data consists of a collection of zip files, all of which need to be unpacked prior to adding to the JCR. IOW the JCR should contain the fully expanded data using the same hierarchical structure as is present in the zip of zips included in the POST data along with some added properties for various file types.
Is this still feasible with the built-in content creation mechanism or do I need to stick with the servlet?
thanks
-Bruce
From: Jason Bailey <Ja...@sas.com>>
Reply-To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Date: Friday, November 14, 2014 at 10:09 AM
To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Subject: RE: SlingServlet paths/resourceType/etc for POST to nonexistent URLs in JCR
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.edge@nextissuemedia.com]
Sent: Friday, November 14, 2014 10:23 AM
To: users@sling.apache.org<ma...@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
Re: SlingServlet paths/resourceType/etc for POST to nonexistent URLs
in JCR
Posted by Bruce Edge <br...@nextissuemedia.com>.
I went with the servlet option initially because I need to process the posted data file before writing into the JCR. The data consists of a collection of zip files, all of which need to be unpacked prior to adding to the JCR. IOW the JCR should contain the fully expanded data using the same hierarchical structure as is present in the zip of zips included in the POST data along with some added properties for various file types.
Is this still feasible with the built-in content creation mechanism or do I need to stick with the servlet?
thanks
-Bruce
From: Jason Bailey <Ja...@sas.com>>
Reply-To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Date: Friday, November 14, 2014 at 10:09 AM
To: "users@sling.apache.org<ma...@sling.apache.org>" <us...@sling.apache.org>>
Subject: RE: SlingServlet paths/resourceType/etc for POST to nonexistent URLs in JCR
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.edge@nextissuemedia.com]
Sent: Friday, November 14, 2014 10:23 AM
To: users@sling.apache.org<ma...@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
RE: SlingServlet paths/resourceType/etc for POST to nonexistent URLs
in JCR
Posted by Jason Bailey <Ja...@sas.com>.
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.edge@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