You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Buzzterrier <tj...@blueorigin.com> on 2014/01/03 00:07:46 UTC
Retrieving an uploaded file
Hello,
We are trying out Sling as a restful front end for a content repository. I
have have successfully posted an image file to the sling repository, but am
having some difficulty getting it back out. My post url looks like:
http://localhost:8090/blue/content/workorders/*
With a file of buzzhead.jpg
The repository successfully stores the image and has the following content
path:
blue
--content
----workorders
--------3_1388702474798
----------buzzhead.jpg
-------------jcr:content
note that the 3_1388.. is auto generated so I cannot retrieve the file using
GET http://localhost:8090/blue/content/workorders/buzzhead.jpg
Am I posting incorrectly? Without knowledge of the autogenerated number am
kind of stuck.
--
View this message in context: http://apache-sling.73963.n3.nabble.com/Retrieving-an-uploaded-file-tp4029988.html
Sent from the Sling - Users mailing list archive at Nabble.com.
Re: Retrieving an uploaded file
Posted by anjan <po...@gmail.com>.
Try posting to the URL http://localhost:8090/blue/content/workorders
Check the below page that clearly explains the Sling POST Servlet behavior.
http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html
--
View this message in context: http://apache-sling.73963.n3.nabble.com/Retrieving-an-uploaded-file-tp4029988p4029994.html
Sent from the Sling - Users mailing list archive at Nabble.com.
Re: Retrieving an uploaded file
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Fri, Jan 3, 2014 at 7:30 PM, Buzzterrier <tj...@blueorigin.com> wrote:
>> ...03/Jan/2014:10:17:19 -0800 "MKCOL /blue/workorders/http:/ HTTP/1.1" 500
If /blue/workorders/http:/ is the path that looks wrong.
> Any ideas on how to find what is causing the 500?...
http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
has two curl MKCOL examples, you might want to compare with what you
are doing.
-Bertrand
Re: Retrieving an uploaded file
Posted by Buzzterrier <tj...@blueorigin.com>.
Thx for the responses. I am experimenting with your suggestion to use WEBDAV.
I found a stackoverflow post where you pointed to the 1.0.6 test suite, so I
refactored my client based on it. I am getting an error in sling but cannot
figure out the cause. I changed the logging to trace but that did not give
me the actual exception:
> 03.01.201410:17:19.584*INFO*[qtp37282616-37 -
> /blue/workorders/http:/]logs/request.log03/Jan/2014:10:17:19 -0800 [3] <-
> 500 text/html 17ms
> 03.01.201410:17:19.584*INFO*[qtp37282616-37 -
> /blue/workorders/http:/]logs/access.log127.0.0.1 - admin
> 03/Jan/2014:10:17:19 -0800 "MKCOL /blue/workorders/http:/ HTTP/1.1" 500
> 2327 "-" "Apache-HttpClient/4.3.1
> (java 1.5)"
> 03.01.201410:17:19.584*DEBUG*[qtp37282616-37 -
> /blue/workorders/http:/]org.eclipse.jetty.server.ServerRESPONSE
> /blue/workorders/http:/ 500 handled=true
> 03.01.201410:17:19.584*DEBUG*[qtp37282616-37]org.eclipse.jetty.server.AsyncHttpConnectionEnabled
> read interest
> SCEP@50bcd85f{l(/127.0.0.1:40662)<->r(/127.0.0.1:8090),s=1,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=1r}-{AsyncHttpConnection@1e216e62,g=HttpGenerator{s=4,h=0,b=0,c=-1},p=HttpParser{s=0,l=22,c=0},r=4}
Any ideas on how to find what is causing the 500?
--
View this message in context: http://apache-sling.73963.n3.nabble.com/Retrieving-an-uploaded-file-tp4029988p4030034.html
Sent from the Sling - Users mailing list archive at Nabble.com.
Re: Retrieving an uploaded file
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Fri, Jan 3, 2014 at 12:07 AM, Buzzterrier <tj...@blueorigin.com> wrote:
> ...the 3_1388.. is auto generated so I cannot retrieve the file using
> GET http://localhost:8090/blue/content/workorders/buzzhead.jpg ...
The actual path where content is created is returned in a Location
header in the POST response, as is customary with RESTful interfaces,
you could use that to find out about the generated node name.
You can also supply a :nameHint parameter in your POST and Sling will
try to use that for the new node name, as described at [1].
Note that using WebDAV MKCOL / PUT methods instead of POST allows you
to specify an exact path, if it's just files that you are storing.
-Bertrand
[1] http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html