All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.directwebremoting.annotations.package-info Maven / Gradle / Ivy

Go to download

DWR is easy Ajax for Java. It makes it simple to call Java code directly from Javascript. It gets rid of almost all the boiler plate code between the web browser and your Java code.

The newest version!
/*
 * Copyright 2006 Maik Schreiber 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * 

Provides annotations support for DWR. This can be used as a replacement as well as * in conjunction with {@code dwr.xml}.

* *

Setup

* *

To use DWR with annotations you need to specify a different DWR controller * servlet in your {@code web.xml}:

* *

 * {@literal }
 *    {@literal }DWR controller servlet{@literal }
 *    {@literal }DWR controller servlet{@literal }
 *    {@literal }{@linkplain org.directwebremoting.servlet.DwrServlet org.directwebremoting.servlet.DwrServlet}{@literal }
 *    {@literal }
 *       {@literal }classes{@literal }
 *       {@literal }
 *          com.example.RemoteFunctions,
 *          com.example.RemoteBean
 *       {@literal }
 *    {@literal }
 * {@literal }
 * 

* *

The {@code 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 * {@link org.directwebremoting.annotations.RemoteProxy RemoteProxy} and * {@link org.directwebremoting.annotations.RemoteMethod RemoteMethod} annotations:

* *

 * {@literal @RemoteProxy}
 * public class RemoteFunctions {
 *    {@literal @RemoteMethod}
 *    public int calculateFoo() {
 *      return 42;
 *    }
 * }
 * 

* *

Any method not annotated with {@code RemoteMethod} will not be available * for remote access.

* *

To use a scripting name different from the class name, use the * {@code name} attribute of {@code RemoteProxy}:

* *

 * {@literal @RemoteProxy}(name="Functions")
 * public class RemoteFunctions {
 * }
 * 

* *

Object Conversion

* *

To make simple bean classes available for remote access, use the * {@link org.directwebremoting.annotations.DataTransferObject DataTransferObject} and * {@link org.directwebremoting.annotations.RemoteProperty RemoteProperty} annotations:

* *

 * {@literal @DataTransferObject}
 * public class Foo {
 *    {@literal @RemoteProperty}
 *    private int foo;
 *    
 *    public int getFoo() {
 *       return foo;
 *    }
 *    
 *    {@literal @RemoteProperty}
 *    public int getBar() {
 *       return foo * 42;
 *    }
 * }
 * 

* *

To use more sophisticated converters see the * {@link org.directwebremoting.annotations.DataTransferObject#converter converter} attribute of the * {@code DataTransferObject} annotation.

* * @author Maik Schreiber <blizzy AT blizzy DOT de> */ package org.directwebremoting.annotations;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy