From: Aaron S. <aa...@ne...> - 2004-09-30 12:55:49
|
There's no reason why you can't just create your own version of Page. I ran into the same situation as you, in that I didn't want to embed HTML right into the servlets, so I took Page and cut out what I didn't need and added a couple of things. I use my version of Page as the super-class for all of my servlets. - Aaron Switzer On Wed, 2004-09-29 at 20:24, Kyle VanderBeek wrote: > (First try didn't go through due to a From-address mismatch.) > > I'm evaluating WebWare for possible uses at my company. However, I'm > distressed by how heavyweight and html-specific WebKit.Page is. I think > it is bothersome, a little confusing, and not very graceful when it > comes to wanting to write a webapp that extends the toolkit. > > My primary gripe is that Page seems to be the only reasonable extension > point for writing things, and many things I need to write may not > actually produce HTML. If I want to do MVC-like actions where decisions > are made and then forward()'ed away to a PSP, writeHTML() is pure > overhead. If I want to generate a PNG, CSV or other type of content, > it's confusing to override writeHTML() in my derived class. > > I suggest a new class, maybe named HTTPAction, be put between > HTTPServlet and Page. It should contain all the much of what is called > early in a Page (like respondToGet, respondToPost, and _respond) as well > as general utility methods (like forward()) but leave defaultAction(): > *blank* (or possibly just throwing an exception). > > Page should then override defaultAction() to call writeHTML(), which it > provides along with all the HTML-specific helper-methods. > > With this, people who want to write a differently templated page (maybe > something simpler like writeHeader(), writeBody(), writeFooter()) can > derive from this class. Also, people who want to write elements that > produce something other than a page of HTML have a more natural > extension point that includes the handy _action_ functionality and > utility routines I've mentioned. > > This can be done easily and without breaking current applications simply > by pushing some methods into a new class. > > If this sounds reasonable, I'll write a patch. Please respond and > comment. -- Aaron Switzer aa...@ne... 416-350-8376 ext. 235 |