I'm not sure I totally understand what you're trying to do, but... why
not register the Servlet directly with the HttpService? Or maybe a Filter.

Out of curiosity... what do you mean by "the Client is driving the API"?

Justin

On 2/25/10 7:35 PM, Andreas Schaefer wrote:
> Well, I might be abusing Sling but what I want to do is to have sort of an 
> Entry Point / Guard Servlet before I actually call Sling or use sling to 
> store data into JCR.
> 
> The backend application only handles operation called by the client (Ext/JS 
> for now) with JSon (in and out). There is no presentation provided by the 
> Sling component.
> On the other hand the Client is driving the API and so the backend has adhere 
> to it and translate it to Sling API calls.
> 
> Therefore I want to close Sling using Authentication except when calling a 
> particular URL. The URL might contain a reference to a resource but the 
> effective resource might be located somewhere else and the Servlet would 
> translate that path back and forth.
> 
> Well, at least now I know why my Servlet gets called using "client.servlet" 
> because the rest of the URL becomes the suffix. But I am still not quite sure 
> why the servlet path adds '.sevlet' and is only accessible through that.
> 
> Thanks - Andy
> 
> On Feb 25, 2010, at 2:11 PM, Alexander Klimetschek wrote:
> 
>> On Thu, Feb 25, 2010 at 20:53, Andreas Schaefer <[email protected]> wrote:
>>> Still the servlet is not called using this:
>>>
>>>        curl -X POST http://localhost:8080/client/myTest
>>>
>>> but it works with this:
>>>
>>>        curl -X POST http://localhost:8080/client.servlet/myTest
>>>
>>> Does this mean that the a servlet path without '.servlet' suffix is only 
>>> handled when that particular path is entered? And with the '.servlet' 
>>> suffix any path after that is redirected to that servlet?
>>>
>>> Is there any way to tell Sling to redirect a sub path to a particular 
>>> servlet without the '.servlet' suffix??
>>
>> It very much depends on what part of the path exists as resource/node
>> already. Sling will use the longest matching and existing path as
>> resource and resolve servlets from there. See [1]. Then either a
>> servlet with a matching path will be used (sling.servlet.paths) or the
>> resource type (node type or sling:resourceType) will be used to locate
>> a servlet.
>>
>> I would recommend to use the latter variant as much as possible. Using
>> the resource type indirection gives you more flexibility: you can use
>> the same servlet for many resources and changing URLs is done by
>> changing content only, not modifying servlet code.
>>
>> [1] http://sling.apache.org/site/url-decomposition.html
>>
>> Regards,
>> Alex
>>
>> -- 
>> Alexander Klimetschek
>> [email protected]
> 

Reply via email to