You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by connuser1 connuser1 <co...@gmail.com> on 2013/05/06 08:29:30 UTC

Unable to enforce pattern in sling filter

Hi

I have written a sling filter and its working fine in capturing that
requests but its doing so for all the requests. I want it to become
applicable only for a specified path like below:

@Property(name = "pattern", value = "/mynode.json")

But still its coming into play for all requests. I am attaching the
complete source code of the filter for reference. Please help.

Re: Unable to enforce pattern in sling filter

Posted by Sarwar Bhuiyan <sa...@gmail.com>.
Or use the other the normal Filter with the HTTP Service whiteboard instead
of SlingFilter:

Filter service properties:

   - pattern - Regular expression pattern to register filter with.
   - contextId - Id of context to register with.
   - service.ranking - Where in the chain this filter should be placed.
   - init.\* - Filter initialization values.


http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#using-the-httpservice


Sarwar


On Mon, May 6, 2013 at 7:32 AM, Felix Meschberger <fm...@adobe.com>wrote:

> Hi
>
> Sling filters are always called. There is no pattern filtering. If you
> want a filter to only do work on certain requests, the filter should to
> that itself.
>
> Regards
> Felix
>
> Am 06.05.2013 um 08:29 schrieb connuser1 connuser1:
>
> > Hi
> >
> > I have written a sling filter and its working fine in capturing that
> requests but its doing so for all the requests. I want it to become
> applicable only for a specified path like below:
> >
> > @Property(name = "pattern", value = "/mynode.json")
> >
> > But still its coming into play for all requests. I am attaching the
> complete source code of the filter for reference. Please help.
> >
> >
>
>

Re: Unable to enforce pattern in sling filter

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Sling filters are always called. There is no pattern filtering. If you want a filter to only do work on certain requests, the filter should to that itself.

Regards
Felix

Am 06.05.2013 um 08:29 schrieb connuser1 connuser1:

> Hi
> 
> I have written a sling filter and its working fine in capturing that requests but its doing so for all the requests. I want it to become applicable only for a specified path like below:
> 
> @Property(name = "pattern", value = "/mynode.json")
> 
> But still its coming into play for all requests. I am attaching the complete source code of the filter for reference. Please help.
> 
>