You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "David G." <da...@gmail.com> on 2012/11/13 23:35:46 UTC

Resource output capture/modification

Is there any mechanism in Sling that would let me inspect/modify the
output a resource after it has been fully evaluated against its
renderer? Similar to the sling rewriter pipeline but a hook that
occurs after each resource include?

Likewise, is there any other documentation on the Sling rewriter
pipeline? Im not too familiar w all the SAX eventing and what
could/should (use cases) happen in Generators, Transformers and
Processors.

Re: Resource output capture/modification

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

Am 14.11.2012 um 02:16 schrieb David G.:

> Ian,
> 
> Correct - I want to trap the output of a sling:include.

You might want to implement a component level filter and wrap the response object.

Regards
Felix

> If i have a resource that sling:includes 5 other resources, I want to be able to "hook in" and have access to what each sling:include wrote to the response, and modify it if needed. Conceptually I'm imagining something like a Sling Filter at the Component level,  but on the exit of the inclusion, rather than the entrance.
> 
> And wrt to the Sling Rewriters - those are the Sling docs i was reading over and looked through the Sling src for example implementations.  
> 
> Ill take a look at the Cocoon docs as well - thanks for the links! 
> 
> -- 
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
> 
> 
> On Tuesday, November 13, 2012 at 6:40 PM, Ian Boston wrote:
> 
>> On 14 November 2012 09:35, David G. <davidjgonzalez@gmail.com (mailto:davidjgonzalez@gmail.com)> wrote:
>>> Is there any mechanism in Sling that would let me inspect/modify the
>>> output a resource after it has been fully evaluated against its
>>> renderer? Similar to the sling rewriter pipeline but a hook that
>>> occurs after each resource include?
>>> 
>> 
>> 
>> If by output of a resource you mean the response object, then IIRC you
>> can perform servlet request dispatch operations that will enable you
>> to process the output of an internal request. There are some helper
>> classes for wrapping requests. That will give you raw low level access
>> to the rendered response from a resource. Just ask for pointers if
>> that made no sense.
>> 
>>> 
>>> Likewise, is there any other documentation on the Sling rewriter
>>> pipeline? Im not too familiar w all the SAX eventing and what
>>> could/should (use cases) happen in Generators, Transformers and
>>> Processors.
>>> 
>> 
>> 
>> Does this help (sorry if youve read it) ?
>> http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html
>> 
>> or is it the Cocoon terminology you are after ?
>> (only for terminology)
>> http://cocoon.apache.org/2.1/userdocs/generators.html
>> http://cocoon.apache.org/2.1/userdocs/transformers.html
>> 
>> 
>> Ian 
> 


Re: Resource output capture/modification

Posted by "David G." <da...@gmail.com>.
Ian,

Correct - I want to trap the output of a sling:include. If i have a resource that sling:includes 5 other resources, I want to be able to "hook in" and have access to what each sling:include wrote to the response, and modify it if needed. Conceptually I'm imagining something like a Sling Filter at the Component level,  but on the exit of the inclusion, rather than the entrance.

And wrt to the Sling Rewriters - those are the Sling docs i was reading over and looked through the Sling src for example implementations.  

Ill take a look at the Cocoon docs as well - thanks for the links! 

-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Tuesday, November 13, 2012 at 6:40 PM, Ian Boston wrote:

> On 14 November 2012 09:35, David G. <davidjgonzalez@gmail.com (mailto:davidjgonzalez@gmail.com)> wrote:
> > Is there any mechanism in Sling that would let me inspect/modify the
> > output a resource after it has been fully evaluated against its
> > renderer? Similar to the sling rewriter pipeline but a hook that
> > occurs after each resource include?
> > 
> 
> 
> If by output of a resource you mean the response object, then IIRC you
> can perform servlet request dispatch operations that will enable you
> to process the output of an internal request. There are some helper
> classes for wrapping requests. That will give you raw low level access
> to the rendered response from a resource. Just ask for pointers if
> that made no sense.
> 
> > 
> > Likewise, is there any other documentation on the Sling rewriter
> > pipeline? Im not too familiar w all the SAX eventing and what
> > could/should (use cases) happen in Generators, Transformers and
> > Processors.
> > 
> 
> 
> Does this help (sorry if youve read it) ?
> http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html
> 
> or is it the Cocoon terminology you are after ?
> (only for terminology)
> http://cocoon.apache.org/2.1/userdocs/generators.html
> http://cocoon.apache.org/2.1/userdocs/transformers.html
> 
> 
> Ian 


Re: Resource output capture/modification

Posted by Ian Boston <ie...@tfd.co.uk>.
On 14 November 2012 09:35, David G. <da...@gmail.com> wrote:
> Is there any mechanism in Sling that would let me inspect/modify the
> output a resource after it has been fully evaluated against its
> renderer? Similar to the sling rewriter pipeline but a hook that
> occurs after each resource include?

If by output of a resource you mean the response object, then IIRC you
can perform servlet request dispatch operations that will enable you
to process the output of an internal request. There are some helper
classes for wrapping requests. That will give you raw low level access
to the rendered response from a resource. Just ask for pointers if
that made no sense.

>
> Likewise, is there any other documentation on the Sling rewriter
> pipeline? Im not too familiar w all the SAX eventing and what
> could/should (use cases) happen in Generators, Transformers and
> Processors.

Does this help (sorry if youve read it) ?
http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html

or is it the Cocoon terminology you are after ?
(only for terminology)
http://cocoon.apache.org/2.1/userdocs/generators.html
http://cocoon.apache.org/2.1/userdocs/transformers.html


Ian