Package org.directwebremoting.annotations

Provides annotations support for DWR.


Class Summary
AnnotationsConfigurator A Configurator that works off Annotations.

Enum Summary
ScriptScope A scripting scope.

Annotation Types Summary
Auth Restrict remote access to a method to users authorized under a certain J2EE role.
DataTransferObject Convert a class to JavaScript and back.
Filter Filter remote accesses to a class.
Filters Filter remote accesses to a class.
GlobalFilter A global filter that filters all remote accesses to classes.
Param A parameter consisting of a name/value pair.
RemoteMethod Make method available for remote access.
RemoteProperty Make property available for remote access.
RemoteProxy Make a class available for remote access.

Package org.directwebremoting.annotations Description

Provides annotations support for DWR. This can be used as a replacement as well as in conjunction with dwr.xml.


To use DWR with annotations you need to specify a different DWR controller servlet in your web.xml:

    <description>DWR controller servlet</description>
    <servlet-name>DWR controller servlet</servlet-name>

The classes servlet parameter must provide a comma-separated list of the fully-qualified class names of all annotated classes to be used with DWR.

Remote Class Access

To make a simple class available for remote access, use the RemoteProxy and RemoteMethod annotations:

 public class RemoteFunctions {
    public int calculateFoo() {
      return 42;

Any method not annotated with RemoteMethod will not be available for remote access.

To use a scripting name different from the class name, use the name attribute of RemoteProxy:

 public class RemoteFunctions {

Object Conversion

To make simple bean classes available for remote access, use the DataTransferObject and RemoteProperty annotations:

 public class Foo {
    private int foo;
    public int getFoo() {
       return foo;
    public int getBar() {
       return foo * 42;

To use more sophisticated converters see the converter attribute of the DataTransferObject annotation.

Maik Schreiber <blizzy AT blizzy DOT de>

Copyright 2008