Question of Stateless Event

8 views
Skip to first unread message

Licky

unread,
Jun 19, 2013, 11:59:04 PM6/19/13
to its...@googlegroups.com
I have a question on the showcase StlessGlobalEventListener class.

1. Why the event can direct cast to ItsNatEventStateless without checking?

2. In case itsNatEvt.getItsNatDocument() is null, why ClientDocument can be obtained by itsNatEvt.getClientDocument()?

3. May I know the clear difference and life cycle between ItsNatDocument, HTMLDocument, and ClientDocument?

Licky

unread,
Jun 20, 2013, 12:21:10 AM6/20/13
to its...@googlegroups.com
One more question, what is the different between ItsNatEventStateless and ItsNatEventDOMStateless event?

jmar...@innowhere.com

unread,
Jun 21, 2013, 3:13:48 AM6/21/13
to its...@googlegroups.com

Good questions

First of all, I invite you to read the chapter 8 of Reference Manual on the new stateless mode

http://itsnat.sourceforge.net/php/support/docs/manual.pdf



El jueves, 20 de junio de 2013 05:59:04 UTC+2, Licky escribió:
I have a question on the showcase StlessGlobalEventListener class.

1. Why the event can direct cast to ItsNatEventStateless without checking?

  Because the servlet of this example where we registered StlessGlobalEventListener, is just being used for stateless documents, that is, no "conventional" stateful events are received.

  https://github.com/jmarranz/itsnat/blob/master/itsnat/web/WEB-INF/src/org/itsnat/manual/stless/servletstless.java


 

2. In case itsNatEvt.getItsNatDocument() is null, why ClientDocument can be obtained by itsNatEvt.getClientDocument()?

  ItsNatDocument is *usually* the symmetric document of client/browser page, this is not ever true, for instance in remote control the same ItsNatDocument is shared between users. Sometimes there is no such ItsNatDocument for instance when session is expired or similar, this is why sometimes we get null.

  ClientDocument represents the client browser/page, this ClientDocument *ever* exists including in error cases, in old versions of ItsNat in some cases ClientDocument was null, I realized the client browser is "ever" there so ClientDocument is not null in spite of in some cases ClientDocument behavior is dummy for instance when there is no ItsNatDocument bound.

  Usually there is 1 - 1 relationship between ClientDocument - ItsNatDocument, sometimes not, for instance in remote control (several clients sharing the same server doc), in this case when you call ItsNatDocument.addCodeToSend() you send custom JS code to all clients, and when you call ClientDocument.addCodeToSend() only the target client is involved.

 

3. May I know the clear difference and life cycle between ItsNatDocument, HTMLDocument, and ClientDocument?


 ItsNatDocument is just a wrapper of the standard DOM Document object (HTMLDocument when HTML/XHTML, remember pure XML, SVG or XUL are possible), the lifecycle is the same.


jmar...@innowhere.com

unread,
Jun 21, 2013, 3:20:11 AM6/21/13
to its...@googlegroups.com
ItsNatEventDOMStateless inherits from ItsNatEventStateless

http://itsnat.sourceforge.net/php/support/docs/javadoc/org/itsnat/core/event/ItsNatEventDOMStateless.html

and in the same time is a DOM Event extension.

When a stateless event is able to create a ItsNatDocument to process it, this event is received as a ItsNatEventDOMStateless because is to be processed by the global EventListener registered in this ItsNatDocument.

When something goes wrong (or unspecified) and there is no such ItsNatDocument the stateless event can only be processed by a global ItsNatServletRequestListener and because there is no ItsNatDocument the stateless event is just a generic ItsNatEventStateless.

use.by...@gmail.com

unread,
Jun 21, 2013, 4:04:06 AM6/21/13
to its...@googlegroups.com
Thanks. Indeed, I have read the manual first then getting into the source.

You mentioned the remote control feature here. May I know what is it? Any detail reference?

jmar...@innowhere.com

unread,
Jun 21, 2013, 2:55:08 PM6/21/13
to its...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages