Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
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());

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread Paul Stockley
In your service interface you have do declare each function throws your custom exception otherwise you will get that error. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
I am throwing IllegalArgumentException in my service interface and i still get the 500 error. On Tue, Jan 3, 2012 at 1:22 PM, Paul Stockley pstockl...@gmail.com wrote: In your service interface you have do declare each function throws your custom exception otherwise you will get that error.

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
return RPC.encodeResponseForFailure(null, new IllegalArgumentException(Logged out)); service interface... public interface GreetingService extends RemoteService { boolean isUserLoggedIn() throws IllegalArgumentException; } On Tue, Jan 3, 2012 at 1:25 PM, joe kolba joekolb...@gmail.com

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread Ashton Thomas
May also be a good idea to have all your services declare throws SerializationException and have all your custom exceptions extend SerExc Joe, did you fix your problem? if not, can you provide more details? -- You received this message because you are subscribed to the Google Groups Google

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
I solved it by creating a custom exception that extended IncompatibleRemoveService exception... it seems that is the only exception that RPC can serialize for failure. On Tue, Jan 3, 2012 at 1:39 PM, Ashton Thomas ash...@acrinta.com wrote: May also be a good idea to have all your services

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
im sorry i meant i extended RuntimeException not IncompatibleRemoteService On Tue, Jan 3, 2012 at 1:41 PM, joe kolba joekolb...@gmail.com wrote: I solved it by creating a custom exception that extended IncompatibleRemoveService exception... it seems that is the only exception that RPC can

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread Jens
Instead of this I would just extend RemoteServiceServlet and add a public static method that makes the session available to everyone (just like RequestFactoryServlet does), e.g. public static HttpSession getThreadLocalSession() { return getThreadLocalRequest().getSession(); } Then in your

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread joe kolba
yeah i was thinking about doing that but im going to have to call that static method for every rpc method, which I have around 15. Thanks I will consider changing it to this. On Tue, Jan 3, 2012 at 2:00 PM, Jens jens.nehlme...@gmail.com wrote: Instead of this I would just extend

Re: Overriding processCall to intercept RPC calls

2012-01-03 Thread Jens
You could also implement it using a ServletFilter. Take a look at the mobile web app example from GWT which uses a ServletFilter to authenticate users against Google App Engine: