You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Wayne Johnson <wd...@yahoo.com.INVALID> on 2018/10/19 17:39:33 UTC

Turbine 2.3.3 and layouts

Hello all,
I've inherited a set of web services that use Turbine 2.3.1 and Velocity-1.3.1.  I know it's pretty old, but it is what it is.
I found that one of our web pages is sending a jQuery back to the web site asking for additional information.  In the production system (Turbine-2.3.1), it's returning a response in simple JSON from a velocity template file. We've been working on some updates and now find that this $.post is returning the JSON response, but it's wrappered in one of the many layouts we have defined in the system.  Of course the JSON parser is choking.
We have many changes in our test systems, including an upgrade to Turbine-2.3.3 and putting the webapps into a war.  None of the other changes (as far as I can tell) have anything to do with this one request.  
 So how does Turbine select the appropriate Layout (if any) to use for any specific web page?  Why is it now, all of a sudden including a layout when it didn't before.  

Thanks.

--- 
Wayne Johnson,             | There are two kinds of people: Those 
                           | who say to God, "Thy will be done," 
                           | and those to whom God says, "All right, 
                           | then, have it your way." --C.S. Lewis

Re: Re: Turbine 2.3.3 and layouts

Posted by Wayne Johnson <wd...@yahoo.com.INVALID>.
Thank you all for your responses.  It looks like we're setting the layout within our code (although through a bit of a backchannel route).  Not sure why this does not appear under Turbine-2.3.1, but it does in 2.3.3.  I've changed our configuration table to use a different (pretty much empty) layout for the JSON requests and it seems to be working.
Thanks again. --- 
Wayne Johnson,             | There are two kinds of people: Those 
                           | who say to God, "Thy will be done," 
                           | and those to whom God says, "All right, 
                           | then, have it your way." --C.S. Lewis

Re: Re: Turbine 2.3.3 and layouts

Posted by Georg Kallidis <ge...@cedis.fu-berlin.de>.
Hi Wayne,

if the question is, what's the layout, which gets actually called, is, it 
might be best to find first this and then, if any, the one, which you want 
to be used instead.
In general:
a) investigate your logs (set DEBUG level to e.g. 
org.apache.turbine.services.template, org.apache.turbine.modules.layouts) 
for this call.
b) locate any hints in the template layout/screen or in in java, e.g. 
/screens/, setLayoutTemplate, setScreen ..
c) check upstream configuration - it might be at another place e.g. in 
/templates/layout/json/default.vm, additonally check 
TurbineResource.properties.
d) check, if the right screen is called, as it might or might not reset 
the layout to null (as o.a.t.modules.screen.Rawscreen does).

This and all other things are quite as Jeffery describes, you might check 
his descriptions thoroughly. 

As an alternative, you might want to omit velocity entirely and build your 
own JSON screen (similar to T5 screen: 
/turbine/src/java/org/apache/turbine/modules/screens/PlainJSONSecureAnnotatedScreen.java), 
which extends from RawScreen.
Fulcrum-Json is entirely about using JSON libraries  (Jackson, Gson) in 
Turbine, so this might be a second step, if you want to use JSON in more 
than one place ..
Best regards, Georg




Von:    Jeffery Painter <je...@jivecast.com>
An:     user@turbine.apache.org
Datum:  19.10.2018 22:35
Betreff:        Re: Turbine 2.3.3 and layouts



Hi Wayne,

I think I understand where you are coming from.  I have typed up my
notes on how I basically did the same thing you guys are doing (I think
so anyway - yet to be seen!).  I only took one small subset of my code
base to walk through a simple implementation.  I am not using jQuery (it
seemed overly complicated and heavy to me), but I think the overall
workflow/concepts are good here.

Georg, I think it would be great if you can review my notes and see how
these steps could be simplified (possibly) using the fulcrum-json API. 
I admit, I still have not dug into it thoroughly.

Also Wayne, I can tell you from my experience, updating from Turbine
2.3.1 to 2.3.3, I would suggest going ahead and moving to Turbine 4.0.1.
I have done this now with quite a few apps of mine, and it was pretty
painless once you figure  out where the major issues are (mostly changes
from RunData to PipelineData you need to make in screens and actions,
but you can mostly do a global search/replace on that).  There may be a
few more "gotchas" but I can't think of them all at the moment. I
updated most all of mine a little over 2 years ago, and now I am using
Turbine 5.0 from SVN (it is not yet released). It is working very
nicely.  The changes to migrate from 4.0 to 5.0 will be even less work
for you :-)  that is if you want to keep these apps going anyway.

So having said all that, here is a link to what I just wrote up.  I hope
you find it helpful.  And hopefully Georg will tell me I am doing it all
wrong and there is a much simpler path :-)  I do like how easy it is to
manage security access with the process I developed though.  I will be
curious to see if you guys *Wayne* did something similar or took a
completely different approach.

