You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by "Georg Kallidis (JIRA)" <ji...@apache.org> on 2011/09/08 12:13:09 UTC

[jira] [Created] (TRB-85) Nested Templates output reversed

Nested Templates output reversed
--------------------------------

                 Key: TRB-85
                 URL: https://issues.apache.org/jira/browse/TRB-85
             Project: Turbine
          Issue Type: Bug
          Components: Core
    Affects Versions: Core 4.0-M1
         Environment: Windows XP, 
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
Tomcat 6.0.18_03
            Reporter: Georg Kallidis


Using (nested) calls in screen template the output (of the templates) seems to be reversed, i.e. the latest called templates are outputted first (lifo). 
This may be due to that org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String) is implemented such, that each invocation creates a new instance of a java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, String), which velocity then is writing to. May be the exact reason should be investigated in more detail. No test is available at the moment.

This could be solved by providing a concurrent safe instance variable of OutputStreamWriter to be used in this method (handleRequest).

Cft. http://mail-archives.apache.org/mod_mbox/turbine-dev/201109.mbox/%3C4E67C58C.5020804@apache.org%3E

A patch could be attached later ..

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (TRB-85) Nested Templates output reversed

Posted by "Thomas Vandahl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TRB-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Vandahl reassigned TRB-85:
---------------------------------

    Assignee: Thomas Vandahl
    
> Nested Templates output reversed
> --------------------------------
>
>                 Key: TRB-85
>                 URL: https://issues.apache.org/jira/browse/TRB-85
>             Project: Turbine
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Core 4.0-M1
>         Environment: Windows XP, 
> java version "1.6.0_13"
> Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
> Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
> Tomcat 6.0.18_03
>            Reporter: Georg Kallidis
>            Assignee: Thomas Vandahl
>         Attachments: TurbineVelocityServices.patch
>
>
> Using (nested) calls in screen template the output (of the templates) seems to be reversed, i.e. the latest called templates are outputted first (lifo). 
> This may be due to that org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String) is implemented such, that each invocation creates a new instance of a java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, String), which velocity then is writing to. May be the exact reason should be investigated in more detail. No test is available at the moment.
> This could be solved by providing a concurrent safe instance variable of OutputStreamWriter to be used in this method (handleRequest).
> Cft. http://mail-archives.apache.org/mod_mbox/turbine-dev/201109.mbox/%3C4E67C58C.5020804@apache.org%3E
> A patch could be attached later ..

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (TRB-85) Nested Templates output reversed

Posted by "Georg Kallidis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TRB-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Georg Kallidis updated TRB-85:
------------------------------

    Attachment: TurbineVelocityServices.patch

patche for current bug. patched method is only the method org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String, OutputStream). Another method (org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String)) uses a local writer object.

> Nested Templates output reversed
> --------------------------------
>
>                 Key: TRB-85
>                 URL: https://issues.apache.org/jira/browse/TRB-85
>             Project: Turbine
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Core 4.0-M1
>         Environment: Windows XP, 
> java version "1.6.0_13"
> Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
> Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
> Tomcat 6.0.18_03
>            Reporter: Georg Kallidis
>         Attachments: TurbineVelocityServices.patch
>
>
> Using (nested) calls in screen template the output (of the templates) seems to be reversed, i.e. the latest called templates are outputted first (lifo). 
> This may be due to that org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String) is implemented such, that each invocation creates a new instance of a java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, String), which velocity then is writing to. May be the exact reason should be investigated in more detail. No test is available at the moment.
> This could be solved by providing a concurrent safe instance variable of OutputStreamWriter to be used in this method (handleRequest).
> Cft. http://mail-archives.apache.org/mod_mbox/turbine-dev/201109.mbox/%3C4E67C58C.5020804@apache.org%3E
> A patch could be attached later ..

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TRB-85) Nested Templates output reversed

Posted by "Georg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TRB-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263727#comment-13263727 ] 

