Re: [Winstone-devel] Winstone and DWR
Status: Beta
Brought to you by:
rickknowles
From: Rick K. <ri...@kn...> - 2007-02-17 15:26:00
|
Keda, Thanks for telling me about this. I did some checking, and I've found out that the DWR framework is actually violating Servlet Spec section SVR8.2 which says: SRV.8.2 Using a Request Dispatcher To use a request dispatcher, a servlet calls either the include method or forward method of the RequestDispatcher interface. The parameters to these methods can be either the request and response arguments that were passed in via the service method of the javax.servlet interface, or instances of subclasses of the request and response wrapper classes that were introduced for version 2.3 of the specification. In the latter case, the wrapper instances must wrap the request or response objects that the container passed into the service method. Notice the last sentence ... the reason Winstone fails is because DWR passes in a response to the request dispatcher forward() that *doesn't* wrap the winstone response it was supplied with. Winstone tries to unwrap the response until it gets back to its initial response, but stops at the SwallowingHttpServletResponse class because it doesn't extend ServletResponseWrapper. Winstone assumes that when it runs out of wrappers, it must be the original response (as the spec requires). DWR is violating the spec here by passing in a response of its own. I'll let the DWR people know about this. Thanks for bringing it up. Rick keda jones wrote: > Hello All, > > I am starting to use winstone in a > small project that I am working on and so far it has been very clean to work with. I ran in to some trouble, though, when I started using winstone in association with DWR ajax library (http://getahead.ltd.uk/dwr/). Specifically, I have encountered the class cast error below. It seems that DWR manufactures a ServletResponse that is not based on a WinstoneResponse. > > > WARN uk.ltd.getahead.dwr.impl.ExecuteQuery: warn() - Method execution failed: > java.lang.ClassCastException: uk.ltd.getahead.dwr.util.SwallowingHttpServletResponse > at winstone.RequestDispatcher.getUnwrappedResponse(RequestDispatcher.java:444) > at winstone.RequestDispatcher.forward(RequestDispatcher.java:268) > at uk.ltd.getahead.dwr.impl.DefaultWebContext.forwardToString(DefaultWebContext.java:124) > at com.XXX.webform.util.AjaxUtil.buildPrecacheMap(AjaxUtil.java:57) > at com.XXX.webform.util.AjaxUtil.ajaxTrToggle(AjaxUtil.java:43) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at uk.ltd.getahead.dwr.impl.ExecuteQuery.execute(ExecuteQuery.java:239) > at uk.ltd.getahead.dwr.impl.DefaultExecProcessor.handle(DefaultExecProcessor.java:48) > at uk.ltd.getahead.dwr.impl.DefaultProcessor.handle(DefaultProcessor.java:81) > at uk.ltd.getahead.dwr.AbstractDWRServlet.doPost(AbstractDWRServlet.java:162) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:121) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:45) > at winstone.ServletConfiguration.execute(ServletConfiguration.java:249) > at winstone.RequestDispatcher.forward(RequestDispatcher.java:334) > at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244) > at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150) > at java.lang.Thread.run(Unknown Source) > > > I have not looked at detail in to the code yet, but if anybody could give me any ideas of how this might be fixed, I would appreciate it. > > > Thanks, > Nathan > > > > > > ____________________________________________________________________________________ > Want to start your own business? > Learn how on Yahoo! Small Business. > http://smallbusiness.yahoo.com/r-index > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Winstone-devel mailing list > Win...@li... > https://lists.sourceforge.net/lists/listinfo/winstone-devel > -- Servlet v2.5 container in a single 166KB jar file ? Try Winstone (http://winstone.sourceforge.net/) |