servlet context availability to non-servlet classes?
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
When using a servlet MVC framework, most of the classes one directly deals with have very little to do with servlets since that is really taken care of behind the scenes. However, I wonder if we shouldn't provide static access to something so fundamental as the ServletContext object or maybe even the ServletConig object of the ApplicationGateway? One way this would be beneficial is that it would allow for use of the XMLCContext object which provides a very convenient way to both configure XMLC via the web.xml and get an XMLCFactory object which is all set up with this provided configuration. Currently, the XMLCContext can only be used directly from a class which extends HttpServlet. This makes it less than useable under Barracuda. Would there be any danger in doing this? Is there another way to provide this that might be better/safer? Is there anyone else who thinks they might need this, or do people not see this as much of an issue? Note that the above stuff about XMLCContext is not currently true since XMLCContext requires a call to XMLCContext.getContext(HttpServlet). However, I plan to add a method which would be XMLCContext.getContext(ServletContext). This makes sense since the only real reason the instance of the HttpServlet is needed for is access to the ServletContext via getServletContext(). I still have some investigation to do on this, though. Jake