Hi,

2011/8/23 Reto Bachmann-Gmür <[email protected]>:
> On Tue, Aug 23, 2011 at 2:56 PM, Carsten Ziegeler <[email protected]> 
> wrote:
>> The servlet resolution is based on the resource resolution - and this
>> means a path points at exactly one resource. This is nothing we should
>> change!
> I'm still not getting it. SlingServletResolver#getServlet iterates
> through the different matching servlets. What are this different
> candidates? Why is it OK to fall back to another kind of resource but
> not to a lower priority OptingServlet?

In general it is ok to fall back to another OptingServlet, but the
concept of Sling is: a path points to a single resource.
So if you want to use several opting servlets, they have to be at
different paths.

>
>> Again, OptingServlet should be the exception to be used as it makes
>> the servlet resolution much more complicated. You have to run the
>> request to see which servlet is really used. Therefore this should be
>> avoided whereever possible.We found out, that in most cases there are
>> better option.
> A better option for jax-rs resources would be to register a servlet
> for every root-resource, for this the path matching in sling would
> have to be as powerful as the one offered by jax-rs (i.e. support
> regex).
>
>> For the case at hand, you could register a single servlet at that path
>> - which is not an opting servlet and this one dispatches to the other
>> servlets, one after the other, until one is processing this request.
>
> Not sure if I understand you correctly, are you suggesting to just
> have a separate uri-space for jax-rs resources? (Clearly I would like
> a tighter integration for sling to support scripts, Java Sevlets and
> JAX-RS root resources at any path.)

If I understand you correctly, you with JAX-RS you want to have
several (Opting)Servlets at the same path (handling the same resource
type). So instead of directly registering all these servlets at the
same path, you register a special JAX-RS servlet at this path which
then delegates to all the various servlets.

Carsten
>
> Regards,
> Reto
>



-- 
Carsten Ziegeler
[email protected]

Reply via email to