You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Gary Lawrence Murphy <ga...@canada.com> on 2001/06/14 22:07:52 UTC
Re: Conceptual leap needed: How do I jump into RawScreens?
I'm still not understanding the generation of raw binary data; it's
getting closer, but there is a missing step to break out of the
Default layout's doBuild process and jump over to the RawScreen's
doOut().
>>>>> "L" == Leon Messerschmidt <le...@opticode.co.za> writes:
>> but my next conceptual leap is "How do I write raw data to
>> getOut() and avoid all further layout processing?"
L> Look at RawScreen.java
RawScreen looked very promising, but the only example of its use is an
"ImageServer screen class" which is not found in the TDK or the
Turbine CVS.
A comment in RawScreen suggests that the Layout must be set to null,
so I have the following code:
in DefaultLayout.java's doBuild:
if (xml!=null) { //
Log.debug("Metainfo request " + xml);
data.setScreenTemplate("/MetaInfo.vm");
data.setLayout(null);
}
super.doBuild();
This simply adds my XML to the end of the default page; if I remove the
last line, I get the XML appended to the empty HTML, HEAD and BODY tags.
I tried setLayoutTemplate(null) (exception) and also
setLayoutTemplate("/XmlTemplate") where that template's
layout/XmlTemplate class extends VelocityXslLayout. This appends the
raw output to the end of my normal index page.
Now here's a clue: The source of RawScreen fixes the getLayout to
null, and yet I can change the behaviour of this page by setting that
value during the Layout's doBuild. Does the Layout process not use
the screen's Layout?
My MetaInfo.java extends RawScreen and implements doOut as a call to
write TurbineVelocity.handleRequest( context, "/MetaInfo.vm" ) after
first obtaining and populating the Context object.
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Gary Lawrence Murphy <ga...@canada.com> writes:
> When dealing with opaque references, it might save some questions if
> we follow a convention of stating in the JavaDocs where methods alter
> any global or session-scoped data; the first point of study for Java
> is generally through the API docs or, later, through a combination of
> looking at one source file while viewing the API docs for the next
> deeper level. API docs are always the first probe; if what we do works
> as expected, we generally don't go any further -- after all, few of us
> _really_ know how java.net.URLConnection _really_ works (those who do
> don't use it ;)
Definitely, Gary. Turbine development processes are in now
coalescing, but not all of the code in Turbine has been subject to
these processes. I like the fact that you dig so deeply into things
and express your thoughts well--continue with Turbine and turn your
ideas into patches which we can integrate to smooth the journey for
others.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "S" == Scott Eade <se...@backstagetech.com.au> writes:
S> This is actually something I was going to look into in the next
S> day or so. Would you mind posting a hint or two as to where
S> the solution to this particular problem lies.
Unfortunately, by the time I found it, it was 4am and I got a kind
letter from Jon explaining how to redo the process in such a way that
this problem vanished, so I never noted the solution.
Let that be a lesson to you all! Keep your notes!!!! :)
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Scott Eade <se...@backstagetech.com.au>.
> Of course, the Source tells us so, but some of these context are
> more obscure, for example, when I was trying to find how the login
> screen kept loading DefaultLayout whereas ever config instance was
> clearly MyLayout. The answer was deep in the Flux.
Gary,
This is actually something I was going to look into in the next day or
so. Would you mind posting a hint or two as to where the solution
to this particular problem lies.
Thanks,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "H" == Henning P Schmiedehausen <ma...@hometree.net> writes:
H> I would say, he's off by two (the plus gets removed).
H> Looks like (setq c-basic-offset 2) to me. ;-) (Should be 4. I
H> do this wrong all the time, too).
Hmmm ... F1-v reports ...
`c-basic-offset' is a variable declared in Lisp.
-- loaded from "cc-vars"
Value: 4
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by "Henning P. Schmiedehausen" <ma...@hometree.net>.
Jon Stevens <jo...@latchkey.com> writes:
>Done...the only weird thing is that some of your patches were off by one
>character...ie:
> /**
> * Build the layout.
>+ *
>+ * <p><em>NOTE: Unless otherwise specified, the page background
>+ * defaults to 'white'</em></p>
> *
> * @param data Turbine information.
> * @exception Exception, a generic exception.
>Notice how it is off by one?
I would say, he's off by two (the plus gets removed).
Looks like (setq c-basic-offset 2) to me. ;-) (Should be 4. I do this
wrong all the time, too).
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH hps@intermeta.de
Am Schwabachgrund 22 Fon.: 09131 / 50654-0 info@intermeta.de
D-91054 Buckenhof Fax.: 09131 / 50654-20
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 6:59 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> next time, if I send this as an included file instead of an attachment,
> my mail software would expand all the tabs; do you prefer attachments
> or would you be able to handle an inline include?
Attachments are fine.
Also, can you please subscribe to the turbine-dev@jakarta.apache.org and
post things there? This list is really reserved for users and not
development.
Thanks!
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Gary Lawrence Murphy <ga...@canada.com>.
ACK: Something else for the style-guide: Expand all tabs.
next time, if I send this as an included file instead of an attachment,
my mail software would expand all the tabs; do you prefer attachments
or would you be able to handle an inline include?
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Gary Lawrence Murphy <ga...@canada.com> writes:
> Hmmm ... this may be an accident of email, but I notice that in the
> sample you sent, the normal lines were indented by 6 chars whereas
> mine (if you remove the +) are indented by 4, and 4 is my default tab
> size for C code (I use Emacs K&R rules).
4 characters is the correct tab width for Turbine development
(actually, all of Jakarta, I believe). Don't know why the sample was
off.
Also, I noticed that you've mentioned a style guide a few times. We
have had such a document for a while now:
http://jakarta.apache.org/turbine/code-standards.html
:)
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Gary Lawrence Murphy <ga...@canada.com>.
Hmmm ... this may be an accident of email, but I notice that in the
sample you sent, the normal lines were indented by 6 chars whereas
mine (if you remove the +) are indented by 4, and 4 is my default tab
size for C code (I use Emacs K&R rules).
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: [patch] Random Turbine API-DOCs
Posted by Jon Stevens <jo...@latchkey.com>.
Done...the only weird thing is that some of your patches were off by one
character...ie:
/**
* Build the layout.
+ *
+ * <p><em>NOTE: Unless otherwise specified, the page background
+ * defaults to 'white'</em></p>
*
* @param data Turbine information.
* @exception Exception, a generic exception.
Notice how it is off by one?
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
[patch] Random Turbine API-DOCs
Posted by Gary Lawrence Murphy <ga...@canada.com>.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> Great suggestions! I eagerly await your documentation. :-)
Careful what you wish for, you just might get it :)
I've actually thought of doing this; it wouldn't be too awfully
hard to regexp hunt for data 'set*' calls, then C-x` to step
through them all and C-c C-v j to javadoc the method.
I was thinking, though, more along the lines of "When you fix any
function, please fix the javadocs too" having a prominent part of your
strict style guide ;) After all, how many times a week do we
collectively tweak the code? How much time does it take to add just
one line of javadoc every time we do this?
Like many things in life, it takes more time and effort to avoid
documentation (and be doomed to answer the same questions over and
over) than to just include it in our habits and be done with it,
especially when we already know how the code works.
Lest we wander the sad way of the gnostics ... :)
Ok, how's this for a starter: You'd mentioned the programmer style
guide in the context of submitting diff -u patches, and I've got
text left over from the similar doc from the Linux kernel style
and submission guide. What say I merge these as a starting point?
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 2:47 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> "Never" is a big use-space ;) It's more accurate to say that Turbine
> may _repeatedly_ suggest alternate ways using sometimes obtuse cues:
>
> For example, if I foolishly assume all RunData manipulations I do in
> MySessionValidator are valid, Turbine of course allows them, but
> throws up the runtime exception "Screen not found" --- what it meant
> to say was that it is useless to setScreen inside sessionValidator
> because it will be cleared later in the Turbine.java ... the correct
> way is getProperties().setString("screen",...) which is only obvious
> if you know about the property key.
>
> Of course, the Source tells us so, but some of these context are
> more obscure, for example, when I was trying to find how the login
> screen kept loading DefaultLayout whereas ever config instance was
> clearly MyLayout. The answer was deep in the Flux.
>
> When dealing with opaque references, it might save some questions if
> we follow a convention of stating in the JavaDocs where methods alter
> any global or session-scoped data; the first point of study for Java
> is generally through the API docs or, later, through a combination of
> looking at one source file while viewing the API docs for the next
> deeper level. API docs are always the first probe; if what we do works
> as expected, we generally don't go any further -- after all, few of us
> _really_ know how java.net.URLConnection _really_ works (those who do
> don't use it ;)
Great suggestions! I eagerly await your documentation. :-)
:-)
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> on 6/18/01 12:33 PM, "Gary Lawrence Murphy" <ga...@canada.com>
J> wrote:
>>>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
>>
J> The thing to remember about Turbine...it *never* prevents you
J> from doing anything. It simply suggests ways of doing something
J> and if you don't like it, you can generally override it fairly
J> easily.
"Never" is a big use-space ;) It's more accurate to say that Turbine
may _repeatedly_ suggest alternate ways using sometimes obtuse cues:
For example, if I foolishly assume all RunData manipulations I do in
MySessionValidator are valid, Turbine of course allows them, but
throws up the runtime exception "Screen not found" --- what it meant
to say was that it is useless to setScreen inside sessionValidator
because it will be cleared later in the Turbine.java ... the correct
way is getProperties().setString("screen",...) which is only obvious
if you know about the property key.
Of course, the Source tells us so, but some of these context are
more obscure, for example, when I was trying to find how the login
screen kept loading DefaultLayout whereas ever config instance was
clearly MyLayout. The answer was deep in the Flux.
When dealing with opaque references, it might save some questions if
we follow a convention of stating in the JavaDocs where methods alter
any global or session-scoped data; the first point of study for Java
is generally through the API docs or, later, through a combination of
looking at one source file while viewing the API docs for the next
deeper level. API docs are always the first probe; if what we do works
as expected, we generally don't go any further -- after all, few of us
_really_ know how java.net.URLConnection _really_ works (those who do
don't use it ;)
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 12:33 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
>>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
>
> J> You have a HttpServletRequest and HttpServletResponse object
> J> sitting in the RunData object. You can do everything that a
> J> normal servlet can do.
>
> ACK! Of course!
>
> /me slaps himself on the head
>
> Thanks.
The thing to remember about Turbine...it *never* prevents you from doing
anything. It simply suggests ways of doing something and if you don't like
it, you can generally override it fairly easily.
:-)
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> You have a HttpServletRequest and HttpServletResponse object
J> sitting in the RunData object. You can do everything that a
J> normal servlet can do.
ACK! Of course!
/me slaps himself on the head
Thanks.
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tentative conceptual leap: Session-less Turbine
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 12:16 AM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> but unfortunately, Turbine's doGet
> method has not recorded enough information about the request to
> make a choice based on the requested page.
You have a HttpServletRequest and HttpServletResponse object sitting in the
RunData object. You can do everything that a normal servlet can do.
> By moving the two lines
>
> data.setScreen ( data.getParameters().getString("screen") );
> data.setAction ( data.getParameters().getString("action") );
>
> from below the session redirect to just above the test for
> "REDIRECTED_PATHINFO_NAME equals true", the screen/action names are
> made available in the RunData when Turbine tests
> sessionValidator.requiresNewSession(data) --- within SessionValidator,
> I can test for the no-session cases by explicit name (or a naming
> pattern convention) and avoid the redirect on a per-page basis.
In your SessionValidator, you can override what is in data.getParameters()
so that these values return something else. No need to move them.
> I would expect most modern webapps will want to implement RSS-export
> features and will require sessions be optional and invoked only on a
> per-page or per site-area basis; there are many other scenarios where
> there is no need to track session data. Some means to flip between
> these modes depending on the context needs to be part of Turbine.
Right. A SessionValidator will provide you with that functionality.
> Are there any alternative ways to have the screen module determine
> the result of the SessionValidator.requiresNewSession?
You can ask it directly. From Turbine.java...
// Get the instance of the Session Validator.
SessionValidator sessionValidator =
(SessionValidator)ActionLoader
.getInstance().getInstance(configuration.getString(
"action.sessionvalidator"));
Thanks!
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Tentative conceptual leap: Session-less Turbine
Posted by Gary Lawrence Murphy <ga...@canada.com>.
I have found a candidate solution to the problem of Turbine's session
requirements. Subclassing SessionValidator already allows for
bypassing the session redirect, but unfortunately, Turbine's doGet
method has not recorded enough information about the request to
make a choice based on the requested page.
By moving the two lines
data.setScreen ( data.getParameters().getString("screen") );
data.setAction ( data.getParameters().getString("action") );
from below the session redirect to just above the test for
"REDIRECTED_PATHINFO_NAME equals true", the screen/action names are
made available in the RunData when Turbine tests
sessionValidator.requiresNewSession(data) --- within SessionValidator,
I can test for the no-session cases by explicit name (or a naming
pattern convention) and avoid the redirect on a per-page basis.
This appears to work in all use-cases except one: If the request is
for a Flux login, Turbine correctly assigns the session, but ignores
my tr.prop "services.VelocityService.default.layout = GatewayLayout" and
substitutes a request for DefaultLayout -- all non-Flux pages behave
as expected.
Are there any other potential side-effects of moving the setAction
and setSession calls ahead of the security/session checks?
Are there any potential side-effects of leaving the session object
as null? (ie, any non-obvious service implications?)
I would expect most modern webapps will want to implement RSS-export
features and will require sessions be optional and invoked only on a
per-page or per site-area basis; there are many other scenarios where
there is no need to track session data. Some means to flip between
these modes depending on the context needs to be part of Turbine.
This method of testing the screen/action names in the SessionValidator
is not very elegant and its totally inflexible since the screen
patterns must be explicitly stated, but it does the trick (I thought
of using a pattern where no-session screens began with an underscore,
but this was only slightly less ugly than brute-force matching).
Are there any alternative ways to have the screen module determine
the result of the SessionValidator.requiresNewSession?
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jon Stevens <jo...@latchkey.com> writes:
> on 6/15/01 9:15 AM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
>
> > I am beginning to wonder if Turbine+Velocity is even able to express
> > the function I need to implement, ie to have a call to a page return
> > _either_ HTML or binary data. It appears so far that, once you are in
> > a Velocity page, you get VelocityECSLayout and it is not possible to
> > change your Layout from that default; all velocity (*.vm) page calls
> > _must_ return HTML and raw pages must be handled outside of Velocity.
> > Is this true?
>
> If you have a VTL template with the *only* thing in it being these
> characters:
>
> $binary
>
> Then, you can return binary data through a template by placing the binary
> data into the context as "binary". Set the layout to null.
You probably need to avoid inserting an EOL character after the
template which consists of $binary (Jon's statement implied this, but
I just want to be explicit).
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Gary Lawrence Murphy <ga...@canada.com> writes:
> >>>>> "G" == Gary Lawrence Murphy <ga...@canada.com> writes:
> G> I need to use Turbine services (email, pools, om, cache) in the
> G> RawScreen doBuild's; is there a recommended way to import these
> G> into the JSP side?
>
> I should add that these need to be integrated with the webapp, outside
> of the Turbine servlet, but sharing the same singleton generators;
> the src/java/org/apache/turbine/services/package.html makes it clear
> enough how to get an independent set of Turbine services in the other
> servlet, but I am wondering if there is already an easy way to have the
> _same_ services.
If you startup using TurbineConfig, the set of services you have
configured *will* be singletons (brokered by TurbineResources). Jason
van Zyl has made modifications to the services API in the development
branch (HEAD) that allow use of the services even outside of the
context of a servlet.
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "G" == Gary Lawrence Murphy <ga...@canada.com> writes:
G> I need to use Turbine services (email, pools, om, cache) in the
G> RawScreen doBuild's; is there a recommended way to import these
G> into the JSP side?
I should add that these need to be integrated with the webapp, outside
of the Turbine servlet, but sharing the same singleton generators;
the src/java/org/apache/turbine/services/package.html makes it clear
enough how to get an independent set of Turbine services in the other
servlet, but I am wondering if there is already an easy way to have the
_same_ services.
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Gary Lawrence Murphy <ga...@canada.com> writes:
> I need to use Turbine services (email, pools, om, cache) in the
> RawScreen doBuild's; is there a recommended way to import these into
> the JSP side?
I've been using Turbine's utility classes and services successfully
without the Turbine servlet since I started with Turbine (see the
TurbineConfig JavaDoc for a code snippet on how to do this). However,
Turbine can usually be integrated into any web-based system (though
patches from integrators are occassionally required).
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "G" == Gary Lawrence Murphy <ga...@canada.com> writes:
G> ... can a page do a session sometimes and not do a session
G> other times based on the GET parameters? :)
There is no hook to prevent the DynamicURI step, but there may be a
way to fool it: there is the semblance of a hook in
Turbine.REDIRECTED_PATHINFO_NAME which apparently gets into the
PathInfo when the session is created and the page redirected.
Since there is no hook to prevent it, this means creating a new
class extending Turbine.java to insert the hook; the simplest and
most logical place to put this is in the Turbine.doGet() and to
conditionally by-pass the block of code following
if (data.getParameters()
.getString(REDIRECTED_PATHINFO_NAME, "false").equals("true"))
But based on what criteria? The page and screen have not yet been
loaded and no action has gone through, so how could I conditionally
step over this block on a per-file basis without hard-coding the list
of RawScreens?
Am I trying to squeeze Turbine into a place where it doesn't fit?
I need session data for some HTML screens (eg, page through entries 20
at a time; ACL protected areas of the site) but all the RawScreens
need to be rendered directly so external programs can call them using
simple URLConnections.
Would a better approach be to use JSP for the Index page and have it
re-direct the request through to Turbine for the session-tracked
requests but to stay outside for the RawScreens (using Velocity in
stand-alone mode)? I'd sure hate to take this approach and find out
later that someone was only days away from releasing a per-page
optional-session feature in the core Turbine ;)
So long as Turbine is the entry point, there does not appear to be any
alternative: Turbine creates a session object and redirects to the
re-written extended PathInfo. period. That's just the way it is.
I need to use Turbine services (email, pools, om, cache) in the
RawScreen doBuild's; is there a recommended way to import these into
the JSP side?
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> If you have a VTL template with the *only* thing in it being
J> these characters:
J> $binary
J> Then, you can return binary data through a template by placing
J> the binary data into the context as "binary". Set the layout to
J> null.
Well, yes, and this is what I was doing, and the reason I could not
find the answer was because I was looking at the _wrong_ 200 lines
of code ;) ... I should have been looking at the _session_ code!
The problem is _entirely_ due to having an application grab this data
from a one-shot HTTP request, and since my app is still stuck in the
session-redirect stuff (a new quest!), the redirect never happens and
all these strange errors result. View the page in a browser that
accepts the cookie et voila! JNLP's galore.
Hmmmm ... so ... (he asks gingerly) ... can a page do a session sometimes
and not do a session other times based on the GET parameters? :)
BTW, I don't want to give any impression that I _expect_ all your kind
help here in the list; it amazes me that you have as much time as you
do for supporting us neophytes in our struggles to take our first steps.
(how _do_ you make your money when you're spending all your time on this?)
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/15/01 9:15 AM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> I am beginning to wonder if Turbine+Velocity is even able to express
> the function I need to implement, ie to have a call to a page return
> _either_ HTML or binary data. It appears so far that, once you are in
> a Velocity page, you get VelocityECSLayout and it is not possible to
> change your Layout from that default; all velocity (*.vm) page calls
> _must_ return HTML and raw pages must be handled outside of Velocity.
> Is this true?
If you have a VTL template with the *only* thing in it being these
characters:
$binary
Then, you can return binary data through a template by placing the binary
data into the context as "binary". Set the layout to null.
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
>> 43,000 LOC on the wall, 43,000 LOC take one down, pass it
>> around 42,999 LOC on the wall.
J> The part that is confusing you is only about 100-200 lines of
J> code.
Cool, so my probability of finding it is about 0.45%! :)
As it turns out, my evil plan doesn't work: VelocityPages _may_ not
allow you to change the layout from any location because the process
eventually undoes your changes by fetching the screen info from the
tr.props.
My afternoon goes into sifting code to see why an action under a
VelocityPage cannot change the screen to a RawScreen and thereby avoid
all layouts. From a first glance last night, it appears that the
VelocityPage process will execute the Action and then _reset_
the default screen from the tr.props, undoing what was done by the
action, but I am not yet certain.
It's a bit more than 200 lines ;) as it involves (so far) tracing the
page build through
Turbine.java -> VelocityPage.java: TemplatePage.java: DefaultPage.java
-> VelocityECSLayout.java: DefaultLayout.java
To paraphrase Mahatma Gandhi:
"What do you think of Encapsulation in Java?"
"It would be nice"
Don't mind me: I'm just one of those old ex-Eiffel guys from the 80's
OOP school of programming-by-contract :) I like interfaces better than
surprises -- my first knee-jerk reaction to some deep class changing
the rules on me is "I'm a-gonna *sue*!" :) Don't worry. I'll calm
down.
I am beginning to wonder if Turbine+Velocity is even able to express
the function I need to implement, ie to have a call to a page return
_either_ HTML or binary data. It appears so far that, once you are in
a Velocity page, you get VelocityECSLayout and it is not possible to
change your Layout from that default; all velocity (*.vm) page calls
_must_ return HTML and raw pages must be handled outside of Velocity.
Is this true?
I also wonder about the scattered use of tr.props; it reminds me a
little of referential opaqueness of global vars in BASIC ;) We can
change almost any data value, but have no guarantees that our change
will occur _after_ the initialization. Wouldn't it be better to move
the tr.props calls setting data values to the top of each method so
calls within the method can change them? Obviously this could not be a
hard and fast rule, but it might make the use of these global values a
bit more transparent.
Y'know what is frustrating? All this work, so far three and a half
working days, is just to support a deprecated interface that my
client will cease to use by the end of the summer. Don't ya just
_love_ this business?
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> Create a screen and then throw an exception in it...
J> if (true) { throw new Exception ("Here I am"); }
J> You will get a nice stack trace that will show the line numbers
J> of the code that is executed. :-)
Probably workable into something, but I have a habit of littering
my dev code with first-lines that say Log.debug( "methodname" );
It's quite curious about how the session-detect code reacts to this
situation, carving a very twisted trail that ends up re-instating
the title page. It will likely be roaringly clear once I wrap
my head around what it's doing (and how to prevent it).
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/18/01 4:38 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
> I did this recently in BasePeer to help trace a BasePeer subclass. It
> worked great, and I was thinking of submitting it as a patch (gated
> with a conditional compilation flag which defaults to off). Any
> interest in this?
>
> Dan
Totally...
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jon Stevens <jo...@latchkey.com> writes:
> on 6/14/01 11:08 PM, "Jon Stevens" <jo...@latchkey.com> wrote:
>
> > on 6/14/01 11:05 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> >
> >> (sigh) only ...
> >>
> >> 43,000 LOC on the wall, 43,000 LOC
> >> take one down, pass it around
> >> 42,999 LOC on the wall.
> >>
> >> :)
> >
> > The part that is confusing you is only about 100-200 lines of code.
> >
> > -jon
>
> Gary,
>
> One other thing that I realized that you can do that would make it REALLY
> easy to figure out what is going on...
>
> Create a screen and then throw an exception in it...
>
> if (true)
> {
> throw new Exception ("Here I am");
> }
>
> You will get a nice stack trace that will show the line numbers of the code
> that is executed. :-)
I did this recently in BasePeer to help trace a BasePeer subclass. It
worked great, and I was thinking of submitting it as a patch (gated
with a conditional compilation flag which defaults to off). Any
interest in this?
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/14/01 11:08 PM, "Jon Stevens" <jo...@latchkey.com> wrote:
> on 6/14/01 11:05 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
>
>> (sigh) only ...
>>
>> 43,000 LOC on the wall, 43,000 LOC
>> take one down, pass it around
>> 42,999 LOC on the wall.
>>
>> :)
>
> The part that is confusing you is only about 100-200 lines of code.
>
> -jon
Gary,
One other thing that I realized that you can do that would make it REALLY
easy to figure out what is going on...
Create a screen and then throw an exception in it...
if (true)
{
throw new Exception ("Here I am");
}
You will get a nice stack trace that will show the line numbers of the code
that is executed. :-)
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/14/01 11:05 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> (sigh) only ...
>
> 43,000 LOC on the wall, 43,000 LOC
> take one down, pass it around
> 42,999 LOC on the wall.
>
> :)
The part that is confusing you is only about 100-200 lines of code.
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "J" == Jon Stevens <jo...@latchkey.com> writes:
J> ... In order to do this, you need an understanding of what
J> calls what and when. A good portion of this is documented in
J> the fsd.html
J> #2. If there is a Layout, the Layout asks the Screen for a
J> Layout.
You mean "The Page asks the Screen for a Layout" ... only, if I am
already executing DefaultLayout (which extends the normal Turbine
default Layout class), then I am already in a Layout, so I must have
arrived there because the default Page loaded my Index screen and
the screen sent us back to the DefaultLayout where the instructions
say that I can set the screen.
Is it just me, or is this going around in circles?
Anyway, for the sake of those who may stumble across this in the
archives, I thought I would post my notes towards solving this little
puzzle; let me know if I've done anything really dense.
The fsd says,
"The Page module checks to see if there has been an Action defined
in the request. If so, it attempts to execute that Action. After
the Action has been executed, it asks the set Screen object for
its Layout. Page then attempts to execute the Layout object which
the Screen returned."
This implies that your #3 and #4 are in the wrong order, or that the
fsd has missed a step between the Action execution and executing the
Layout returned from asking the Screen.
J> #3. The Screen is then executed.
J> #4. The Layout is then executed.
The fsd implies that only an Action may change the screen, and your
sequence implies that only a Screen or an Action may change the
Layout. You are both right, but for the wrong reasons. The screen
is not actually executed until either the Layout executes it, or
there is no layout --- the screen doBuild _cannot_ change the Layout
because, if you get that far, it is way too late.
The code says that we set the session object, check authentication,
then exec DefaultPage...
1) Default page allows subclasses to prep the data, then executes the
Action. An Action cannot change the default DocType as it will be
reset when the Action exits, but it can change just about anything
else.
2) We get the screen object, and then get the layout name from the screen,
=> Unless otherwise overridden, the screen just spits back
the layout from the RunData (which may have been changed
by the action). Thus, a _screen_ *can* change the layout
but _only_ through re-implementing getLayout()
3) next, we exec the Layout if it is non-null;
in my case, it is non-null because it is my DefaultLayout set in
tr.props for the Index screen.
4) The page execs the non-null Layout _or_ it execs a layout-less
thingy such as a RawScreen
J> So, if you setLayout(null), then there is no template that is
J> going to be executed for that Layout.
If I let it enter screen/Index.java (homepage) it is already too late,
the Layout is already running in the previous stack layer; it has
already gone into DefaultLayout. Here I do have an opportunity to
shunt the request: I can defeat the _or_ in step (4) by _not_
returning the superclass doBuild, but by duplicating the layout-less
screen exec call in DefaultPage.
ugh.
Alternatively, I can subclass DefaultPage and take advantage of
the pre-build hook to insert actions so the legacy calls are now
identical to the new action calls, and these actions could then change
the screen from Index to the RawScreen allowing the rest of the
DefaultPage process to proceed as nature intended.
Or ... I could use the doBuildBeforeAction hook to change the screens
which is semantically probably a better approach since actions are
associated with buttons and widgets (ie (User) Actions or
"Controllers") whereas Screens are associated with outpus (ie
"Views").
(sigh) only ...
43,000 LOC on the wall, 43,000 LOC
take one down, pass it around
42,999 LOC on the wall.
:)
--
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless. They can only give you answers."(Pablo Picasso)
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Conceptual leap needed: How do I jump into RawScreens?
Posted by Jon Stevens <jo...@latchkey.com>.
Gary,
Think of it from the point of view of Turbine's module system. What you are
trying to do is control the processing of things. In order to do this, you
need an understanding of what calls what and when. A good portion of this is
documented in the fsd.html
Here is a summary...
#1. The Page starts the processing.
#2. If there is a Layout, the Layout asks the Screen for a Layout.
#3. The Screen is then executed.
#4. The Layout is then executed.
#5. Results are returned.
So, if you setLayout(null), then there is no template that is going to be
executed for that Layout.
What you really really need to pay attention to is what these Screen and
Layouts are extending. In order to output binary data, the RawScreen doesn't
extend VelocityECSScreen, it extends DefaultScreen. That is on purpose.
Once you have an understanding of the FSD document, this stuff should become
clear.
on 6/14/01 1:07 PM, "Gary Lawrence Murphy" <ga...@canada.com> wrote:
> Now here's a clue: The source of RawScreen fixes the getLayout to
> null, and yet I can change the behaviour of this page by setting that
> value during the Layout's doBuild. Does the Layout process not use
> the screen's Layout?
It depends on which Layout module you are using. This is up to you.
-jon
--
"Open source is not available to commercial companies."
-Steve Ballmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org