Thursday, March 26, 2009

web.xml role-name with spaces

I was having some trouble using with a value with spaces in it. I figured out why and how to fix it: The XML parser probably fails to read the role-name data because role-name is defined as xsd:ID in XML Schema which cannot have spaces. So if you escape the role name with CDATA, which suspends parsing, your roles will match up with LDAP roles that have spaces in them -- if you happen to have that convention in your LDAP. So now role-name entries in web.xml look like the following if they have spaces in them:

<role-name><![CDATA[my role name]]></role-name>
instead of

<role-name>my role name</role-name>

No comments: