Book Image

DWR Java AJAX Applications

By : Sami Salkosuo
Book Image

DWR Java AJAX Applications

By: Sami Salkosuo

Overview of this book

Table of Contents (12 chapters)

Creators, Filters, and Signatures


Creators are used by DWR to instantiate our remote objects on the server side. Chapter 3 has a section about Creators, and how to use them.

Filters are used to intercept calls to remote objects. Interception can occur before or after the call, and filters can be used for various purposes such as logging, security, parameter checking, or even adding extra latency to the DWR calls. The following samples shows simple filter code, and how it is configured in dwr.xml for a single class:

public class NotifyRestrictedAccessFilter {
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception {
//if params include monitored sentence
//then send mail to security officials
… code here …
return chain.doFilter(obj, method, params);
}
}
<allow>
<create creator="new"javascript="GetAreaDetails">
<param name="class" value="org.area.NumberedArea"/>
<filter class="org.filters.NotifyRestrictedAccessFilter"/&gt...