org.directwebremoting.extend
Interface RealScriptSession

All Superinterfaces:
ScriptSession
All Known Implementing Classes:
DefaultScriptSession, TransientScriptSession

public interface RealScriptSession
extends ScriptSession

RealScriptSession is the real interface that should be implemented in place of ScriptSession. It includes methods required by the guts of DWR, that are not needed by normal users.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
 void addScriptConduit(ScriptConduit conduit)
          While a Marshaller is processing a request it can register a ScriptConduit with the ScriptSession to say - "pass scripts to me"
 boolean addScriptImmediately(ScriptBuffer script)
          If this ScriptSession currently has a connected ScriptConduit and this conduit accepts and claims to be able to publish the script then publish and return true, otherwise return false.
 int countPersistentConnections()
          Are there any persistent ScriptConduits currently connected to this session?
 java.lang.String getWindowName()
          Accessor for the name attached to this window
 boolean hasWaitingScripts()
          Allows for checking to see if there is data waiting to be returned
 void removeScriptConduit(ScriptConduit conduit)
          Remove a ScriptConduit.
 void setWindowName(java.lang.String windowName)
          If the global parameter avoid2ConnectionLimitWithWindowName == true then we need to keep a track of the names of the windows that connect to us
 void updateLastAccessedTime()
          Called whenever a browser accesses this ScriptSession to ensure that the session does not timeout before it should.
 void writeScripts(ScriptConduit conduit)
          We might need to send a script directly to a conduit without adding the conduit to the "open" list and then removing it directly.
 
Methods inherited from interface org.directwebremoting.ScriptSession
addScript, getAttribute, getAttributeNames, getCreationTime, getId, getLastAccessedTime, getPage, invalidate, isInvalidated, removeAttribute, setAttribute
 

Method Detail

addScriptImmediately

boolean addScriptImmediately(ScriptBuffer script)
If this ScriptSession currently has a connected ScriptConduit and this conduit accepts and claims to be able to publish the script then publish and return true, otherwise return false. Add a script to the list waiting for remote execution. The version automatically wraps the string in a ClientScript object.

Parameters:
script - The script to execute

addScriptConduit

void addScriptConduit(ScriptConduit conduit)
                      throws java.io.IOException
While a Marshaller is processing a request it can register a ScriptConduit with the ScriptSession to say - "pass scripts to me"

Several Marshallers may be active on the same page as a time and it doesn't really matter which gets the script. So ScriptSession should record all of the active ScriptConduits, but just pick one

Parameters:
conduit - The new ScriptConduit
Throws:
java.io.IOException - If the write to the output fails
See Also:
removeScriptConduit(ScriptConduit)

removeScriptConduit

void removeScriptConduit(ScriptConduit conduit)
Remove a ScriptConduit.

Parameters:
conduit - The ScriptConduit to remove
See Also:
addScriptConduit(ScriptConduit)

writeScripts

void writeScripts(ScriptConduit conduit)
                  throws java.io.IOException
We might need to send a script directly to a conduit without adding the conduit to the "open" list and then removing it directly.

Parameters:
conduit - The conduit to write to
Throws:
java.io.IOException - If writing fails

hasWaitingScripts

boolean hasWaitingScripts()
Allows for checking to see if there is data waiting to be returned

Returns:
true if there are no waiting scripts

updateLastAccessedTime

void updateLastAccessedTime()
Called whenever a browser accesses this ScriptSession to ensure that the session does not timeout before it should.


setWindowName

void setWindowName(java.lang.String windowName)
If the global parameter avoid2ConnectionLimitWithWindowName == true then we need to keep a track of the names of the windows that connect to us

Parameters:
windowName - The new name for the window that spawned this Session

getWindowName

java.lang.String getWindowName()
Accessor for the name attached to this window


countPersistentConnections

int countPersistentConnections()
Are there any persistent ScriptConduits currently connected to this session?

Returns:
The number of current persistent connections.

Copyright 2008