Package com.bobocode.bring.web.server
Interface WebServer
- All Known Implementing Classes:
TomcatWebServer
public interface WebServer
The
WebServer
interface defines basic lifecycle methods to manage the
server's state, including starting and stopping. Additionally, it provides a method
to retrieve the port on which the server is listening.
Implementations of this interface should follow the contract described in each
method's documentation. The start
and stop
methods are idempotent,
meaning calling them multiple times on the same server instance has no additional
effect once the server is in the desired state.
If the server encounters any issues during the start or stop process, it throws
a WebServerException
to indicate the problem.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
- See Also:
-
Method Summary
-
Method Details
-
start
void start()Starts the web server. Calling this method on an already started server has no effect. -
stop
void stop()Stops the web server. Calling this method on an already stopped server has no effect. -
getPort
int getPort()Return the port this server is listening on.- Returns:
- the port (or -1 if none)
-