Hi,
Anyone interested in this proposed patch? ________________________________ From: Kitching, Simon Sent: Monday, 17 January 2011 4:35 p.m. To: [email protected] Subject: Patch to make StripesFilter more subclass-friendly.. Hi All, I've got a project using both Stripes (1.5.5) and Guice. While stripes does provide the "RuntimeConfiguration.ACTION_RESOLVER" config param to the StripesFilter class, this isn't an entirely satisfactory way to integrate the two. In particular, it requires that the property point to a class that has a static reference to a Guice injector. I'm using the above approach at the moment, but I'd prefer to instead subclass StripesFilter to use a custom Guice-created Configuration instance. Unfortunately, StripesFilter.init() is written in a way that makes this impossible: * it uses clazz.newInstance() to instantiate the configuration object; * it then stores it in private fields this.configuration and StripesFilter.configurations, ie fields inaccessable to subclasses. Simply factoring out the code to create the Configuration object from the init method into a separate protected method would make StripesFilter.java more subclass-friendly; the createConfiguration method can be overridden while allowing "this.configuration" and "StripesFilter.configurations" to remain private: public void init(FilterConfig filterConfig) throws ServletException { BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig); this.configuration = createConfiguration(filterConfig, bootstrap); .. as before .. } /** * Create an instance of the Configuration interface which this * filter instance will use. */ protected Configuration createConfiguration( FilterConfig filterConfig, BootstrapPropertyResolver bootstrap) throws StripesServletException { .. code factored out from init method } I've provided the createConfiguration method with the filterConfig param because some customisations of this method might want to use data from this object to select or configure the created Configuration object. See attached files for full code and patch. Sorry I haven't provided a "svn diff" patch, but I'm behind a firewall that blocks svn :-(. I'd appreciate you considering this for v1.5.6.... Regards, Simon Good planets are hard to find - please think of the environment before you print this email. ____________________________________________________________________ CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Air New Zealand immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Air New Zealand. _____________________________________________________________________ For more information on the Air New Zealand Group, visit us online at http://www.airnewzealand.com _____________________________________________________________________
<<winmail.dat>>
------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________ Stripes-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-development