Georg commented on TRB-85:
--------------------------

doing more tests and debugging it seems that it is sufficient instead to add a counter to handle buffering.

As I am using the old jetspeed 1.6 framework, which is on top of turbine framework this seems not necessary otherwise.

Changes are in class org.apache.turbine.services.velocity.TurbineVelocityService

add class variable intCount = 0;.

in executeRequest(Context, String, Writer)
intCount++;
Velocity.mergeTemplate(filename, encoding, context, writer);
intCount--;

Then check in the flush condition in in handleRequest(Context, String, OutputStream):

if (intCount == 0 && writer != null)
// flush

This seems not to be very elegant, but at least the templates are all rendered in the right order.

                
> Nested Templates output reversed
> --------------------------------
>
>                 Key: TRB-85
>                 URL: https://issues.apache.org/jira/browse/TRB-85
>             Project: Turbine
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Core 4.0-M1
>         Environment: Windows XP, 
> java version "1.6.0_13"
> Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
> Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
> Tomcat 6.0.18_03
>            Reporter: Georg Kallidis
>         Attachments: TurbineVelocityServices.patch
>
>
> Using (nested) calls in screen template the output (of the templates) seems to be reversed, i.e. the latest called templates are outputted first (lifo). 
> This may be due to that org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String) is implemented such, that each invocation creates a new instance of a java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, String), which velocity then is writing to. May be the exact reason should be investigated in more detail. No test is available at the moment.
> This could be solved by providing a concurrent safe instance variable of OutputStreamWriter to be used in this method (handleRequest).
> Cft. http://mail-archives.apache.org/mod_mbox/turbine-dev/201109.mbox/%3C4E67C58C.5020804@apache.org%3E
> A patch could be attached later ..

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TRB-85) Nested Templates output reversed

Posted by "Georg Kallidis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TRB-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416923#comment-13416923 ] 

Georg Kallidis commented on TRB-85:
-----------------------------------

Update to my last comment: the code snippet does (with synchronization), what expected, but as the inherent capabilities of Turbine are sufficient, I prefer using them. By using again the deprecated (in Turbine 4.0) methods org.apache.turbine.util.RunData.getOut() instead in combination with appropriate layout and screens. I.e. what I am using now are just the classes VelocityDirectLayout and VelocityDirectScreen in Turbine 2.3.3. They were very misleadingly called like that, and indeed in T4 their behaviour changed to what the class name promises. I just renamed the old classes to VelocityCachedLayout and VelocityCachedScreen and I now get the expected result (the output is flushed at the end, N.B. I am using the old jetspeed 1.6 framework on top of Turbine).

I would plead to remove the deprecated tag for the Rundata.getOut() and linked methods and allow for caching the layout and screen. At least to think about it...

                
> Nested Templates output reversed
> --------------------------------
>
>                 Key: TRB-85
>                 URL: https://issues.apache.org/jira/browse/TRB-85
>             Project: Turbine
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Core 4.0-M1
>         Environment: Windows XP, 
> java version "1.6.0_13"
> Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
> Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)
> Tomcat 6.0.18_03
>            Reporter: Georg Kallidis
>         Attachments: TurbineVelocityServices.patch
>
>
> Using (nested) calls in screen template the output (of the templates) seems to be reversed, i.e. the latest called templates are outputted first (lifo). 
> This may be due to that org.apache.turbine.services.velocity.TurbineVelocityService.handleRequest(Context, String) is implemented such, that each invocation creates a new instance of a java.io.OutputStreamWriter.OutputStreamWriter(OutputStream, String), which velocity then is writing to. May be the exact reason should be investigated in more detail. No test is available at the moment.
> This could be solved by providing a concurrent safe instance variable of OutputStreamWriter to be used in this method (handleRequest).
> Cft. http://mail-archives.apache.org/mod_mbox/turbine-dev/201109.mbox/%3C4E67C58C.5020804@apache.org%3E
> A patch could be attached later ..

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira