Issue Details (XML | Word | Printable)

Key: ROO-62
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Stefan Schmidt
Reporter: Ben Alex
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring Roo

Simplify web.xml builder

Created: 29/May/09 10:24 PM   Updated: 23/Nov/09 08:36 PM
Component/s: @ CORE
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Spring Forum Reference:: http://forum.springsource.org/showpost.php?p=243229&postcount=8


 Description  « Hide

Editing web.xml could be simplified, as suggested in the above forum post. Maybe something like:

WebXMLBuilder.addFilter(webXml).setName(param).set Class(param)

This would seem to resolve a number of hickups we encountered during development of add-ons to date like filter/filter-mapping ordering semantics etc.

It might be better to put this into a metadata object instead of provide a builder. It's also appropriate to review the web.xml fragmentation capabilities being considered in Servlet Spec 3 if building a metadata object.



Ben Alex added a comment - 30/May/09 07:38 PM

Assigned to Stefan so we can capture requirements, assess time required and consider which future release is realistic.


Murilo Rodrigues added a comment - 23/Nov/09 08:36 PM

+1 on this one.

I´m starting to write my first add-on and needed to write functions like this one:

private void addContextParam(Document webXml, String paramName, String paramValue) {

Element root = webXml.getDocumentElement();

if (null != XmlUtils.findFirstElement("/web-app/context-param[param-name='" + paramName + "']", root)) { //context-param already exists, nothing to do return; }

Element lastContextParam = XmlUtils.findRequiredElement("/web-app/context-param[last()]", root);

Element contextParamElement = webXml.createElement("context-param");
Element paramNameElement = webXml.createElement("param-name");
paramNameElement.setTextContent(paramName);
contextParamElement.appendChild(paramNameElement);
Element paramValueElement = webXml.createElement("param-value");
paramValueElement.setTextContent(paramValue);
contextParamElement.appendChild(paramValueElement);

root.insertBefore(contextParamElement, lastContextParam.getNextSibling());
}