See attachment. Would you find these refactorings sufficient? If so,
I'll attach it to the bug. I *think* this will appease everyone's interest.
(Steve and Malani: See post by Martin Cooper on struts-dev for background)
--
Eddie Bush
public static void selectApplication(HttpServletRequest request,
ServletContext context) {
// Acquire the path used to compute the module
String matchPath = (String)
request.getAttribute(RequestProcessor.INCLUDE_SERVLET_PATH);
if (matchPath == null) {
matchPath = request.getServletPath();
}
if (LOG.isDebugEnabled())
{
LOG.debug("Selecting module for path " + matchPath);
}
String prefix = ""; // Initialize prefix before we try lookup
if (matchPath.lastIndexOf("/") != 0)
{
// We may be in a non-default sub-app. Try to get it's prefix.
String prefixes[] = getApplicationPrefixes(context);
int lastSlash = matchPath.lastIndexOf("/");
do
{
matchPath = matchPath.substring(0, lastSlash);
// Match against the list of module prefixes
for (int i = 0; i < prefixes.length; i++) {
if (matchPath.equals(prefixes[i])) {
prefix = prefixes[i];
break;
}
}
lastSlash = matchPath.lastIndexOf("/");
}
while (prefix.equals("") && (lastSlash > 0));
}
else
{
// We are certain to be in the default sub-app
prefix ="";
}
if (LOG.isDebugEnabled())
{
LOG.debug("Activating module " +
(prefix.equals("") ? "default" : prefix));
}
// Expose the resources for this module
selectApplication(prefix, request, context);
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>