You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Vidar Ramdal <vi...@idium.no> on 2009/07/30 18:08:18 UTC
Servlet registration: sling.servlet.extensions ignored with default
resource type
What is the intended behavior for a servlet that is registered as follows:
* @scr.property name="sling.servlet.extensions" value="html"
* @scr.property name="sling.servlet.resourceTypes"
value="sling/servlet/default"
* @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
It seems that "sling.servlet.extensions" is ignored, so that this
servlet will respond to any extension, if there is no better match.
>From the docs [1] and [2] it is a little unclear what is supposed to
happen, so it might not be a bug, but it still seems strange.
[1] http://cwiki.apache.org/confluence/display/SLING/URL+to+Script+Resolution
[2] http://sling.apache.org/site/servlet-resolution.html
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Carsten Ziegeler <cz...@apache.org>.
Alexander Klimetschek wrote:
> On Mon, Aug 3, 2009 at 5:04 PM, Carsten Ziegeler<cz...@apache.org> wrote:
>> We follow the DS spec and therefore do not read the annotations at
>> runtime. They're read by the SCR plugin during build time (again with
>> QDox)
>
> I thought one of the main reasons for Java annotations was to support
> classes loaded from the repository. But this use case is still not
> supported, IIUC?
>
Hmm, I don't know of this use case :) The reason for annotations was
...well..to use annotations in the source code and have IDE support.
Loading services from the repository can be done of course (though I
would not suggest to do it), but that would definitly leave the OSGi DS
spec and be a proprietary stuff.
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Aug 3, 2009 at 5:04 PM, Carsten Ziegeler<cz...@apache.org> wrote:
> We follow the DS spec and therefore do not read the annotations at
> runtime. They're read by the SCR plugin during build time (again with
> QDox)
I thought one of the main reasons for Java annotations was to support
classes loaded from the repository. But this use case is still not
supported, IIUC?
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Carsten Ziegeler <cz...@apache.org>.
Alexander Klimetschek wrote:
> On Fri, Jul 31, 2009 at 11:06 AM, Vidar Ramdal<vi...@idium.no> wrote:
>> No, I used only the old-fashioned Javadoc method, but should that make
>> a difference?
>
> You are right, it should not make a difference, but the bug could only
> be in the QDox based way. With QDox, the properties are read from the
> java sources at build time and are put into the
> OSGI-INF/serviceComponents.xml file inside the bundle, which will be
> picked up by SCR when it is installed. With Java annotations the
> interpretation of the SCR annotation is done whenever the class is
> loaded (IIUC), so it's slightly different (and allows for any loaded
> class to be a service, eg. also ones where the source is in the JCR).
>
No, this is not the case with the SCR annotations. :)
We follow the DS spec and therefore do not read the annotations at
runtime. They're read by the SCR plugin during build time (again with
QDox) - as both Javadoc tags and annotations provide the same
functionality and use the same code underneath there shouldn't be any
difference. If so, this could be a bug :)
Regards
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
>> On Fri, Jul 31, 2009 at 11:06 AM, Vidar Ramdal<vi...@idium.no> wrote:
>>> Also, I see that if I drop the "sling.servlet.extensions" property,
>>> the servlet seems to be registered as expected:
>>> * @scr.property name="sling.servlet.extensions" value="html"
>>> * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
> 2009/7/31 Alexander Klimetschek <ak...@day.com>:
>> I guess you mean if you drop the "sling.servlet.methods" property.
2009/7/31 Vidar Ramdal <vi...@idium.no>:
> Yes, you're right. Sorry :)
>
>> That makes sense, as it then would be registered for GET only and
>> that's the only method for which extensions are currently supported
>> (well, also HEAD afaik).
>
>>> But with "sling.servlet.extensions" set to the array of GET and POST,
>>> the servlet responds to requests without the extension:
>>> * @scr.property name="sling.servlet.extensions" value="html"
>>> * @scr.property name="sling.servlet.resourceTypes"
>>> value="sling/servlet/default"
>>> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>>>
>>> This seems like a bug to me. I'll file a JIRA for it, if nobody
>>> believes behavior this is intentional.
>>
>> No, extensions should be supported for all methods (because I think
>> that is more intuitive), but currently they are only supported for
>> GET.
>
> Agree.
>
>> What happens if you only set GET on sling.servlet.methods? It might be
>> the case that the extension is completely ignored for all methods if
>> you specify sling.servlet.methods with GET *and* POST. Or did you only
>> see extensions being ignored for POST (which would be as expected)?
>
> Even with only GET, the servlet responds to all extensions.
>
> So now I register the servlet with:
> * @scr.property name="sling.servlet.extensions" value="html"
> * @scr.property name="sling.servlet.resourceTypes"
> value="sling/servlet/default"
> * @scr.property name="sling.servlet.methods" value="GET"
>
> But still, the servlet responds to requests where I believe it
> shouldn't, e.g. GET /node.json.
> When I disable the rogue servlet, /node.json returns the expected JSON
> rendering.
>
> I'll file a JIRA for this for now, and debug it more over the weekend.
https://issues.apache.org/jira/browse/SLING-1069
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
2009/7/31 Alexander Klimetschek <ak...@day.com>:
> On Fri, Jul 31, 2009 at 11:06 AM, Vidar Ramdal<vi...@idium.no> wrote:
>> Also, I see that if I drop the "sling.servlet.extensions" property,
>> the servlet seems to be registered as expected:
>> * @scr.property name="sling.servlet.extensions" value="html"
>> * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
>
> I guess you mean if you drop the "sling.servlet.methods" property.
Yes, you're right. Sorry :)
> That makes sense, as it then would be registered for GET only and
> that's the only method for which extensions are currently supported
> (well, also HEAD afaik).
>> But with "sling.servlet.extensions" set to the array of GET and POST,
>> the servlet responds to requests without the extension:
>> * @scr.property name="sling.servlet.extensions" value="html"
>> * @scr.property name="sling.servlet.resourceTypes"
>> value="sling/servlet/default"
>> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>>
>> This seems like a bug to me. I'll file a JIRA for it, if nobody
>> believes behavior this is intentional.
>
> No, extensions should be supported for all methods (because I think
> that is more intuitive), but currently they are only supported for
> GET.
Agree.
> What happens if you only set GET on sling.servlet.methods? It might be
> the case that the extension is completely ignored for all methods if
> you specify sling.servlet.methods with GET *and* POST. Or did you only
> see extensions being ignored for POST (which would be as expected)?
Even with only GET, the servlet responds to all extensions.
So now I register the servlet with:
* @scr.property name="sling.servlet.extensions" value="html"
* @scr.property name="sling.servlet.resourceTypes"
value="sling/servlet/default"
* @scr.property name="sling.servlet.methods" value="GET"
But still, the servlet responds to requests where I believe it
shouldn't, e.g. GET /node.json.
When I disable the rogue servlet, /node.json returns the expected JSON
rendering.
I'll file a JIRA for this for now, and debug it more over the weekend.
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Jul 31, 2009 at 11:06 AM, Vidar Ramdal<vi...@idium.no> wrote:
> No, I used only the old-fashioned Javadoc method, but should that make
> a difference?
You are right, it should not make a difference, but the bug could only
be in the QDox based way. With QDox, the properties are read from the
java sources at build time and are put into the
OSGI-INF/serviceComponents.xml file inside the bundle, which will be
picked up by SCR when it is installed. With Java annotations the
interpretation of the SCR annotation is done whenever the class is
loaded (IIUC), so it's slightly different (and allows for any loaded
class to be a service, eg. also ones where the source is in the JCR).
> Also, I see that if I drop the "sling.servlet.extensions" property,
> the servlet seems to be registered as expected:
> * @scr.property name="sling.servlet.extensions" value="html"
> * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
I guess you mean if you drop the "sling.servlet.methods" property.
That makes sense, as it then would be registered for GET only and
that's the only method for which extensions are currently supported
(well, also HEAD afaik).
> But with "sling.servlet.extensions" set to the array of GET and POST,
> the servlet responds to requests without the extension:
> * @scr.property name="sling.servlet.extensions" value="html"
> * @scr.property name="sling.servlet.resourceTypes"
> value="sling/servlet/default"
> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>
> This seems like a bug to me. I'll file a JIRA for it, if nobody
> believes behavior this is intentional.
No, extensions should be supported for all methods (because I think
that is more intuitive), but currently they are only supported for
GET.
What happens if you only set GET on sling.servlet.methods? It might be
the case that the extension is completely ignored for all methods if
you specify sling.servlet.methods with GET *and* POST. Or did you only
see extensions being ignored for POST (which would be as expected)?
See SLING-892 [1] for the enhancement request to support extensions
for all methods.
[1] https://issues.apache.org/jira/browse/SLING-892
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
> On Thu, Jul 30, 2009 at 6:09 PM, Vidar Ramdal <vi...@idium.no> wrote:
>
>> What is the intended behavior for a servlet that is registered as follows:
>> * @scr.property name="sling.servlet.extensions" value="html"
>> * @scr.property name="sling.servlet.resourceTypes"
>> value="sling/servlet/default"
>> * @scr.property name="sling.servlet.methods" values.0="GET"
>> values.1="POST"
>>
>> It seems that "sling.servlet.extensions" is ignored, so that this
>> servlet will respond to any extension, if there is no better match.
>> From the docs [1] and [2] it is a little unclear what is supposed to
>> happen, so it might not be a bug, but it still seems strange.
2009/7/31 Dominik Süß <do...@gmail.com>:
> did you give the Javaannotations a try (@SlingServlet [1]), we currently
> only work with those instead of QDox and if I remember right I've seen a
> testcomponent with the selectors which worked. The SlingServlet annotation
> can be found in the felix scr annotations.
No, I used only the old-fashioned Javadoc method, but should that make
a difference?
Also, I see that if I drop the "sling.servlet.extensions" property,
the servlet seems to be registered as expected:
* @scr.property name="sling.servlet.extensions" value="html"
* @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
But with "sling.servlet.extensions" set to the array of GET and POST,
the servlet responds to requests without the extension:
* @scr.property name="sling.servlet.extensions" value="html"
* @scr.property name="sling.servlet.resourceTypes"
value="sling/servlet/default"
* @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
This seems like a bug to me. I'll file a JIRA for it, if nobody
believes behavior this is intentional.
> [1] https://issues.apache.org/jira/browse/SLING-902
>> [1] http://cwiki.apache.org/confluence/display/SLING/URL+to+Script+Resolution
>> [2] http://sling.apache.org/site/servlet-resolution.html
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Dominik Süß <do...@gmail.com>.
Hi Vidar,
did you give the Javaannotations a try (@SlingServlet [1]), we currently
only work with those instead of QDox and if I remember right I've seen a
testcomponent with the selectors which worked. The SlingServlet annotation
can be found in the felix scr annotations.
Best regards,
Dominik
[1] https://issues.apache.org/jira/browse/SLING-902
On Thu, Jul 30, 2009 at 6:09 PM, Vidar Ramdal <vi...@idium.no> wrote:
> What is the intended behavior for a servlet that is registered as follows:
> * @scr.property name="sling.servlet.extensions" value="html"
> * @scr.property name="sling.servlet.resourceTypes"
> value="sling/servlet/default"
> * @scr.property name="sling.servlet.methods" values.0="GET"
> values.1="POST"
>
> It seems that "sling.servlet.extensions" is ignored, so that this
> servlet will respond to any extension, if there is no better match.
> From the docs [1] and [2] it is a little unclear what is supposed to
> happen, so it might not be a bug, but it still seems strange.
>
> [1]
> http://cwiki.apache.org/confluence/display/SLING/URL+to+Script+Resolution
> [2] http://sling.apache.org/site/servlet-resolution.html
>
>
> --
> Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
> Akersgata 16, N-0158 Oslo, Norway
> +47 21 531941, ext 2070
>
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Dominik Süß <do...@gmail.com>.
Ok, I ran into that just some minutes ago, so
+1 for fix ;)
On Tue, Aug 4, 2009 at 10:31 AM, Vidar Ramdal <vi...@idium.no> wrote:
> 2009/8/4 Carsten Ziegeler <cz...@apache.org>:
> > Bertrand Delacretaz wrote:
> >> On Tue, Aug 4, 2009 at 10:08 AM, Carsten Ziegeler<cz...@apache.org>
> wrote:
> >>> Bertrand Delacretaz wrote:
> >>>> ...if a servlet is registered with
> >>>> sling.servlet.extensions = html, it should not process any request
> >>>> that doesn't have an html extension.
> >>>>
> >>> Hmm not sure :) I guess this boils down to the question if the
> properties
> >>> are applied using "or" or "and" logic. Atm it's "or" (at least this is
> >>> my understanding of the code...) :)
> >>
> >> I don't see a use case for an OR between extensions and anything else,
> >> to me it seems much more intuitive to use the extensions property to
> >> limit the range of requests that a servlet handles.
> >>
> > Yes, maybe you're right - but nevertheless it's the way it has been
> > for the past releases and people might rely on this behaviour.
>
> Looking at SLING-512 [1], where similar symptoms are described.
> SLING-512 was fixed, but at some point ServletResourceProviderFactory
> has been rewritten, and the bug was reintroduced.
> So I guess I'd say fixing the current issue is in fact keeping
> backwards compatibility - we're just going a bit further 'back' :)
>
> I'm attaching a proposed patch to SLING-1069 [2] - please have a look,
> and preferably test it. As Carsten says, this has potential to break a
> lot of stuff.
>
> [1] https://issues.apache.org/jira/browse/SLING-512
> [2] https://issues.apache.org/jira/browse/SLING-1069/
>
> --
> Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
> Akersgata 16, N-0158 Oslo, Norway
> +47 21 531941, ext 2070
>
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
2009/8/4 Carsten Ziegeler <cz...@apache.org>:
> Bertrand Delacretaz wrote:
>> On Tue, Aug 4, 2009 at 10:08 AM, Carsten Ziegeler<cz...@apache.org> wrote:
>>> Bertrand Delacretaz wrote:
>>>> ...if a servlet is registered with
>>>> sling.servlet.extensions = html, it should not process any request
>>>> that doesn't have an html extension.
>>>>
>>> Hmm not sure :) I guess this boils down to the question if the properties
>>> are applied using "or" or "and" logic. Atm it's "or" (at least this is
>>> my understanding of the code...) :)
>>
>> I don't see a use case for an OR between extensions and anything else,
>> to me it seems much more intuitive to use the extensions property to
>> limit the range of requests that a servlet handles.
>>
> Yes, maybe you're right - but nevertheless it's the way it has been
> for the past releases and people might rely on this behaviour.
Looking at SLING-512 [1], where similar symptoms are described.
SLING-512 was fixed, but at some point ServletResourceProviderFactory
has been rewritten, and the bug was reintroduced.
So I guess I'd say fixing the current issue is in fact keeping
backwards compatibility - we're just going a bit further 'back' :)
I'm attaching a proposed patch to SLING-1069 [2] - please have a look,
and preferably test it. As Carsten says, this has potential to break a
lot of stuff.
[1] https://issues.apache.org/jira/browse/SLING-512
[2] https://issues.apache.org/jira/browse/SLING-1069/
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> On Tue, Aug 4, 2009 at 10:08 AM, Carsten Ziegeler<cz...@apache.org> wrote:
>> Bertrand Delacretaz wrote:
>>> ...if a servlet is registered with
>>> sling.servlet.extensions = html, it should not process any request
>>> that doesn't have an html extension.
>>>
>> Hmm not sure :) I guess this boils down to the question if the properties
>> are applied using "or" or "and" logic. Atm it's "or" (at least this is
>> my understanding of the code...) :)
>
> I don't see a use case for an OR between extensions and anything else,
> to me it seems much more intuitive to use the extensions property to
> limit the range of requests that a servlet handles.
>
Yes, maybe you're right - but nevertheless it's the way it has been
for the past releases and people might rely on this behaviour.
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Aug 4, 2009 at 10:08 AM, Carsten Ziegeler<cz...@apache.org> wrote:
> Bertrand Delacretaz wrote:
>> ...if a servlet is registered with
>> sling.servlet.extensions = html, it should not process any request
>> that doesn't have an html extension.
>>
> Hmm not sure :) I guess this boils down to the question if the properties
> are applied using "or" or "and" logic. Atm it's "or" (at least this is
> my understanding of the code...) :)
I don't see a use case for an OR between extensions and anything else,
to me it seems much more intuitive to use the extensions property to
limit the range of requests that a servlet handles.
-Bertrand
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> On Tue, Aug 4, 2009 at 9:23 AM, Vidar Ramdal<vi...@idium.no> wrote:
>> 2009/7/30 Vidar Ramdal <vi...@idium.no>:
>>> What is the intended behavior for a servlet that is registered as follows:
>>> * @scr.property name="sling.servlet.extensions" value="html"
> ...
>>> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>
>> ...I would expect the servlet to be
>> registered as something like
>> /apps/sling/servlet/default/GET.html.servlet (or just
>> /apps/sling/servlet/default/html.servlet, since GET is somewhat
>> implied).
>> But I'm not sure. Can we have a ruling, please?
>
> I agree with you - if a servlet is registered with
> sling.servlet.extensions = html, it should not process any request
> that doesn't have an html extension.
>
Hmm not sure :) I guess this boils down to the question if the properties
are applied using "or" or "and" logic. Atm it's "or" (at least this is
my understanding of the code...) :)
Changing this might create compatibility problems (not sure though).
Carsten
--
Carsten Ziegeler
cziegeler@apache.org
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Aug 4, 2009 at 9:23 AM, Vidar Ramdal<vi...@idium.no> wrote:
> 2009/7/30 Vidar Ramdal <vi...@idium.no>:
>> What is the intended behavior for a servlet that is registered as follows:
>> * @scr.property name="sling.servlet.extensions" value="html"
...
>> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
> ...I would expect the servlet to be
> registered as something like
> /apps/sling/servlet/default/GET.html.servlet (or just
> /apps/sling/servlet/default/html.servlet, since GET is somewhat
> implied).
> But I'm not sure. Can we have a ruling, please?
I agree with you - if a servlet is registered with
sling.servlet.extensions = html, it should not process any request
that doesn't have an html extension.
-Bertrand
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
2009/8/4 Vidar Ramdal <vi...@idium.no>:
> 2009/7/30 Vidar Ramdal <vi...@idium.no>:
>> What is the intended behavior for a servlet that is registered as follows:
>> * @scr.property name="sling.servlet.extensions" value="html"
>> * @scr.property name="sling.servlet.resourceTypes"
>> value="sling/servlet/default"
>> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>>
>> It seems that "sling.servlet.extensions" is ignored, so that this
>> servlet will respond to any extension, if there is no better match.
>> From the docs [1] and [2] it is a little unclear what is supposed to
>> happen, so it might not be a bug, but it still seems strange.
>
> OK, here's what happens:
> When the servlet is picked up by
> o.a.s.servlets.resolver.internal.resource.ServletResourceProviderFactory,
> it is registered under two paths:
> /apps/sling/servlet/default/GET.servlet and
> /apps/sling/servlet/default/html.servlet.
>
> This is because the for loop in the addByType method (line 274), which
> loops over selectors first. It then adds paths for each extension and
> each method.
>
> This does not seem intuitive to me, I would expect the servlet to be
> registered as something like
> /apps/sling/servlet/default/GET.html.servlet (or just
> /apps/sling/servlet/default/html.servlet, since GET is somewhat
> implied).
> But I'm not sure. Can we have a ruling, please?
Btw, this looks exactly like the symptoms described in SLING-512 [1],
which is marked fixed.
[1] https://issues.apache.org/jira/browse/SLING-512
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Re: Servlet registration: sling.servlet.extensions ignored with
default resource type
Posted by Vidar Ramdal <vi...@idium.no>.
2009/7/30 Vidar Ramdal <vi...@idium.no>:
> What is the intended behavior for a servlet that is registered as follows:
> * @scr.property name="sling.servlet.extensions" value="html"
> * @scr.property name="sling.servlet.resourceTypes"
> value="sling/servlet/default"
> * @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
>
> It seems that "sling.servlet.extensions" is ignored, so that this
> servlet will respond to any extension, if there is no better match.
> From the docs [1] and [2] it is a little unclear what is supposed to
> happen, so it might not be a bug, but it still seems strange.
OK, here's what happens:
When the servlet is picked up by
o.a.s.servlets.resolver.internal.resource.ServletResourceProviderFactory,
it is registered under two paths:
/apps/sling/servlet/default/GET.servlet and
/apps/sling/servlet/default/html.servlet.
This is because the for loop in the addByType method (line 274), which
loops over selectors first. It then adds paths for each extension and
each method.
This does not seem intuitive to me, I would expect the servlet to be
registered as something like
/apps/sling/servlet/default/GET.html.servlet (or just
/apps/sling/servlet/default/html.servlet, since GET is somewhat
implied).
But I'm not sure. Can we have a ruling, please?
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070
Servlet registration: sling.servlet.extensions ignored with default
resource type
Posted by Vidar Ramdal <vi...@idium.no>.
What is the intended behavior for a servlet that is registered as follows:
* @scr.property name="sling.servlet.extensions" value="html"
* @scr.property name="sling.servlet.resourceTypes"
value="sling/servlet/default"
* @scr.property name="sling.servlet.methods" values.0="GET" values.1="POST"
It seems that "sling.servlet.extensions" is ignored, so that this
servlet will respond to any extension, if there is no better match.
>From the docs [1] and [2] it is a little unclear what is supposed to
happen, so it might not be a bug, but it still seems strange.
[1] http://cwiki.apache.org/confluence/display/SLING/URL+to+Script+Resolution
[2] http://sling.apache.org/site/servlet-resolution.html
--
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway
+47 21 531941, ext 2070