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/18 09:16:58 UTC
Tentative conceptual leap: Session-less Turbine
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: 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