Closed buuhuu closed 9 months ago
Merging #2604 (ceff4a1) into main (aaa5fbe) will increase coverage by
0.00%
. The diff coverage is100.00%
.:exclamation: Current head ceff4a1 differs from pull request most recent head c745a00. Consider uploading reports for the commit c745a00 to get more accurate results
@@ Coverage Diff @@
## main #2604 +/- ##
=========================================
Coverage 87.34% 87.34%
Complexity 2648 2648
=========================================
Files 232 232
Lines 7078 7080 +2
Branches 1073 1073
=========================================
+ Hits 6182 6184 +2
Misses 359 359
Partials 537 537
Files | Coverage Δ | |
---|---|---|
...ponents/internal/servlets/CharResponseWrapper.java | 100.00% <100.00%> (ø) |
:mega: Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
With the TOC Filter enabled the resourceType condition evaluation for the Sling Rewriter Pipeline configuration is not applied on the usual resource anymore: https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter.html#configuring-a-processor
Usually (without the TOC Filter) the following happens:
The
/libs/cq/Page/Page.jsp
includes thejcr:content
child transparently without writing anything to the response, hence not callingHttpServletResponse#getWriter()
. Themyapp/components/pagE
or any of its super types contains usually the first script that writes to the response, hence callsHttpServletResponse#getWriter()
which initialises the Sling Rewriter processing as a side-effect with thejcr:content
resource and it in particular itsresourceType
as context: https://github.com/apache/sling-org-apache-sling-rewriter/blob/master/src/main/java/org/apache/sling/rewriter/impl/RewriterResponse.java#L89-L119With the TOC Filter enabled, the response is wrapped and its writer replaced with some in-memory buffering writer. The content of the buffer is than processed and written to the original writer after calling
HttpServletResponse#getWriter()
. That works functionally, however, asHttpServletResponse#getWriter()
is called after the page was rendered the response's upstreamgetWriter()
is only called now, initialising the Sling Rewriter processor in the context of the cq:Page instead of thejcr:content
.To see this in action, check the /system/console/request for the same page with the filter enabled/disabled and look for
LOG Found processor for post processing ProcessorConfiguration
, it should appear right after the include of the jcr:content resource's main rendering script. With the TOC Filter enabled, it appears at the end of the whole rendering.With this PR the upstream
getWriter()
is called at the time theCharResponseWrapper#getWriter()
is invoked. This triggers the side-effect to initialise the Sling Rewriter processor at the right time.