* If the BaseResource has not been set, use the war resource to
* derive a webapp resource (expanding WAR if required).
*/
protected void resolveWebApp() throws IOException
{
Resource web_app = super.getBaseResource();
if (web_app == null)
{
if (_war==null || _war.length()==0)
_war=getResourceBase();
// Set dir or WAR
web_app= Resource.newResource(_war);
// Accept aliases for WAR files
if (web_app.getAlias() != null)
{
Log.debug(web_app + " anti-aliased to " + web_app.getAlias());
web_app= Resource.newResource(web_app.getAlias());
}
if (Log.isDebugEnabled())
Log.debug("Try webapp=" + web_app + ", exists=" + web_app.exists() + ", directory=" + web_app.isDirectory());
// Is the WAR usable directly?
if (web_app.exists() && !web_app.isDirectory() && !web_app.toString().startsWith("jar:"))
{
// No - then lets see if it can be turned into a jar URL.
Resource jarWebApp= Resource.newResource("jar:" + web_app + "!/");
if (jarWebApp.exists() && jarWebApp.isDirectory())
{
web_app= jarWebApp;
_war= web_app.toString();
}
}