Hello,
I have built a simple working endpoint sample based on the HelloWorld
service that starts up fine with the following code in simple Main method.:
System.*out*.println("Starting Server");
HelloWorldImpl implementor = *new* HelloWorldImpl();
String address = "http://localhost:9000/helloWorld";
Endpoint ep = Endpoint.*publish*(address, implementor);
* *
This works just fine and I can access the
http://localhost:9000/helloWorld?wsdl fine from the browser as expected.
Also, when I call:
ep.stop();
That works as expected, with the endpoint no longer being avialable.
However, the jetty server still serves up 404 pages accordingly, when what
I really want is to be able to explicitly control when the underlying server
starts and stops and not merely when enpoints are stopped/published. I am
able to explicitly start and stop the server with the port/address being
completely reachable or unreachable as expected with code like below
Server jetty = *new* *Server*(9000)*;*
*try* {
jetty.start();
System.*err*.println("Jetty running: " + jetty.*isRunning*());
jetty.stop();
System.err.println("*Jetty* stopped: " + jetty.isStopped());
} *catch* (Exception e) {
…
*}*
What I cannot seem to figure out is how to meld the two together. Either
explicitly starting the server as in the jetty snippet and configuring my
endpoints there so that I can explicitly start and stop the entire
server(not just enpoints) or using the first type of example, how to get a
handle on the underlying server to completely stop it and not just the
endpoint(which ep.stop() does).
What am I missing?