Hi David,
I started with the "modelglueapplicationtemplate" skeleton that comes
with Model-Glue. The call to the Security Controller is triggered like
this:
The default event of the application has an event-type "needsLogin"
<event-handler name="page.index" type="needsLogin">
<broadcasts />
<results>
<result do="template.main" />
</results>
<views>
<include name="body" template="pages/index.cfm" />
</views>
</event-handler>
This event-type is defined as
<event-type name="needsLogin">
<before>
<broadcasts>
<message name="getLoginStatus" />
<message name="checkPermission" />
</broadcasts>
<results>
<result name="notLoggedIn" do="notLoggedIn"
redirect="true" />
<result name="noPermission" do="noPermission"
redirect="true" />
</results>
<views />
</before>
</event-type>
So we're broadcasting "getLoginStatus" and "checkPermission" before
any event of type "needsLogin" and doing a redirection if certain
reults are set in our event. The Security controller listens to both
of the two messages
<controller id="Security" type="myApp.controller.Security">
<message-listener message="getLoginStatus" />
<message-listener message="checkPermission" />
</controller>
That's how the getLoginStatus() method of the Security Controlles gets
triggered.
I said "getting some errors lately" because we never ran into this
issue during development but now (as we're beginning to use the
application) it appears more often. I can't remember of some certain
change that started the problem.
I will definitely look into bean injection on the weekend - maybe we
can get around the problem, if we use a SesionService.cfc as you
suggested instead of a Helper.
Cheers,
Steve
On 2 Jun., 20:32, David J Henry <[email protected]>
wrote:
> Steve,
>
> Did you start with the skeleton ModelGlue3 project? What triggers the
> call to your security controller in ModelGlue.xml? You say "getting
> some errors lately". Did this error start after some kind of change?
>
> Personally I might put a function like IsLoggedIn() in a service
> component somewhere in my model like /model/SessionService.cfc or /
> model/services/SecurityService.cfc for example. I would use
> ColdSpring and Bean Injection to make this service accessible from my
> controller in the beans scope.
>
> Seehttp://docs.model-glue.com/wiki/HowTos/HowToUseBeanInjection#BeanInje...
> for more about Bean Injection
>
> I don't know enough about helpers to know why the helper scope
> wouldn't be available on first request. If you can provide some more
> details about your application I will try to reproduce the problem.
>
> ...or you could just come in to work extra early and hit the app
> before your co-workers get there x)
>
> Cheers,
> ~David
>
> On May 31, 4:33 am, steve82 <[email protected]> wrote:
>
> > Hi everybody,
>
> > I've build a Model-Glue application for my firm and we're getting some
> > errors lately. We are currently using Model-Glue version 3.1.299. The
> > error appears every morning. So I assume, that this is the time when
> > Model-Glue first loads up for that day and stores a copy of itself in
> > the application scope.
>
> > The following error message appears:
>
> > Oops!
>
> > Message Element LOGINHELPER is undefined in a Java object of type
> > class [Ljava.lang.String;.
> > Detail
> > Extended Info
> > Tag Context C:\Inetpub\wwwroot\office\controller\Security.cfc (42)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \eventrequest\EventContext.cfc (326)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \eventrequest\EventContext.cfc (253)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \eventrequest\phase\Invocation.cfc (91)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \eventrequest\EventContext.cfc (180)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \ModelGlue.cfc (243)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \ModelGlue.cfm (83)
> > C:\Inetpub\wwwroot\lib\cf\frameworks\mvc\modelglue\ModelGlue\gesture
> > \ModelGlue.cfc (243)
> > C.\Inetpub\wwwroot\office\index.cfm (50)
>
> > The code in Line 42 in our Security Controller just tries to call a
> > method from the LoginHelper.cfc that is stored in the helpers
> > directory:
>
> > <cfif NOT helpers.LoginHelper.isLoggedIn(sid)>
> > <cfset arguments.event.addResult("notLoggedIn") />
> > <cfelse>
> > <!--- creation of user object goes here --->
> > </cfif>
>
> > It looks to me that Model-Glue tries to access the helpers scope but
> > it's not initialized yet - instead CF treats it as a normal string
> > variable.
>
> > Any ideas about how this problem and how one could prevent this from
> > happenig? Telling my colleagues that they have to be more patient in
> > the morning when the app first load up doesn't work - i already tried
> > that :-)
>
> > Many thanks,
>
> > Steve
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en