Package io.dropwizard.core.cli
Class ServerCommand<T extends Configuration>
java.lang.Object
io.dropwizard.core.cli.Command
io.dropwizard.core.cli.ConfiguredCommand<T>
io.dropwizard.core.cli.EnvironmentCommand<T>
io.dropwizard.core.cli.ServerCommand<T>
- Type Parameters:
T- theConfigurationsubclass which is loaded from the configuration file
Runs an application as an HTTP server.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionServerCommand(Application<T> application) protectedServerCommand(Application<T> application, String name, String description) A constructor to allow reuse of the server command as a different name -
Method Summary
Modifier and TypeMethodDescriptionReturns theClassof the configuration type.protected voidrun(Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) Runs the command with the givenEnvironmentandConfiguration.Methods inherited from class io.dropwizard.core.cli.EnvironmentCommand
getEnvironment, runMethods inherited from class io.dropwizard.core.cli.ConfiguredCommand
addFileArgument, cleanup, cleanupAsynchronously, configure, getConfiguration, runMethods inherited from class io.dropwizard.core.cli.Command
getDescription, getName, onError
-
Constructor Details
-
ServerCommand
-
ServerCommand
A constructor to allow reuse of the server command as a different name- Parameters:
application- the application using this commandname- the argument name to invoke this commanddescription- a summary of what the command does
-
-
Method Details
-
getConfigurationClass
Description copied from class:ConfiguredCommandReturns theClassof the configuration type.- Overrides:
getConfigurationClassin classConfiguredCommand<T extends Configuration>- Returns:
- the
Classof the configuration type
-
run
protected void run(Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) throws Exception Description copied from class:EnvironmentCommandRuns the command with the givenEnvironmentandConfiguration.- Specified by:
runin classEnvironmentCommand<T extends Configuration>- Parameters:
environment- the configured environmentnamespace- the parsed command line namespaceconfiguration- the configuration object- Throws:
Exception- if something goes wrong
-