On 1/05/2010, at 12:35 AM, Scott Gray wrote: > On 30/04/2010, at 1:49 PM, Scott Gray wrote: > >> What about adding something like the following to ofbiz-component.xml schema >> <extend-web-app name="order" >> include-controller="path/to/controller.xml" >> /> > > Finding the webapp to extend doesn't look so easy, it looks like it would > need to be something like: > <extend-webapp server-name="default-server" mount-point="/ordermgr"> > That would be the only way to be sure that you're extending the correct > webapp. The name attribute is really only informational and does nothing, I > could for example name every webapp in OFBiz "order" and it would have no > effect whatsoever.
So I ended up doing two implementations:
<!-- extends the catalog webapp with the ordermgr's controller from a
hot-deploy component -->
<extend-webapp server="default-server" mount-point="/catalog">
<controller-extension
location="../../applications/order/webapp/ordermgr/WEB-INF/controller.xml"/>
</extend-webapp>
and:
<!-- extends the catalog's controller with the ordermgr's controller from a
hot-deploy component -->
<extend-controller
base-location="component://product/webapp/catalog/WEB-INF/controller.xml"
extend-location="component:///order/webapp/ordermgr/WEB-INF/controller.xml"/>
And I prefer the latter for a number of reasons:
- The former requires that you supply a ServletContext (or server name and
mount point) when retrieving a ControllerConfig and a number of calling methods
do not have that information available
- The latter doesn't depend on the mount point or server name meaning that you
can change them at will without breaking the extensions
- The latter allows you to extend controllers that don't have a webapp, for
example you can extend common-controller.xml and then your extensions will be
available to everything that includes it.
- The implementation on the latter feels a lot cleaner
Any thoughts?
Both work and I really like this feature, having the ability to plug additional
functionality into the base apps so easily seems pretty cool. It's a pity I
didn't decide to work on this earlier for 10.04.
I think the next step would be to add a similar type of feature for extending
the menu widget so that you don't have to override view-maps/screens to add
access to extensions.
Regards
Scott
smime.p7s
Description: S/MIME cryptographic signature
