|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
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. |
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
:
<servlet> <description>DWR controller servlet</description> <servlet-name>DWR controller servlet</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>classes</param-name> <param-value> com.example.RemoteFunctions, com.example.RemoteBean </param-value> </init-param> </servlet>
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.
To make a simple class available for remote access, use the
RemoteProxy
and
RemoteMethod
annotations:
@RemoteProxy public class RemoteFunctions { @RemoteMethod 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
:
@RemoteProxy(name="Functions") public class RemoteFunctions { }
To make simple bean classes available for remote access, use the
DataTransferObject
and
RemoteProperty
annotations:
@DataTransferObject public class Foo { @RemoteProperty private int foo; public int getFoo() { return foo; } @RemoteProperty public int getBar() { return foo * 42; } }
To use more sophisticated converters see the
converter
attribute of the
DataTransferObject
annotation.
|
Copyright ? 2005 | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |