Hi

(There's no need to copy my personal email address. Please do not).

What we do is this.

1. We have a custom RuntimeException:

public class ServerSideException extends RuntimeException implements
IsSerializable
{
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unused")
        private ServerSideException()
        {       /* For GWT. */ }
        
        public ServerSideException(Throwable t)
        {
                super(t);
        }
}

which can be seen by the GWT compiler and is declared on ALL RPC methods.

2. All of our RPC endpoints are spring beans.

3. We have a simple throws advice:

public class RpcErrorAdvice implements ThrowsAdvice
{
        private static final Logger log =
Logger.getLogger(RpcErrorAdvice.class); //NOPMD

        public void afterThrowing(final Throwable t) throws Throwable
        {
                log.error(t);
                throw new ServerSideException(t);               
        }
}

4. which listens to all beans derived from RemoteService:

<bean class = 
"org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
        <bean name = "rpcErrorAdvice" class =
"net.purpletube.cerberus.server.springintegration.RpcErrorAdvice" />
        <bean class 
="org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor">
                <property name = "advice" ref = "rpcErrorAdvice"/>      
                <property name = "expression" value = "execution(public *
com.google.gwt.user.client.rpc.RemoteService+.*(..))"/>
        </bean>


That's it.

-- 
Thanks
Paul

Paul Grenyer
e: [email protected]
b: paulgrenyer.blogspot.com
t: pjgrenyer

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to