Expose a way to get http port in run()
See original GitHub issueIn dropwizard 0.6 you could get the http port from the configuration in the run() method with configuration.getHttpConfiguration().getPort(). In 0.7.x this isn’t accessible.
We tried using jetty’s connectors, but it hasn’t started yet in run(), so we can’t use that. Are there any other ways of getting the port?
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Get the Running Port in Spring Boot - Baeldung
Usually, the most straightforward way to configure the HTTP port of a Spring Boot application is by defining the port in the configuration ......
Read more >How do I expose Web API on different port than default? .NET 6
From cmd.exe use >Netstat -a and check to see if port is already used by another application. – jdweng. Jan 20 at 11:13....
Read more >Enable ports 80 (HTTP) and 443 (HTTPS) - PaperCut
Enable ports 80 (HTTP) and 443 (HTTPS). By default, PaperCut NG/MF listens to ports 9191 and 9192 for HTTP and HTTPS communication respectively....
Read more >How to automatically choose a free port in ASP.NET Core 3.0
The typical approach is to expose an HTTP or TCP endpoint that the Kubernetes infrastructure can call, to verify the application hasn't crashed....
Read more >How to run a server on port 80 as a normal user on Linux?
Short answer: you can't. Ports below 1024 can be opened only by root. As per comment - well, you can, using CAP_NET_BIND_SERVICE, but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If anyone happens to run into this issue, we did add https://github.com/dropwizard/dropwizard/blob/master/dropwizard-lifecycle/src/main/java/io/dropwizard/lifecycle/ServerLifecycleListener.java#L19 in https://github.com/dropwizard/dropwizard/pull/1603 to make this easier.
Technically, if a user specifies an httpPort of
0for a random port, I had to something like this https://github.com/dropwizard/dropwizard-discovery/blob/master/src/main/java/io/dropwizard/discovery/core/CuratorAdvertisementListener.java to actually get the listening port from jetty upon startup.