|
Author: jleroux
Date: Sat May 5 08:00:44 2012 New Revision: 1334337 URL: http://svn.apache.org/viewvc?rev=1334337&view=rev Log: "Applied fix from trunk for revision: 1334336" ------------------------------------------------------------------------ r1334336 | jleroux | 2012-05-05 09:59:34 +0200 (sam., 05 mai 2012) | 2 lines Better way to read the distributable element from web.xml files. I did not put any distributable elements in web.xml files. So people still needs to follow the advice in catalina-container element in ofbiz-containers.xml ------------------------------------------------------------------------ Modified: ofbiz/branches/release12.04/ (props changed) ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Propchange: ofbiz/branches/release12.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1334336 Modified: ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1334337&r1=1334336&r2=1334337&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/branches/release12.04/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sat May 5 08:00:44 2012 @@ -20,6 +20,7 @@ package org.ofbiz.catalina.container; import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; @@ -77,8 +78,8 @@ import org.ofbiz.base.container.Containe import org.ofbiz.base.container.ContainerConfig; import org.ofbiz.base.container.ContainerConfig.Container.Property; import org.ofbiz.base.container.ContainerException; +import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.SSLUtil; import org.ofbiz.base.util.UtilURL; import org.ofbiz.base.util.UtilValidate; @@ -619,17 +620,26 @@ public class CatalinaContainer implement mount = mount.substring(0, mount.length() - 2); } + final String webXmlFilePath = new StringBuilder().append("file:///").append(location).append("/WEB-INF/web.xml").toString(); - final String webXmlFilePath = new StringBuilder().append(location) - .append(File.separatorChar).append("WEB-INF") - .append(File.separatorChar).append("web.xml").toString(); - boolean appIsDistributable = false; + URL webXmlUrl; try { - appIsDistributable = FileUtil.containsString(webXmlFilePath, "<distributable/>"); - } catch (IOException e) { - Debug.logWarning(String.format("Failed to read web.xml [%s].", webXmlFilePath), module); - appIsDistributable = false; + webXmlUrl = FlexibleLocation.resolveLocation(webXmlFilePath); + } catch (MalformedURLException e) { + throw new ContainerException(e); } + Document webXmlDoc = null; + try { + webXmlDoc = UtilXml.readXmlDocument(webXmlUrl); + } catch (SAXException se) { + throw new ContainerException(se); + } catch (ParserConfigurationException pce) { + throw new ContainerException(pce); + } catch (IOException ioe) { + throw new ContainerException(ioe); + } + + boolean appIsDistributable = webXmlDoc.getElementsByTagName("distributable").getLength() > 0 ? true : false; final boolean contextIsDistributable = distribute && appIsDistributable; // configure persistent sessions |
| Free forum by Nabble | Edit this page |
