[Bug 355854] remove automatic conversion in favor of issuing a warning for jetty-web.xml that can't be processed
This commit is contained in:
parent
05fe9dc2d4
commit
af07e1cef8
|
@ -15,7 +15,6 @@ package org.eclipse.jetty.webapp;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
|
@ -86,22 +85,21 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
|
|||
|
||||
if (jetty_config==null)
|
||||
{
|
||||
String jettyXml = IO.toString(jetty.getURL().openStream());
|
||||
|
||||
if ( jettyXml.contains("org.mortbay.") )
|
||||
{
|
||||
Log.warn("Detected jetty 6 configuration, attempting to automatically convert");
|
||||
jettyXml = convertFromJetty6(jettyXml);
|
||||
}
|
||||
|
||||
jetty_config=new XmlConfiguration(jettyXml);
|
||||
jetty_config=new XmlConfiguration(jetty.getURL());
|
||||
}
|
||||
else
|
||||
{
|
||||
context.removeAttribute(XML_CONFIGURATION);
|
||||
}
|
||||
setupXmlConfiguration(context,jetty_config, web_inf);
|
||||
jetty_config.configure(context);
|
||||
try
|
||||
{
|
||||
jetty_config.configure(context);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
Log.warn("Unable to process jetty-web.xml", e);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -132,22 +130,4 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
|
|||
Map<String,String> props = jetty_config.getProperties();
|
||||
props.put(PROPERTY_THIS_WEB_INF_URL, String.valueOf(web_inf.getURL()));
|
||||
}
|
||||
|
||||
/*
|
||||
* convert specific o.m.jetty paths to o.e.jetty paths
|
||||
*/
|
||||
private String convertFromJetty6(String jettyXml)
|
||||
{
|
||||
// XMLConfiguration(String) will tack on <?xml directives, so make sure we pare this down to just
|
||||
// the Configure
|
||||
if ( !jettyXml.startsWith("<Configure"))
|
||||
{
|
||||
jettyXml = jettyXml.substring(jettyXml.indexOf("<Configure"));
|
||||
}
|
||||
|
||||
jettyXml = jettyXml.replace("org.mortbay.jetty.webapp.WebAppContext","org.eclipse.jetty.webapp.WebAppContext");
|
||||
|
||||
return jettyXml;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue