org.directwebremoting.impl
Class DefaultRemoter

java.lang.Object
  extended by org.directwebremoting.impl.DefaultRemoter
All Implemented Interfaces:
Remoter
Direct Known Subclasses:
ParallelDefaultRemoter

public class DefaultRemoter
extends java.lang.Object
implements Remoter

An implementation of Remoter that delegates requests to a set of Modules

Author:
Joe Walker [joe at getahead dot ltd dot uk], Mike Wilson [mikewse at g mail dot com]

Constructor Summary
DefaultRemoter()
           
 
Method Summary
 Reply execute(Call call)
          Execute a single call object
 Replies execute(Calls calls)
          Execute a set of remote calls and generate set of reply data for later conversion to whatever wire protocol we are using today.
 java.lang.String generateDtoInheritanceJavaScript(java.lang.String indent, java.lang.String classExpression, java.lang.String superClassExpression, java.lang.String delegateFunction)
          Generate JavaScript that sets up a DTO class's inheritance from its superclass
 java.lang.String generateDtoJavaScript(java.lang.String jsClassName, java.lang.String indent, java.lang.String assignVariable)
          Generate JavaScript that forms a mapped DTO class
 java.lang.String generateInterfaceJavaScript(java.lang.String scriptName, java.lang.String indent, java.lang.String assignVariable, java.lang.String contextServletPath)
          Generate some Javascript that forms an interface definition
 java.lang.String getPathToDwrServlet(java.lang.String contextServletPath)
          The path to the DWR servlet is probably just equal to request.contextPath plus request.servletPath.
 void setAccessControl(AccessControl accessControl)
          Accessor for the security manager
 void setAccessLogLevel(java.lang.String accessLogLevel)
          When and what should we log? Options are (specified in the DWR servlet's init-params): 1) call (start of call + successful return values).
 void setAllowImpossibleTests(boolean allowImpossibleTests)
          Do we allow impossible tests for debug purposes
 void setConverterManager(ConverterManager converterManager)
          Accessor for the ConverterManager that we configure
 void setDebug(boolean debug)
          Set the debug status
 void setMaxCallCount(int maxCallCount)
          To prevent a DoS attack we limit the max number of calls that can be made in a batch
 void setModuleManager(ModuleManager moduleManager)
          Accessor for the ModuleManager that we configure
 void setUseAbsolutePath(boolean useAbsolutePath)
          By default we use a relative path to the DWR servlet which can help if there are several routes to the servlet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRemoter

public DefaultRemoter()
Method Detail

generateInterfaceJavaScript

public java.lang.String generateInterfaceJavaScript(java.lang.String scriptName,
                                                    java.lang.String indent,
                                                    java.lang.String assignVariable,
                                                    java.lang.String contextServletPath)
                                             throws java.lang.SecurityException
Description copied from interface: Remoter
Generate some Javascript that forms an interface definition

Specified by:
generateInterfaceJavaScript in interface Remoter
Parameters:
scriptName - The script to generate for
indent - Indent string prepended to all generated text lines
assignVariable - JavaScript identifier to generate an assignment of the interface to
contextServletPath - request.contextPath + request.servletPath.
Returns:
An interface javascript
Throws:
java.lang.SecurityException

generateDtoJavaScript

public java.lang.String generateDtoJavaScript(java.lang.String jsClassName,
                                              java.lang.String indent,
                                              java.lang.String assignVariable)
                                       throws java.lang.SecurityException
Description copied from interface: Remoter
Generate JavaScript that forms a mapped DTO class

Specified by:
generateDtoJavaScript in interface Remoter
Parameters:
jsClassName - The mapped JavaScript class name
indent - Indent string prepended to all generated text lines
assignVariable - JavaScript identifier to generate an assignment of the class to
Returns:
JavaScript class definition
Throws:
java.lang.SecurityException

generateDtoInheritanceJavaScript

public java.lang.String generateDtoInheritanceJavaScript(java.lang.String indent,
                                                         java.lang.String classExpression,
                                                         java.lang.String superClassExpression,
                                                         java.lang.String delegateFunction)
Description copied from interface: Remoter
Generate JavaScript that sets up a DTO class's inheritance from its superclass

Specified by:
generateDtoInheritanceJavaScript in interface Remoter
Parameters:
indent - Indent string prepended to all generated text lines
classExpression - The mapped JavaScript class name
superClassExpression - The mapped JavaScript superclass name
delegateFunction - Name of a callable JavaScript function that will create a prototype delegate (f ex dojo.delegate, in other frameworks sometimes called clone, beget, etc)
Returns:
JavaScript inheritance statement

getPathToDwrServlet

public java.lang.String getPathToDwrServlet(java.lang.String contextServletPath)
Description copied from interface: Remoter
The path to the DWR servlet is probably just equal to request.contextPath plus request.servletPath. However there are 2 ways to override this. One is to provide an overridePath setting, and the other is to specify useAbsolutePath=true, when the full URL up to the DWR servlet is used. This method simply echos back the contextServletPath unless one of those 2 settings are used in which case the modified value is returned.

Specified by:
getPathToDwrServlet in interface Remoter
Parameters:
contextServletPath - request.contextPath + request.servletPath.
Returns:
The path to the DWR servlet

execute

public Replies execute(Calls calls)
Description copied from interface: Remoter
Execute a set of remote calls and generate set of reply data for later conversion to whatever wire protocol we are using today.

Specified by:
execute in interface Remoter
Parameters:
calls - The set of calls to execute
Returns:
A set of reply data objects

execute

public Reply execute(Call call)
Execute a single call object

Parameters:
call - The call to execute
Returns:
A Reply to the Call

setUseAbsolutePath

public void setUseAbsolutePath(boolean useAbsolutePath)
By default we use a relative path to the DWR servlet which can help if there are several routes to the servlet. However it can be a pain if the DWR engine is running on a different port from the web-server. However this is a minority case so this is not officially supported.

Parameters:
useAbsolutePath - Does DWR generate an absolute _path property

setModuleManager

public void setModuleManager(ModuleManager moduleManager)
Accessor for the ModuleManager that we configure

Parameters:
moduleManager - The new ModuleManager

setConverterManager

public void setConverterManager(ConverterManager converterManager)
Accessor for the ConverterManager that we configure

Parameters:
converterManager - The new ConverterManager

setAccessControl

public void setAccessControl(AccessControl accessControl)
Accessor for the security manager

Parameters:
accessControl - The accessControl to set.

setAccessLogLevel

public void setAccessLogLevel(java.lang.String accessLogLevel)
When and what should we log? Options are (specified in the DWR servlet's init-params): 1) call (start of call + successful return values). 2) exception (checked) - default for debug. 3) runtimeexception (unchecked). 4) error - default for production. 5) off.


setAllowImpossibleTests

public void setAllowImpossibleTests(boolean allowImpossibleTests)
Do we allow impossible tests for debug purposes

Parameters:
allowImpossibleTests - The allowImpossibleTests to set.

setMaxCallCount

public void setMaxCallCount(int maxCallCount)
To prevent a DoS attack we limit the max number of calls that can be made in a batch

Parameters:
maxCallCount - the maxCallCount to set

setDebug

public void setDebug(boolean debug)
Set the debug status

Parameters:
debug - The new debug setting

Copyright ยจ 2008