https://dev.jivecast.com/turbine/turbine_json.html

-- 
Jeff Painter

CEO and Founder of JiveCast
Software and analytics, made together
https://jivecast.com

301 Fayetteville St. Unit 2301, Raleigh, NC 27601
(919) 533-9024






On 10/19/18 1:39 PM, Wayne Johnson wrote:
> Hello all,
> I've inherited a set of web services that use Turbine 2.3.1 and 
Velocity-1.3.1.  I know it's pretty old, but it is what it is.
> I found that one of our web pages is sending a jQuery back to the web 
site asking for additional information.  In the production system 
(Turbine-2.3.1), it's returning a response in simple JSON from a velocity 
template file. We've been working on some updates and now find that this 
$.post is returning the JSON response, but it's wrappered in one of the 
many layouts we have defined in the system.  Of course the JSON parser is 
choking.
> We have many changes in our test systems, including an upgrade to 
Turbine-2.3.3 and putting the webapps into a war.  None of the other 
changes (as far as I can tell) have anything to do with this one request.  

>  So how does Turbine select the appropriate Layout (if any) to use for 
any specific web page?  Why is it now, all of a sudden including a layout 
when it didn't before.  
>
> Thanks.
>
> --- 
> Wayne Johnson,             | There are two kinds of people: Those 
>                            | who say to God, "Thy will be done," 
>                            | and those to whom God says, "All right, 
>                            | then, have it your way." --C.S. Lewis
>


[Anhang "signature.asc" gelöscht von Georg Kallidis/CeDiS/FU-Berlin/DE] 


Re: Turbine 2.3.3 and layouts

Posted by Jeffery Painter <je...@jivecast.com>.
Hi Wayne,

I think I understand where you are coming from.  I have typed up my
notes on how I basically did the same thing you guys are doing (I think
so anyway - yet to be seen!).  I only took one small subset of my code
base to walk through a simple implementation.  I am not using jQuery (it
seemed overly complicated and heavy to me), but I think the overall
workflow/concepts are good here.

Georg, I think it would be great if you can review my notes and see how
these steps could be simplified (possibly) using the fulcrum-json API. 
I admit, I still have not dug into it thoroughly.

Also Wayne, I can tell you from my experience, updating from Turbine
2.3.1 to 2.3.3, I would suggest going ahead and moving to Turbine 4.0.1.
I have done this now with quite a few apps of mine, and it was pretty
painless once you figure  out where the major issues are (mostly changes
from RunData to PipelineData you need to make in screens and actions,
but you can mostly do a global search/replace on that).  There may be a
few more "gotchas" but I can't think of them all at the moment. I
updated most all of mine a little over 2 years ago, and now I am using
Turbine 5.0 from SVN (it is not yet released). It is working very
nicely.  The changes to migrate from 4.0 to 5.0 will be even less work
for you :-)  that is if you want to keep these apps going anyway.

So having said all that, here is a link to what I just wrote up.  I hope
you find it helpful.  And hopefully Georg will tell me I am doing it all
wrong and there is a much simpler path :-)  I do like how easy it is to
manage security access with the process I developed though.  I will be
curious to see if you guys *Wayne* did something similar or took a
completely different approach.

https://dev.jivecast.com/turbine/turbine_json.html

-- 
Jeff Painter

CEO and Founder of JiveCast
Software and analytics, made together
https://jivecast.com

301 Fayetteville St. Unit 2301, Raleigh, NC 27601
(919) 533-9024






On 10/19/18 1:39 PM, Wayne Johnson wrote:
> Hello all,
> I've inherited a set of web services that use Turbine 2.3.1 and Velocity-1.3.1.  I know it's pretty old, but it is what it is.
> I found that one of our web pages is sending a jQuery back to the web site asking for additional information.  In the production system (Turbine-2.3.1), it's returning a response in simple JSON from a velocity template file. We've been working on some updates and now find that this $.post is returning the JSON response, but it's wrappered in one of the many layouts we have defined in the system.  Of course the JSON parser is choking.
> We have many changes in our test systems, including an upgrade to Turbine-2.3.3 and putting the webapps into a war.  None of the other changes (as far as I can tell) have anything to do with this one request.  
>  So how does Turbine select the appropriate Layout (if any) to use for any specific web page?  Why is it now, all of a sudden including a layout when it didn't before.  
>
> Thanks.
>
> --- 
> Wayne Johnson,             | There are two kinds of people: Those 
>                            | who say to God, "Thy will be done," 
>                            | and those to whom God says, "All right, 
>                            | then, have it your way." --C.S. Lewis
>