Class ServletContainerLauncher
Subclasses should be careful about calling any methods defined on this class or else they risk failing when used with a version of GWT that did not have those methods.
As of GWT 2.13, launcher implementations can be discovered by a service loader. Launchers that
specify a name can be selected by the user via the -server argument to DevMode using
that name instead of their fully qualified class name. Additionally, if only one launcher type
is present on the classpath, it will be used automatically without the need to specify it. As a
result, names should be unique, and projects may wish to take care to avoid allowing more than
one provider at a time on the classpath.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternAllowed names for ServletContainerLauncher instances, to be able to be used with a ServiceLoader. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getName()booleanisSecure()Return true if this servlet container launcher is configured for secure operation (ie, HTTPS).booleanprocessArguments(TreeLogger logger, String arguments) Process any supplied arguments.voidsetBaseRequestLogLevel(TreeLogger.Type baseLogLevel) Specifies the default log level.voidsetBindAddress(String bindAddress) Set the bind address for the web server socket.abstract ServletContainerstart(TreeLogger logger, int port, File appRootDir) Start an embedded HTTP servlet container.
-
Field Details
-
SERVICE_NAME_PATTERN
Allowed names for ServletContainerLauncher instances, to be able to be used with a ServiceLoader. If not registered as a service, the "-server" argument can be used with the class's fully qualified name, and the name property need not follow this pattern.
-
-
Constructor Details
-
ServletContainerLauncher
public ServletContainerLauncher()
-
-
Method Details
-
getIconBytes
public byte[] getIconBytes()- Returns:
- byte array containing an icon (fitting into 24x24) to use for the server, or null if only the name should be used
-
getName
- Returns:
- a short human-readable name of this servlet container, or null if no name
should be displayed. Must match
SERVICE_NAME_PATTERNto be used when loading this server by name.
-
isSecure
public boolean isSecure()Return true if this servlet container launcher is configured for secure operation (ie, HTTPS). This value is only queried after arguments, if any, have been processed.The default implementation just returns false.
- Returns:
- true if HTTPS is in use
-
processArguments
Process any supplied arguments.Will be called before
start(TreeLogger, int, File), if at all.- Parameters:
logger- logger to use for warnings/errorsarguments- single string containing the arguments for this SCL, the format to be defined by the SCL- Returns:
- true if the arguments were processed successfully
-
setBaseRequestLogLevel
Specifies the default log level. Presently DevMode (and JUnitShell) will set this to TRACE when using a RemoteUI implementation, INFO for other implementations.Default implementation does nothing, subclasses are encouraged to use this to configure their own logggers.
-
setBindAddress
Set the bind address for the web server socket.Will be called before
start(TreeLogger, int, File), if at all. If not called, the SCL should listen on all addresses.- Parameters:
bindAddress- host name or IP address, suitable for use withInetAddress.getByName(String)
-
start
public abstract ServletContainer start(TreeLogger logger, int port, File appRootDir) throws BindException, Exception Start an embedded HTTP servlet container.- Parameters:
logger- the server loggerport- the TCP port to serve on; if 0 is requested, a port should be automatically selectedappRootDir- the base WAR directory- Returns:
- the launched servlet container
- Throws:
BindException- if the requested port is already in useException- if the server fails to start for any other reason
-