Interface ServiceInterceptor

public interface ServiceInterceptor

ServiceInterceptor implementations may optionally be invoked before the actual service invocation. This allows to plug in functionality like caching or access control. A typical example implementation checking for a valid security token that was added to the service with the ActionScript Client API may look like this:

     public class SecurityInterceptor implements ServiceInterceptor {
         public Object intercept (ServiceProcessor processor) {
             String securityToken = processor.getRequest().getHeaderValue("token");
             if (isValid(securityToken)) {
                 return processor.proceed();
             } else {
                 throw new SecurityException();
         protected boolean isValid (String securityToken) {
             // perform some kind of validation

Jens Halm

Method Summary
 Object intercept(ServiceProcessor processor)
          Interceptor method invoked for each request.

Method Detail


Object intercept(ServiceProcessor processor)
Interceptor method invoked for each request. Usually the returned result will be the return value of the actual service invocation obtained with a call to processor.proceed(). Alternatively the implementation may also return its own result without invoking the service or throw an Exception.

processor - the instance processing this request
the result of the service invocation