RPC + SerializationException + Spring Security AccessDeniedException

2010-03-12 Thread d95sld95
Environment: GWT 2, Spring + Spring Security 3, gwtrpc-spring 1.01

I am trying to implement authentication for my GWT application using
Spring Security. But when I call the RPC.invokeAndEncodeResponse
method it throws an SerializationException. Looking at the stack trace
I see that AccessDeniedException from Spring is thrown, but for some
reason GWT can't serialize it.

try {
RPC.invokeAndEncodeResponse(target, serviceMethod, args,
serializationPolicy)

} catch (SerializationException e) {
logger.error(e);
}

AccessDeniedException inherit from java.lang.RuntimeException. It has
a no-arg constructor inherited from RuntimeException. It does
implement Serializable.

What am I missing here???

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



Re: RPC + SerializationException + Spring Security AccessDeniedException

2010-03-12 Thread Sripathi Krishnan
GWT does not serialize RuntimeExceptions. If it did, it would have to
generate javascript equivalent of several useless Exception classes.

If you want the exception to propagate to the client, you have to do the
following -
a) The Exception should be Serializable
b) It should be in the client package (meaning, GWT Compiler has the source
code)
c) The Exception should be declared in the throws clause of your RPC
interface

In your case, AccessDeniedException is only meeting criteria (a). You would
have to create a new Exception class that clones AccessDeniedException and
then push it down the network.


--Sri
http://blog.530geeks.com


On 12 March 2010 19:02, d95sld95 steen.laur...@gmail.com wrote:

 Environment: GWT 2, Spring + Spring Security 3, gwtrpc-spring 1.01

 I am trying to implement authentication for my GWT application using
 Spring Security. But when I call the RPC.invokeAndEncodeResponse
 method it throws an SerializationException. Looking at the stack trace
 I see that AccessDeniedException from Spring is thrown, but for some
 reason GWT can't serialize it.

 try {
RPC.invokeAndEncodeResponse(target, serviceMethod, args,
 serializationPolicy)

 } catch (SerializationException e) {
logger.error(e);
 }

 AccessDeniedException inherit from java.lang.RuntimeException. It has
 a no-arg constructor inherited from RuntimeException. It does
 implement Serializable.

 What am I missing here???

 --
 You received this message because you are subscribed to the Google Groups
 Google Web Toolkit group.
 To post to this group, send email to google-web-tool...@googlegroups.com.
 To unsubscribe from this group, send email to
 google-web-toolkit+unsubscr...@googlegroups.comgoogle-web-toolkit%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/google-web-toolkit?hl=en.



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