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
- theConfiguration
subclass which is loaded from the configuration file
public class ServerCommand<T extends Configuration> extends EnvironmentCommand<T>
Runs an application as an HTTP server.
-
-
Constructor Summary
Constructors Modifier Constructor Description ServerCommand(Application<T> application)
protected
ServerCommand(Application<T> application, String name, String description)
A constructor to allow reuse of the server command as a different name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<T>
getConfigurationClass()
Returns theClass
of the configuration type.protected void
run(Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration)
Runs the command with the givenEnvironment
andConfiguration
.-
Methods inherited from class io.dropwizard.core.cli.EnvironmentCommand
getEnvironment, run
-
Methods inherited from class io.dropwizard.core.cli.ConfiguredCommand
addFileArgument, cleanup, cleanupAsynchronously, configure, getConfiguration, run
-
Methods inherited from class io.dropwizard.core.cli.Command
getDescription, getName, onError
-
-
-
-
Constructor Detail
-
ServerCommand
public ServerCommand(Application<T> application)
-
ServerCommand
protected ServerCommand(Application<T> application, String name, String description)
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 Detail
-
getConfigurationClass
protected Class<T> getConfigurationClass()
Description copied from class:ConfiguredCommand
Returns theClass
of the configuration type.- Overrides:
getConfigurationClass
in classConfiguredCommand<T extends Configuration>
- Returns:
- the
Class
of the configuration type
-
run
protected void run(Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) throws Exception
Description copied from class:EnvironmentCommand
Runs the command with the givenEnvironment
andConfiguration
.- Specified by:
run
in classEnvironmentCommand<T extends Configuration>
- Parameters:
environment
- the configured environmentnamespace
- the parsed command line namespaceconfiguration
- the configuration object- Throws:
Exception
- if something goes wrong
-
-