// In case of an .war deployment the associated root file doesn't point to
// the expanded war file structure and thus breaks service-ref usage for servlet clients.
// This needs to be fixed in org.jboss.web.AbstractWebDeployer (JBOSS_AS/server module)
if (vfsRoot instanceof URLLoaderAdapter)
{
URLLoaderAdapter ula = (URLLoaderAdapter)vfsRoot;
URL rootURL = ula.toURL();
if ("file".equals(rootURL.getProtocol()) && rootURL.getFile().endsWith(".war"))
{
String fileName = rootURL.getFile();
if (!new File(fileName).exists()) // might be an exploded directory
{
// There is a filename convention for exploded directories
fileName = fileName.substring(0, fileName.indexOf(".war")) + "-exp.war";
File expandedDirectory = new File(fileName);
if (!expandedDirectory.exists())
throw new WSFException("Failed to bind service-ref, the deployment root expandedDirectory doesn't exist: " + fileName);
// update the rootFile
try
{
vfsRoot = new URLLoaderAdapter(expandedDirectory.toURL());
}
catch (MalformedURLException e)
{
}
}