1 /* 2 * Copyright 2006 Maik Schreiber <blizzy AT blizzy DOT de> 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * <p>Provides annotations support for DWR. This can be used as a replacement as well as 19 * in conjunction with {@code dwr.xml}.</p> 20 * 21 * <h3>Setup</h3> 22 * 23 * <p>To use DWR with annotations you need to specify a different DWR controller 24 * servlet in your {@code web.xml}:</p> 25 * 26 * <p><pre> 27 * {@literal <servlet>} 28 * {@literal <description>}DWR controller servlet{@literal </description>} 29 * {@literal <servlet-name>}DWR controller servlet{@literal </servlet-name>} 30 * {@literal <servlet-class>}{@linkplain org.directwebremoting.servlet.DwrServlet org.directwebremoting.servlet.DwrServlet}{@literal </servlet-class>} 31 * {@literal <init-param>} 32 * {@literal <param-name>}classes{@literal </param-name>} 33 * {@literal <param-value>} 34 * com.example.RemoteFunctions, 35 * com.example.RemoteBean 36 * {@literal </param-value>} 37 * {@literal </init-param>} 38 * {@literal </servlet>} 39 * </pre></p> 40 * 41 * <p>The {@code classes} servlet parameter must provide a comma-separated list of the 42 * fully-qualified class names of all annotated classes to be used with DWR.</p> 43 * 44 * <h3>Remote Class Access</h3> 45 * 46 * <p>To make a simple class available for remote access, use the 47 * {@link org.directwebremoting.annotations.RemoteProxy RemoteProxy} and 48 * {@link org.directwebremoting.annotations.RemoteMethod RemoteMethod} annotations:</p> 49 * 50 * <p><pre> 51 * {@literal @RemoteProxy} 52 * public class RemoteFunctions { 53 * {@literal @RemoteMethod} 54 * public int calculateFoo() { 55 * return 42; 56 * } 57 * } 58 * </pre></p> 59 * 60 * <p>Any method not annotated with {@code RemoteMethod} will not be available 61 * for remote access.</p> 62 * 63 * <p>To use a scripting name different from the class name, use the 64 * {@code name} attribute of {@code RemoteProxy}:</p> 65 * 66 * <p><pre> 67 * {@literal @RemoteProxy}(name="Functions") 68 * public class RemoteFunctions { 69 * } 70 * </pre></p> 71 * 72 * <h3>Object Conversion</h3> 73 * 74 * <p>To make simple bean classes available for remote access, use the 75 * {@link org.directwebremoting.annotations.DataTransferObject DataTransferObject} and 76 * {@link org.directwebremoting.annotations.RemoteProperty RemoteProperty} annotations:</p> 77 * 78 * <p><pre> 79 * {@literal @DataTransferObject} 80 * public class Foo { 81 * {@literal @RemoteProperty} 82 * private int foo; 83 * 84 * public int getFoo() { 85 * return foo; 86 * } 87 * 88 * {@literal @RemoteProperty} 89 * public int getBar() { 90 * return foo * 42; 91 * } 92 * } 93 * </pre></p> 94 * 95 * <p>To use more sophisticated converters see the 96 * {@link org.directwebremoting.annotations.DataTransferObject#converter converter} attribute of the 97 * {@code DataTransferObject} annotation.</p> 98 * 99 * @author Maik Schreiber <blizzy AT blizzy DOT de> 100 */ 101 package org.directwebremoting.annotations; 102