Interface EmbeddedServer<T extends AbstractConfiguration>
- Type Parameters:
T
- The type of configuration used by the embedded server implementation.
- All Known Implementing Classes:
AbstractEmbeddedServer
public interface EmbeddedServer<T extends AbstractConfiguration>
Specification of embedded server.
An embedded server:
- Can be started, stopped or restarted.
- Must provide port that can be used to query resources.
-
Method Summary
Modifier and TypeMethodDescriptionReturn server configuration.getHost()
Get the host, should be"localhost"
, unless specific configuration.getPath()
Get server context path.int
getPort()
Get port used by embedded server.Get the protocol scheme ("http"
,"https"
).javax.servlet.ServletContext
Get servlet context used within container.getUrl()
Get URL to query embedded server.boolean
Check if embedded server is started.void
restart()
Restart embedded server.void
start()
Start embedded server.void
stop()
Stop embedded server.
-
Method Details
-
start
void start()Start embedded server. If server is already started, this method should do nothing. -
stop
void stop()Stop embedded server. If server is already stopped, this method should do nothing. -
restart
void restart()Restart embedded server. -
getConfiguration
T getConfiguration()Return server configuration.- Returns:
- Configuration.
-
isStarted
boolean isStarted()Check if embedded server is started.- Returns:
true
if embedded server is started,false
otherwise.
-
getScheme
String getScheme()Get the protocol scheme ("http"
,"https"
).- Returns:
- Protocol scheme.
-
getHost
String getHost()Get the host, should be"localhost"
, unless specific configuration.- Returns:
- The server hostname.
-
getPort
int getPort()Get port used by embedded server.Note that:
- If the server is not started, the returned port should be the one set in the configuration.
- Otherwise, the "real" port should be returned (the port used by the embedded server)
- Returns:
- Port.
-
getPath
String getPath()Get server context path.- Returns:
- Server context path.
-
getUrl
String getUrl()Get URL to query embedded server.- Returns:
- URL.
-
getServletContext
javax.servlet.ServletContext getServletContext()Get servlet context used within container. If container is not a servlet container, this method should return null.- Returns:
- Servlet Context from container.
-