Hi Dean, Are you trying to encode an exception to throw it back to the client side? AFAIK, you can just throw a IsSerializable exception in your code and GWT-RPC will transfer the said exception to the client side for you.
-- Arthur Kalmenson On Thu, Dec 18, 2008 at 12:55 AM, deanhiller <[email protected]> wrote: > > I have the following code in a servlet filter.... > > GwtSessionTimeout timeout = new GwtSessionTimeout( > "Session timed out. You need to redirect to > the url in getUrl > function", > url); > try { > String payload = > RPCServletUtils.readContentAsUtf8(request, true); > RPCRequest rpcRequest = RPC.decodeRequest(payload); > payload = RPC.encodeResponseForFailure(null, timeout); > > boolean gzipEncode = > RPCServletUtils.acceptsGzipEncoding(request) > && shouldCompressResponse(request, > response, payload); > > ServletContext servletContext = request.getSession > ().getServletContext(); > RPCServletUtils.writeResponse(servletContext, > response, payload, > gzipEncode); > > } catch (SerializationException e) { > throw new RuntimeException("Exception", e); > } catch (ServletException e) { > throw new RuntimeException("Exception",e); > } > > The browser(firefox) says "This application is out of date, please > click the refresh button on your browser." > > If I change > payload = RPC.encodeResponseForFailure(null, timeout); > to > payload = RPC.encodeResponseForFailure(rpcRequest.getMethod, timeout); > > it fails with UnexpectedException like GwtSessionTimeout was not a > RuntimeException, but it is a RuntimeException so it should work and I > expect the aysncCallback.onFailure to be called, but it doesn't work. > > Here is my GwtSessionTimeout.... > public class GwtSessionTimeout extends RuntimeException implements > IsSerializable{ > } > > why isn't this working? > later, > Dean > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
