Not sure how, but it did.
nk4um
startup task
| Poster | Content | ||
|---|---|---|---|
|
nk4um User
Posts: 24
|
|||
|
nk4um User
Posts: 24
|
It''s a nifty fragment, but it doesn''t work anywhere I have tried putting it so far.
I can''t find any documentation that clearly explains how the sections of the nk4 module.xml relate to each other (or with practical information, such as where to put the sort of fragment you quote) Can you offer some sort of clue? A full example of how to invoke someting on startup, with all the pieces shown in context, is really what I need. Since the fragments don''t work out of context, just giving one to me doesn''t help without explaining where it goes. Thanks, -= miles =- |
||
|
nk4um Moderator
Posts: 485
|
Hi Miles,
This indicates that you don''t have the groovy module imported into the space which contains the StartingEndpoint. You can import it with this fragment in your module definition:
Cheers, Tony |
||
|
nk4um User
Posts: 24
|
StartingEndpoint.groovy, which yields StartingEndpoint.class in the base directory; obviously, the postCommission function
is getting called.
What I''d really like to do is simply the Class.forName() that''s commented out, but for some reason that doesn''t work either. I have no idea why not, since courtResultCache.class is in the base directory of the app, and therefore should be on the class path. The error that appears in the log is the same, whether I catch it or not. Below is the captured output:
Thanks, -= miles =- |
||
|
nk4um Moderator
Posts: 485
|
Hi Miles, if you issue that request it should work from inside the postCommission() method just like it works from inside
the onSource() method or wherever you''ve previously tried it where it works - that''s the reason there is no explicit documentation
about issuing requests from inside postCommission()
Give me the exception trace that you see when you issue this request and I''ll help you track it down. Any errors generate within this lifecycle method will not go to your browser because they aren''t issued as part of a browser initiated request. Rather they should appear in log if they haven''t been silently ignored in application code. Try putting a try/catch block around the request and do a toString no the exception. Cheers, Tony |
||
|
nk4um User
Posts: 24
|
So how do I issue a subrequest from here?
For example, if I issue a subrequest by saying : context.source(''active:groovy+operator@res%3A/web/index.groovy'') it works from another groovy page, but not here. What do I need to do to get it to work? I assume this is not documented anywhere (I certainly could not find it) |
||
|
nk4um User
Posts: 24
|
thanks - I''ll give that a try.
|
||
|
nk4um Moderator
Posts: 485
|
Hi Miles, the best way to execute a script at startup within a module is to declare an endpoint with a postCommission() method
implemented. This is called one the module is started and it''s address space is available so it can be used to issue and
request you like:
You can either issue a request within this method or put your code directly in there. Either way it will be executed every time NetKernel starts. Cheers, Tony |
||
|
nk4um User
Posts: 24
|
Is there a simple way to execute a script every time NK starts? I''d like to define it at the module level if possible.
N.B.: Netkernel version 4.0.2 Thanks, -= miles =- |