org.directwebremoting.extend
Class EnginePrivate

java.lang.Object
  extended by org.directwebremoting.extend.EnginePrivate

public class EnginePrivate
extends java.lang.Object

An abstraction of the dwr.engine Javascript class.

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

Constructor Summary
EnginePrivate()
           
 
Method Summary
static java.lang.String getExecuteFunctionName()
          The DefaultRemoter needs to know the name of the execute function
static ScriptBuffer getRemoteCloseFunctionScript(java.lang.String id)
          Call dwr.engine.remote.closeFunction() in the browser
static ScriptBuffer getRemoteExecuteFunctionScript(java.lang.String id, java.lang.Object[] params)
          Call dwr.engine.remote.executeFunction() in the browser
static ScriptBuffer getRemoteExecuteObjectScript(java.lang.String id, java.lang.String methodName, java.lang.Object[] params)
          Call dwr.engine.remote.executeFunction() in the browser
static java.lang.String getRemoteHandleBatchExceptionScript(java.lang.String batchId, java.lang.Exception ex)
          Call dwr.engine.remote.handleServerException() in the browser
static ScriptBuffer getRemoteHandleCallbackScript(java.lang.String batchId, java.lang.String callId, java.lang.Object data)
          Call the dwr.engine.remote.handleResponse() in the browser
static ScriptBuffer getRemoteHandleExceptionScript(java.lang.String batchId, java.lang.String callId, java.lang.Throwable ex)
          Call dwr.engine.remote.handleException() in the browser
static java.lang.String getRemoteHandleReverseAjaxScript(long scriptIndex, java.lang.String script)
          Call dwr.engine.remote.handleReverseAjax() in the browser
static java.lang.String getRemotePollCometDisabledScript(java.lang.String batchId)
          Call dwr.engine.remote.pollCometDisabled() in the browser
static ScriptBuffer getRemoteSetObjectScript(java.lang.String id, java.lang.String propertyName, java.lang.Object data)
          Call dwr.engine.remote.executeFunction() in the browser
static java.lang.String getRequireEngineScript()
          Get a string which will initialize a dwr.engine object
static java.lang.String remoteBeginIFrameResponse(java.lang.String batchId, boolean useWindowParent)
          A script to send at the beginning of an iframe response
static java.lang.String remoteBeginWrapper(java.lang.String instanceId, boolean useWindowParent, java.lang.String documentDomain)
          Begin wrapper with variable alias to do remote calls on the correct DWR instance.
static java.lang.String remoteEndIFrameResponse(java.lang.String batchId, boolean useWindowParent)
          A script to send at the end of an iframe response
static java.lang.String remoteEndWrapper(java.lang.String instanceId, boolean useWindowParent)
          End wrapper with variable alias to do remote calls on the correct DWR instance.
static java.lang.String remoteExecute(java.lang.String script)
          Prepare a script for execution in an iframe environment (we need to transfer the script to the parent window context before executing so referred globals will be found)
static java.lang.String remoteNewObjectFunction()
          Returns the name of the newObject function.
static java.lang.String xmlStringToJavascriptDomDocument(java.lang.String xml)
          Take an XML string, and convert it into some Javascript that when executed will return a DOM object that represents the same XML object
static java.lang.String xmlStringToJavascriptDomElement(java.lang.String xml)
          Take an XML string, and convert it into some Javascript that when executed will return a DOM object that represents the same XML object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnginePrivate

public EnginePrivate()
Method Detail

remoteBeginWrapper

public static java.lang.String remoteBeginWrapper(java.lang.String instanceId,
                                                  boolean useWindowParent,
                                                  java.lang.String documentDomain)
Begin wrapper with variable alias to do remote calls on the correct DWR instance.

Parameters:
instanceId - DWR instance id from browser
useWindowParent - should this alias target the same window or the parent window?
Returns:
JavaScript snippet to be used by other remote calls

remoteEndWrapper

public static java.lang.String remoteEndWrapper(java.lang.String instanceId,
                                                boolean useWindowParent)
End wrapper with variable alias to do remote calls on the correct DWR instance.

Parameters:
instanceId - DWR instance id from browser
useWindowParent - should this alias target the same window or the parent window?
Returns:
JavaScript snippet to be used by other remote calls

getRemoteHandleCallbackScript

public static ScriptBuffer getRemoteHandleCallbackScript(java.lang.String batchId,
                                                         java.lang.String callId,
                                                         java.lang.Object data)
Call the dwr.engine.remote.handleResponse() in the browser

Parameters:
batchId - The identifier of the batch that we are handling a response for
callId - The identifier of the call that we are handling a response for
data - The data to pass to the callback function
Returns:
The script to send to the browser

getRemoteHandleExceptionScript

