I implemented the jetty server to load 3 web application contexts. But many clients' system are using JDK 6. So I have to downgrade jetty 8.
But I have to hurry to achieving this. Please let me know the shortcut for this. I implemented to load 3 webapplication contexts using xml and java program with jetty 9 version. The below is what I implemented my source code recently. These source code have to be replaced to the one of version 8. Help me.
Detaily, Right now, I can't find org.eclipse.jetty.server.ServerConnector in jetty 8. How can I replace the logis related to this class?
XmlConfiguration configuration = null;
Server server = null;
WebAppContext wac = null;
if(jettyConfigPath == null){ // running classpath
if(jettyConfPathList.contains("context/server/context-jetty-server.xml")) {
Resource server_xml = Resource.newResource(getFileinJar("context/server/context-jetty-server.xml").getAbsolutePath() );
configuration = new XmlConfiguration(server_xml.getInputStream());
server = (Server) configuration.configure();
}
if(jettyConfPathList.contains("context/server/context-jetty-wac.xml")) {
Resource wac_xml = Resource.newResource(getFileinJar("context/server/context-jetty-wac.xml").getAbsolutePath() );
configuration = new XmlConfiguration(wac_xml.getInputStream());
wac = (WebAppContext) configuration.configure();
}
} else{ // running from file / system property was set.
configuration = new XmlConfiguration(new URL("file:" + jettyConfigPath + "/context-jetty-server.xml"));
server = (Server) configuration.configure();
configuration = new XmlConfiguration(new URL("file:" + jettyConfigPath + "/context-jetty-wac.xml"));
wac = (WebAppContext) configuration.configure();
wac.setExtractWAR(false);
wac.setWar(webAppDir);s
}
wac.setWar(webAppDir);
HandlerCollection hc = new HandlerCollection();
WebAppContext derbyWebapp = new WebAppContext();
derbyWebapp.setContextPath("/derby");
derbyWebapp.setWar(derbyWebAppDir);
WebAppContext pluginServerWebapp = new WebAppContext();
pluginServerWebapp.setContextPath( "/plugin.server");
pluginServerWebapp.setWar(pluginServerWebAppDir);
HashLoginService login = new HashLoginService();
login.setName("RedcaRealm");
login.setConfig("conf/jetty-realm.properties");
login.setRefreshInterval(0);
server.addBean(login);
hc.addHandler(wac);
hc.addHandler(derbyWebapp);
hc.addHandler(pluginServerWebapp);
server.setHandler(hc);
server.start();
server.join();
--
Success is a long continuous journey..
- From Arnold