fixed websocket test of jetty-test-webapp which cannot be accessed remotely

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-06-19 10:38:28 +02:00
parent 34b7cc512a
commit f28a1792d7
3 changed files with 3 additions and 30 deletions

View File

@ -160,7 +160,6 @@ public class XmlBasedJettyServer
this._server = foundServer; this._server = foundServer;
this._server.setStopTimeout(1000); this._server.setStopTimeout(1000);
} }
public String getScheme() public String getScheme()
@ -194,11 +193,11 @@ public class XmlBasedJettyServer
_server.stop(); _server.stop();
} }
public URI getServerURI() throws UnknownHostException public URI getServerURI()
{ {
StringBuffer uri = new StringBuffer(); StringBuffer uri = new StringBuffer();
uri.append(this._scheme).append("://"); uri.append(this._scheme).append("://");
uri.append(InetAddress.getLocalHost().getHostAddress()); uri.append(InetAddress.getLoopbackAddress().getHostAddress());
uri.append(":").append(this._serverPort); uri.append(":").append(this._serverPort);
return URI.create(uri.toString()); return URI.create(uri.toString());
} }

View File

@ -43,12 +43,11 @@ public class JettyWebSocketTest
server.setScheme(HttpScheme.HTTP.asString()); server.setScheme(HttpScheme.HTTP.asString());
server.addXmlConfiguration("basic-server.xml"); server.addXmlConfiguration("basic-server.xml");
server.addXmlConfiguration("login-service.xml"); server.addXmlConfiguration("login-service.xml");
// server.addXmlConfiguration("configurations-addknown-all.xml");
server.addXmlConfiguration("deploy.xml"); server.addXmlConfiguration("deploy.xml");
server.addXmlConfiguration("NIOHttp.xml"); server.addXmlConfiguration("NIOHttp.xml");
server.load(); server.load();
// server.getServer().setDumpAfterStart(true); server.getServer().setDumpAfterStart(true);
server.start(); server.start();
} }

View File

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call class="org.eclipse.jetty.webapp.Configurations" name="setKnown">
<Arg>
<Array type="String">
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebAppConfiguration</Item>
<Item>org.eclipse.jetty.webapp.ServletsConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JspConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JaasConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JndiConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.jsr356.server.JavaxWebSocketConfiguration</Item>
</Array>
</Arg>
</Call>
</Configure>