public static ScriptBuffer getRemoteHandleExceptionScript(java.lang.String batchId,
                                                          java.lang.String callId,
                                                          java.lang.Throwable ex)
Call dwr.engine.remote.handleException() in the browser

Parameters:
batchId - The identifier of the batch that we are handling a response for
callId - The id of the call we are replying to
ex - The exception to throw on the remote end
Returns:
The script to send to the browser

getRemoteHandleReverseAjaxScript

public static java.lang.String getRemoteHandleReverseAjaxScript(long scriptIndex,
                                                                java.lang.String script)
Call dwr.engine.remote.handleReverseAjax() in the browser

Parameters:
scriptIndex -
script -

getRemoteHandleBatchExceptionScript

public static java.lang.String getRemoteHandleBatchExceptionScript(java.lang.String batchId,
                                                                   java.lang.Exception ex)
Call dwr.engine.remote.handleServerException() in the browser

Parameters:
batchId - The identifier of the batch that we are handling a response for
ex - The exception from which we make a reply
Returns:
The script to send to the browser

getRemoteExecuteFunctionScript

public static ScriptBuffer getRemoteExecuteFunctionScript(java.lang.String id,
                                                          java.lang.Object[] params)
Call dwr.engine.remote.executeFunction() in the browser

Parameters:
id - The registered function name
params - The data to pass to the function
Returns:
The script to send to the browser

getRemoteExecuteObjectScript

public static ScriptBuffer getRemoteExecuteObjectScript(java.lang.String id,
                                                        java.lang.String methodName,
                                                        java.lang.Object[] params)
Call dwr.engine.remote.executeFunction() in the browser

Parameters:
id - The registered function name
params - The data to pass to the function
Returns:
The script to send to the browser

getRemoteSetObjectScript

public static ScriptBuffer getRemoteSetObjectScript(java.lang.String id,
                                                    java.lang.String propertyName,
                                                    java.lang.Object data)
Call dwr.engine.remote.executeFunction() in the browser

Parameters:
id - The registered function name
propertyName - The name of the property to alter on the client object
data - The new value for the client object property
Returns:
The script to send to the browser

getRemoteCloseFunctionScript

public static ScriptBuffer getRemoteCloseFunctionScript(java.lang.String id)
Call dwr.engine.remote.closeFunction() in the browser

Parameters:
id - The registered function name
Returns:
The script to send to the browser

getRemotePollCometDisabledScript

public static java.lang.String getRemotePollCometDisabledScript(java.lang.String batchId)
Call dwr.engine.remote.pollCometDisabled() in the browser

Parameters:
batchId - The identifier of the batch that we are handling a response for
Returns:
The script to send to the browser

remoteNewObjectFunction

public static java.lang.String remoteNewObjectFunction()
Returns the name of the newObject function.


xmlStringToJavascriptDomElement

public static java.lang.String xmlStringToJavascriptDomElement(java.lang.String xml)
Take an XML string, and convert it into some Javascript that when executed will return a DOM object that represents the same XML object

Parameters:
xml - The XML string to convert
Returns:
The Javascript

xmlStringToJavascriptDomDocument

public static java.lang.String xmlStringToJavascriptDomDocument(java.lang.String xml)
Take an XML string, and convert it into some Javascript that when executed will return a DOM object that represents the same XML object

Parameters:
xml - The XML string to convert
Returns:
The Javascript

getRequireEngineScript

public static java.lang.String getRequireEngineScript()
Get a string which will initialize a dwr.engine object

Returns:
A dwr.engine init script

getExecuteFunctionName

public static java.lang.String getExecuteFunctionName()
The DefaultRemoter needs to know the name of the execute function

Returns:
The execute function name

remoteBeginIFrameResponse

public static java.lang.String remoteBeginIFrameResponse(java.lang.String batchId,
                                                         boolean useWindowParent)
A script to send at the beginning of an iframe response

Parameters:
batchId - The id of the current batch
useWindowParent - Will the exec happen from a child iframe which is the case for normal iframe based calls, or from the main window, which is the case for iframe streamed polling.
Returns:
A script to init the environment

remoteEndIFrameResponse

public static java.lang.String remoteEndIFrameResponse(java.lang.String batchId,
                                                       boolean useWindowParent)
A script to send at the end of an iframe response

Parameters:
batchId - The id of the current batch
useWindowParent - Will the exec happen from a child iframe which is the case for normal iframe based calls, or from the main window, which is the case for iframe streamed polling.
Returns:
A script to tidy up the environment

remoteExecute

public static java.lang.String remoteExecute(java.lang.String script)
Prepare a script for execution in an iframe environment (we need to transfer the script to the parent window context before executing so referred globals will be found)

Parameters:
script - The script to modify
Returns:
The modified script

Copyright ยจ 2008