org.directwebremoting.impl
Class DefaultRemoter

java.lang.Object
  extended by org.directwebremoting.impl.DefaultRemoter
All Implemented Interfaces:
Remoter
Direct Known Subclasses:
JaxerRemoter, 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 generateAllDtoScripts()
          Generate JavaScript with all mapped DTO classes
 java.lang.String generateDtoScript(java.lang.String jsClassName)
          Generate JavaScript that forms a mapped DTO class
 java.lang.String generateInterfaceScript(java.lang.String scriptName, boolean includeDto, 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 setOverridePath(java.lang.String overridePath)
          If we need to override the default path
 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

generateInterfaceScript

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

Specified by:
generateInterfaceScript in interface Remoter
Parameters:
scriptName - The script to generate for
includeDto - Specifies whether mapped DTO classes should be added
contextServletPath - request.contextPath + request.servletPath.
Returns:
An interface javascript
Throws:
java.lang.SecurityException

generateDtoScript

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

Specified by:
generateDtoScript in interface Remoter
Parameters:
jsClassName - The mapped JavaScript class name
Returns:
JavaScript class definition
Throws:
java.lang.SecurityException

generateAllDtoScripts

public java.lang.String generateAllDtoScripts()
                                       throws java.lang.SecurityException
Description copied from interface: Remoter
Generate JavaScript with all mapped DTO classes

Specified by:
generateAllDtoScripts in interface Remoter
Returns:
JavaScript class definitions
Throws:
java.lang.SecurityException

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.

setOverridePath

public void setOverridePath(java.lang.String overridePath)
If we need to override the default path

Parameters:
overridePath - The new override path

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