You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Carl Hall <ca...@hallwaytech.com> on 2010/11/04 15:06:55 UTC

Filter JCR Content Selectively

I have UI static content files for client side rendering that lives in JCR
under /dev.  I'd like to filter this content a bit to replace message keys with
language specific text as this step is currently being done on the client by
javascript.  I'd prefer to not make these files into server side scripting
files.  What's the best way to have everything under /dev get passed through
a response filter/servlet?

Re: Filter JCR Content Selectively

Posted by Ian Boston <ie...@tfd.co.uk>.
Carl, we already do something very close to this in the HttpCacheFilter

We might also consider setting the resource type of these nodes and binding a different type of streaming servlet to them, although thats going to require quite a few properties. I dont think its possible to bind a Sling Servlet to the start of a path as opposed to a type.

Ian

On 4 Nov 2010, at 18:01, Felix Meschberger wrote:

> Hi,
> 
> I'd register a request-level filter which does the filtering when one of
> the to-be-filtered resources is requested and just does nothing if not.
> 
> This test is probably as simple as:
> 
>  if (match(slingRequest.getResource())) {
>      response = createFilteringResponse(response);
>   }
>   chain.doFilter(request, response);
> 
> Regards
> Felix
> 
> Am Donnerstag, den 04.11.2010, 10:06 -0400 schrieb Carl Hall: 
>> I have UI static content files for client side rendering that lives in JCR
>> under /dev.  I'd like to filter this content a bit to replace message keys with
>> language specific text as this step is currently being done on the client by
>> javascript.  I'd prefer to not make these files into server side scripting
>> files.  What's the best way to have everything under /dev get passed through
>> a response filter/servlet?
> 
> 


Re: Filter JCR Content Selectively

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

I'd register a request-level filter which does the filtering when one of
the to-be-filtered resources is requested and just does nothing if not.

This test is probably as simple as:

  if (match(slingRequest.getResource())) {
      response = createFilteringResponse(response);
   }
   chain.doFilter(request, response);

Regards
Felix

Am Donnerstag, den 04.11.2010, 10:06 -0400 schrieb Carl Hall: 
> I have UI static content files for client side rendering that lives in JCR
> under /dev.  I'd like to filter this content a bit to replace message keys with
> language specific text as this step is currently being done on the client by
> javascript.  I'd prefer to not make these files into server side scripting
> files.  What's the best way to have everything under /dev get passed through
> a response filter/servlet?