{
MultiException mex = new MultiException();
if (getContexts() == null)
throw new IllegalArgumentException("No HandlerContainer");
Resource r = Resource.newResource(getWebAppDir());
if (!r.exists())
throw new IllegalArgumentException("No such sipapps resource "+r);
if (!r.isDirectory())
throw new IllegalArgumentException("Not directory sipapps resource "+r);
String[] files = r.list();
files: for (int f = 0; files != null && f < files.length; f++)
{
try
{
String context = files[f];
if (context.equalsIgnoreCase("CVS/") || context.equalsIgnoreCase("CVS")||context.startsWith("."))
continue;
Resource app = r.addPath(r.encode(context));
if (context.toLowerCase().endsWith(".war")
|| context.toLowerCase().endsWith(".jar")
|| context.toLowerCase().endsWith(".sar"))
{
context = context.substring(0, context.length() - 4);
Resource unpacked = r.addPath(context);
if (unpacked != null && unpacked.exists() && unpacked.isDirectory())
continue;
}
else if (!app.isDirectory())
{
continue;