downloadsha3by / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
0 stars 0 forks source link

WiQueryDecoratingHeaderResponse does not use getRealResponse() in onAllCollectionsRendered (Line 113) #234

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using any IHeaderResponseDecorator in Application.setHeaderResponseDecorator.
2. wiequery-core will set a WiQueryDecoratingHeaderResponse itself.
3. Our own IHeaderResponseDecorator will be ignored.

What is the expected output? What do you see instead?

Example: Setting a JavaScriptFilteredIntoFooterHeaderResponse to write all 
JavaScript-Statements in the FooterBucket

    setHeaderResponseDecorator(new IHeaderResponseDecorator() {
            @Override
            public IHeaderResponse decorate(final IHeaderResponse response) {
                return new JavaScriptFilteredIntoFooterHeaderResponse(response, AbstractBasePage.FOOTER_BUCKET);
            }
        });

Expected Output: JavaScript-Statements in the resulting HTML-Page are written 
into the FooterBucket.

Seen OutPut: JavaScript-Statements are written to the HTML-Header, beacause 
WiQueryDecoratingHeaderResponse  uses not the inherited realResponse 
(IHeaderResponse).

109 @Override
110 protected void onAllCollectionsRendered(
111         List<ResourceReferenceAndStringData> allTopLevelReferences)
112 {
113     jsq.renderHead(this, getActiveRequestHandler());
114     jsq = new JsQuery();
115
116     super.onAllCollectionsRendered(allTopLevelReferences);
117 }

What version of the product are you using? On what operating system?

1.5.3

Patch:
109 @Override
110 protected void onAllCollectionsRendered(
111         List<ResourceReferenceAndStringData> allTopLevelReferences)
112 {
113     jsq.renderHead(getRealResponse(), getActiveRequestHandler());
114     jsq = new JsQuery();
115
116     super.onAllCollectionsRendered(allTopLevelReferences);
117 }

Original issue reported on code.google.com by schindle...@gmail.com on 17 Feb 2012 at 10:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Please also consider not to set WiQueryDecoratingHeaderResponse in 
WiQueryCoreInitializer by default. This prevents real decoration in 
"Application.setHeaderResponseDecorator", like:

... extends Application { 
 ...
 setHeaderResponseDecorator(new IHeaderResponseDecorator() {
  @Override
  public IHeaderResponse decorate(final IHeaderResponse response) {
   new WiQueryDecoratingHeaderResponse(new JavaScriptFilteredIntoFooterHeaderResponse(response, "FOOTER_BUCKET"))
  }
 });
...

Original comment by Michael....@gmail.com on 17 Feb 2012 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by hielke.hoeve on 29 Mar 2012 at 8:09

GoogleCodeExporter commented 9 years ago
First item: fixed.
Second item: you can set a custom headerreponse in Application#validateInit().

Original comment by hielke.hoeve on 29 Mar 2012 at 8:18