Thank you for your recommendation. I had gone through it.
I have a framework where I need to feed Dropwizzard HTTPServer, so that
framework will start and stop the server.
SpringBoot, Oracle J4C/Helidon can be plugged to that. We need to support
Dropwizzarad as well.
In case of Helidon we do as shown below;
public synchronized Startable<Void> getUserServer() {
if (userServer == null) {
final io.helidon.webserver.Routing.Builder routingBuilder =
getRoutingBuilder();
final io.helidon.webserver.ServerConfiguration.Builder
serverConfigBuilder = getServerConfigBuilder();
customizeServerConfig(serverConfigBuilder);
customizeRouting(routingBuilder);
final io.helidon.webserver.WebServer server =
WebServer.create(serverConfigBuilder.build(), routingBuilder.build());
this.userServer = new J4CStartable(server);
}
return userServer;
}
private static class J4CStartable implements Startable<Void> {
private final WebServer webserver;
private J4CStartable(final WebServer webserver) {
this.webserver = webserver;
}
@Override
public CompletionStage<Void> start() {
return this.webserver.start().exceptionally(t -> {
if (t != null) {
final Throwable t2 = ExceptionUtils.getCause(t);
if (t2 instanceof SocketException && "Permission
denied".equals(t2.getMessage()) && webserver.configuration().port() < 1024)
{
throw new RuntimeException("Permission denied
(Possibly trying to bind to port < 1024 as non-root user)", t);
} else {
throw new RuntimeException(t);
}
}
return null;
}).thenApply(s -> null);
}
@Override
public CompletionStage<Void> stop() {
return this.webserver.shutdown().thenApply(s -> null);
}
}
When we execute below in tutorial which code starts the HTTP server? I
believe I would need the same stuff.
java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml
Thank you once again.
regards,
Robin Kuttaiah
On Thursday, June 6, 2019 at 7:02:17 PM UTC+5:30, Ryan Kennedy wrote:
>
> I recommend reading through the Get Started documentation if you haven’t
> already:
>
>
> https://www.dropwizard.io/1.3.12/docs/getting-started.html#creating-an-application-class
>
> Ryan
>
> On Thu, Jun 6, 2019 at 1:56 AM Kuttaiah Robin <[email protected]
> <javascript:>> wrote:
>
>> Hello,
>>
>> Am new to dropwizzard. Can someone help me on how to start and stop
>> Dropwizzard HTTP server programmatically in Java?
>>
>> thanks,
>> Robin Kuttaiah
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "dropwizard-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dropwizard-user/1e3c6509-803f-4957-9649-037592a7379e%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/dropwizard-user/1e3c6509-803f-4957-9649-037592a7379e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dropwizard-user/f19a3b12-87a8-4cae-84e6-4efcfb4f7829%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.