I needed a solution to intercept RPC calls to make sure the user session
hasn't expired.  Here is my code:


@Override
>     public String processCall(String payload) throws
> SerializationException {
>
>         boolean validSession =
> (!getThreadLocalRequest().getSession().isNew());
>
>         RPCRequest rpcRequest =  RPC.decodeRequest(payload,
> this.remoteServiceClass);
>
>         if(!validSession &&
> !rpcRequest.getMethod().getName().equalsIgnoreCase("isUserLoggedIn")){
>             return RPC.encodeResponseForFailure(null, new
> IncompatibleRemoteServiceException("Logged out"));
>         }else{
>             return super.processCall(payload);
>         }
>
>       }
>

Everything works however I had to use the
IncompatibleRemoteServiceException rather then a custom exception.
Whenever I tried to use my custom exception or IllegalArgumentException
with RPC.encodeResponseForFailure() I would get a 500 response from my RPC
call.  Anyone have any information that could help me return a custom
exception?

-- 
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