return stack;
}
public static String buildNamespace(ActionMapper mapper, ValueStack stack, HttpServletRequest request) {
ActionContext context = new ActionContext(stack.getContext());
ActionInvocation invocation = context.getActionInvocation();
if (invocation == null) {
ActionMapping mapping = mapper.getMapping(request,
Dispatcher.getInstance().getConfigurationManager());
if (mapping != null) {
return mapping.getNamespace();
} else {
// well, if the ActionMapper can't tell us, and there is no existing action invocation,
// let's just go with a default guess that the namespace is the last the path minus the
// last part (/foo/bar/baz.xyz -> /foo/bar)
String path = RequestUtils.getServletPath(request);
return path.substring(0, path.lastIndexOf("/"));
}
} else {
return invocation.getProxy().getNamespace();
}
}