Litty Preeth schrieb:
> But this method has the following weak points:
>
> * Some developer may forget to call the checkSession method.
>
> So any of you have any better ideas?
You can overwrite
public String processCall(String payload) throws SerializationException
and do the following:
RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass(), this);
if (!rpcRequest.getMethod().getName().equals("login")){
if (!validSession()){
return RPC.encodeResponseForFailure(null, new
InvalidSessionException());
}
}
return super.processCall(payload);
So all methods except the login-method will lead to the check
of a valid session. If there is none, a special exception is
thrown, otherwise the standard-way is performed.
> * There is code duplication in the onFailure implementation (Every
> onFailure shud handle the authentication exception)
Implement an AsyncCallback that checks the exception in onFailure
to be InvalidSessionException and react accordingly. Use this
implementation instead of the interface for creating your inner
classes when calling RPCs.
Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---