I have five custom pipelines configured for html generator based on Apache Sling - Output Rewriting Pipelines (org.apache.sling.rewriter) . Is there a way for any running pipeline to remove events programmatically so that does not pass on the events for rest of remaining pipelines?
cc: justinediener justinp Jorg
Solved! Go to Solution.
I don't think you are using the terminology correctly. For a single request, only a single pipeline will be used, so there are no 'remaining' pipelines.
I suspect what you mean to ask if whether a component within a pipeline can remove events so that they are not passed to subsequent components within the pipeline. If so, the answer is yes. Just don't call the corresponding SAX method on the next component. acs-aem-commons/StylesheetInlinerTransformerFactory.java at master · Adobe-Consulting-Services/acs-a... is an example of such selective execution. When a <link> element is found inside the <head> element, it is effectively skipped until the the </head> element has been hit, at which point the stylesheet is inlined (before outputting </head>).
I don't think you are using the terminology correctly. For a single request, only a single pipeline will be used, so there are no 'remaining' pipelines.
I suspect what you mean to ask if whether a component within a pipeline can remove events so that they are not passed to subsequent components within the pipeline. If so, the answer is yes. Just don't call the corresponding SAX method on the next component. acs-aem-commons/StylesheetInlinerTransformerFactory.java at master · Adobe-Consulting-Services/acs-a... is an example of such selective execution. When a <link> element is found inside the <head> element, it is effectively skipped until the the </head> element has been hit, at which point the stylesheet is inlined (before outputting </head>).
Thanks for feedback justin_at_adobe & attempt to suspect the requirement. Also sorry the terminology was not correct. Thanks for StylesheetInliner sample, Sounds not meet my requirement & will look into it. Let me repharse with example for more clarity & is the solution proposed earlier will still work?
We have few transformer configured [1] like
The update is all links happening in the above order. I was looking on some business rule at 3(external-tab) not to proceed with other transformer like link-rewrite....
[1]
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
contentTypes="[text/html]"
enabled="{Boolean}true"
generatorType="htmlparser"
order="5"
serializerType="htmlwriter"
transformerTypes="[linkchecker,externalnofollow,external-tab,link-rewrite,mobile,mobiledebug]">
<transformer-mobile
jcr:primaryType="nt:unstructured"
component-optional="{Boolean}true"/>
<transformer-mobiledebug
jcr:primaryType="nt:unstructured"
component-optional="{Boolean}true"/>
</jcr:root>
Views
Replies
Total Likes
Ah, I see what you mean now. No, there's no standard approach to do this. If the transformers are all involved are under your control, however, you could accomplish this by sharing some state between the transformers, e.g. set some request attribute in external-tab and then have link-rewrite look at that request attribute to decide whether or not to do any rewriting.
Thanks justin_at_adobe . Unfortunately all transformer are not under my control & developed by different vendor making more challenge. But you gave me a great clue & should help us. Once again thanks a lot for timely help.
Views
Replies
Total Likes
Views
Likes
Replies