Re: Practical WO Book Demos

From: D Tim Cummings (timc..pg.com.au)
Date: Sat Sep 29 2007 - 00:13:44 EDT

  • Next message: Mike Schrag: "Re: Practical WO Book Demos"

    On 29/09/2007, at 7:59 AM, Fred Shurtleff wrote:

    > Actually each chapter is a separate project which gets imported
    > into Eclipse, and, of course, contains only 1 Session class.
    > Furthermore I have not made ANY change to the project files ie.
    > Main or Session.java, nor the Main.wod files. I simple want to demo
    > their technique of managing security using a few methods in the
    > session class to control access to various public/secure areas in
    > the application.
    >
    I find sometimes if I have several projects open in eclipse, WO
    Component Editor validates against the wrong Session or Application
    class. Closing the unused projects fixes the problem.

    > WOComponentEditor does not complain about the bindings - that is
    > there are no red X's or other symbols indicating a problem. Matter
    > of fact, I did change the binding to
    > 'Session.isUserAuthenticated'(with a capital S since WOLips does
    > create a default Session.java file), and when I ran the app it did
    > complain that there was no 'Session' class. So I interpret this to
    > mean the session class is referenced Ok, but none of the session
    > class methods or variables are accessible. But I can't see why!
    >

    You need to make a small change, eg add a space to the html, to the
    WOComponent and save it to trigger WO Component Editor to revalidate
    the bindings.

    Session.isUserAuthenticated will be looking first for a method in
    your component called Session() or getSession() which won't work

    session.isUserAuthenticated will be looking first for a method session
    () which exists in WOComponent which your component extends.
    WOComponentEditor must do some funky stuff to determine that session
    () returns an object of type Session rather than type WOSession to
    complete the validation.

    Tim

    > I am totally stumped on this one.
    >
    > Jean Pierre Malrieu wrote:
    >> My guess is that there are several "Session" classes corresponding
    >> to different chapters in the book, and that somehow, you are using
    >> the wrong "Session" (from a previous chapter?) which does not have
    >> the required variables and functions.
    >> What does WOComponentEditor say about the bindings? Does it complain?
    >>
    >> jpm
    >>
    >>
    >>
    >> Le 28 sept. 07 à 19:56, Fred Shurtleff a écrit :
    >>
    >>> Yes - this is the conditional causing the exception. So I changed
    >>> the condition = true (to get around this problem), and then
    >>> another 'unknown key' exception is triggered: authenticatedUser
    >>> is unknown(but is in fact a public method in session.java).
    >>>
    >>> So for some reason none of the bindings on Main.wod using session
    >>> PUBLIC methods/vars are recognizable eg. they trigger exception
    >>> errors. Can anyone see what might be the problem here?
    >>>
    >>> Jean Pierre Malrieu wrote:
    >>>> Without taking a look at the book, or the code, so just a guess:
    >>>> Did you try changing the wod to
    >>>>
    >>>> Conditional: WOConditional {
    >>>> condition = session.isUserAuthenticated;
    >>>> }
    >>>>
    >>>> ?
    >>>>
    >>>>
    >>>> jpm
    >>>>
    >>>> Le 27 sept. 07 à 21:49, Fred Shurtleff a écrit :
    >>>>
    >>>>> Has anyone been able to run the Chapter4App demo from the
    >>>>> Practical WebObjects Book by Hill & Mallais?
    >>>>>
    >>>>> I am unable to get this project to run - it raises an Exception
    >>>>> > An instance variable or method of the name
    >>>>> 'isUserAuthenticated' is not found(this is a WOConditional
    >>>>> binding on the Main page). But 'isUserAuthenticated' is, in
    >>>>> fact, a method in Session.java. So I am now at a dead end.
    >>>>>
    >>>>> Thanks for any ideas or suggestions.
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>
    >>>
    >>
    >>
    >>
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Sep 29 2007 - 00:15:14 EDT