332907 make context name and children context consistent for webapps

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3122 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Michael Gorovoy 2011-05-11 15:40:21 +00:00
parent 11de671982
commit 70d0d0d1f2
1 changed files with 10 additions and 10 deletions

View File

@ -25,10 +25,10 @@ import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.AbstractHandlerContainer;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.resource.Resource;
public class AbstractHandlerMBean extends ObjectMBean
{
/* ------------------------------------------------------------ */
public AbstractHandlerMBean(Object managedObject)
{
super(managedObject);
@ -88,7 +88,15 @@ public class AbstractHandlerMBean extends ObjectMBean
/* ------------------------------------------------------------ */
protected String getContextName(ContextHandler context)
{
String name=context.getDisplayName();
String name = null;
if (context.getContextPath()!=null && context.getContextPath().length()>0)
{
int idx = context.getContextPath().lastIndexOf(File.separator);
name = idx < 0 ? context.getContextPath() : context.getContextPath().substring(++idx);
if (name==null || name.length()==0)
name= "ROOT";
}
if (name==null && context.getBaseResource()!=null)
{
@ -104,14 +112,6 @@ public class AbstractHandlerMBean extends ObjectMBean
}
}
if (name==null && context.getContextPath()!=null && context.getContextPath().length()>0)
{
int idx = context.getContextPath().lastIndexOf(File.separator);
name = idx < 0 ? context.getContextPath() : context.getContextPath().substring(++idx);
if (name==null || name.length()==0)
name= "ROOT";
}
return name;
}
}