Hi, After looking at other servlets from Nakamura, it seems that the Create POST Servlet should use a PATH binding instead of a resourceType binding. Now I can use .create.json ending and it enters my Create servlet.
I also had a problem with the resourceType property, as it never entered my GET servlet. I had tried "sling:resourceType=/resource/type/", but it has to be "sling:resourceType=resource/type", without additional slashes. Now it works: if I create random content with the good contentType, it goes to the GET servlet. My last problem is with content I create with my Create servlet. I am using contentManager.update() in my Create servlet to save the Content. I use a properties map that I pass to the Content() constructor. The output of a GET on a resource created by my servlet looks like that : {"changes":[],"isCreate":false,"status.code":200,"status.message":"OK","title":"Content modified null","referer":""} Is there anything I need to do to make it go to my GET servlet? I am available on sakai IRC (nickname: zasz). Thank you, Samuel. 2012/10/2 Zach A. Thomas <zach.tho...@gmail.com> > Sorry, I hit send by accident. The resource you’re requesting must have > the sling:resourceType property set to the value you’re using in your > SlingServlet annotation. The selector, goes between the resource name and > the extension, so instead of: > /create.json > > You need: > /foo.create.json > > You seem to be using your path as a way of expressing resource type, but I > don’t think it works that way. The resources can be at any path, and their > resourceType will be determined by the value of the sling:resourceType > property. > > Zach > > On Oct 2, 2012, at 3:05 PM, Samuel Champoux <sam...@1337.ca> wrote: > > Hi, > > There must be something somewhere that I don't understand because I am > unable to link GET and POST Servlets to a resourceType. > > For the POST servlet, I use this annotation : > @SlingServlet(methods = { "POST" }, resourceTypes = { "/resource/type/" }, > selectors = { "create" }, extensions = { "json" }) > > With the following curl it works: > curl --referer http://localhost:8080 -Fsling:resourceType=/resource/type/ > -F:name=name > http://admin:admin@localhost:8080/resource/type/create.json.POST.servlet > > But not with: > curl --referer http://localhost:8080 -Fsling:resourceType=/resource/type/ > -F:name=name http://admin:admin@localhost:8080/resource/type/create.json > > For the GET servlet I use: > @SlingServlet(methods = { "GET" }, resourceTypes = { "resource/type/" }, > extensions = { "json" }) > > And the curl : > curl http://admin:admin@localhost:8080/resource/type/name.json > returns me a JSON response with some properties but no mention of the > resource type, and it never enters the GET servlet. > > > Is there something I am mising? > > Thank you, > Samuel. > > _______________________________________________ > > oae-dev mailing list > oae-dev@collab.sakaiproject.org > http://collab.sakaiproject.org/mailman/listinfo/oae-dev > >
_______________________________________________ oae-dev mailing list oae-dev@collab.sakaiproject.org http://collab.sakaiproject.org/mailman/listinfo/oae-dev