public abstract class AbstractServletWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableServletWebServerFactory
ConfigurableServletWebServerFactory
implementations.Constructor and Description |
---|
AbstractServletWebServerFactory()
Create a new
AbstractServletWebServerFactory instance. |
AbstractServletWebServerFactory(int port)
Create a new
AbstractServletWebServerFactory instance with the specified
port. |
AbstractServletWebServerFactory(String contextPath,
int port)
Create a new
AbstractServletWebServerFactory instance with the specified
context path and port. |
Modifier and Type | Method and Description |
---|---|
void |
addInitializers(ServletContextInitializer... initializers)
Add
ServletContextInitializer s to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
String |
getContextPath()
Returns the context path for the web server.
|
String |
getDisplayName() |
File |
getDocumentRoot()
Returns the document root which will be used by the web context to serve static
files.
|
Map<String,String> |
getInitParameters() |
Jsp |
getJsp() |
Map<Locale,Charset> |
getLocaleCharsetMappings()
Return the Locale to Charset mappings.
|
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
Session |
getSession() |
protected List<URL> |
getUrlsOfJarsWithMetaInfResources() |
protected File |
getValidDocumentRoot()
Returns the absolute document root when it points to a valid directory, logging a
warning and returning
null otherwise. |
protected File |
getValidSessionStoreDir() |
protected File |
getValidSessionStoreDir(boolean mkdirs) |
boolean |
isRegisterDefaultServlet()
Flag to indicate that the default servlet should be registered.
|
protected ServletContextInitializer[] |
mergeInitializers(ServletContextInitializer... initializers)
Utility method that can be used by subclasses wishing to combine the specified
ServletContextInitializer parameters with those defined in this instance. |
void |
setContextPath(String contextPath)
Sets the context path for the web server.
|
void |
setDisplayName(String displayName)
Sets the display name of the application deployed in the web server.
|
void |
setDocumentRoot(File documentRoot)
Sets the document root directory which will be used by the web context to serve
static files.
|
void |
setInitializers(List<? extends ServletContextInitializer> initializers)
Sets
ServletContextInitializer that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
void |
setInitParameters(Map<String,String> initParameters)
Sets the init parameters that are applied to the container's
ServletContext . |
void |
setJsp(Jsp jsp)
Sets the configuration that will be applied to the server's JSP servlet.
|
void |
setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
Sets the Locale to Charset mappings.
|
void |
setMimeMappings(MimeMappings mimeMappings)
Sets the mime-type mappings.
|
void |
setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered.
|
void |
setSession(Session session)
Sets the configuration that will be applied to the container's HTTP session
support.
|
protected boolean |
shouldRegisterJspServlet()
Returns whether or not the JSP servlet should be registered with the web server.
|
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getShutdown, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
addErrorPages
getWebServer
protected final Log logger
public AbstractServletWebServerFactory()
AbstractServletWebServerFactory
instance.public AbstractServletWebServerFactory(int port)
AbstractServletWebServerFactory
instance with the specified
port.port
- the port number for the web serverpublic AbstractServletWebServerFactory(String contextPath, int port)
AbstractServletWebServerFactory
instance with the specified
context path and port.contextPath
- the context path for the web serverport
- the port number for the web serverpublic String getContextPath()
public void setContextPath(String contextPath)
ConfigurableServletWebServerFactory
setContextPath
in interface ConfigurableServletWebServerFactory
contextPath
- the contextPath to setpublic String getDisplayName()
public void setDisplayName(String displayName)
ConfigurableServletWebServerFactory
setDisplayName
in interface ConfigurableServletWebServerFactory
displayName
- the displayName to setpublic boolean isRegisterDefaultServlet()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableServletWebServerFactory
false
since
2.4.setRegisterDefaultServlet
in interface ConfigurableServletWebServerFactory
registerDefaultServlet
- if the default servlet should be registeredpublic MimeMappings getMimeMappings()
public void setMimeMappings(MimeMappings mimeMappings)
ConfigurableServletWebServerFactory
setMimeMappings
in interface ConfigurableServletWebServerFactory
mimeMappings
- the mime type mappings (defaults to
MimeMappings.DEFAULT
)public File getDocumentRoot()
public void setDocumentRoot(File documentRoot)
ConfigurableServletWebServerFactory
setDocumentRoot
in interface ConfigurableServletWebServerFactory
documentRoot
- the document root or null
if not requiredpublic void setInitializers(List<? extends ServletContextInitializer> initializers)
ConfigurableServletWebServerFactory
ServletContextInitializer
that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.setInitializers
in interface ConfigurableServletWebServerFactory
initializers
- the initializers to setConfigurableServletWebServerFactory.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)
public void addInitializers(ServletContextInitializer... initializers)
ConfigurableServletWebServerFactory
ServletContextInitializer
s to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.addInitializers
in interface ConfigurableServletWebServerFactory
initializers
- the initializers to addConfigurableServletWebServerFactory.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)
public Jsp getJsp()
public void setJsp(Jsp jsp)
ConfigurableServletWebServerFactory
setJsp
in interface ConfigurableServletWebServerFactory
jsp
- the JSP servlet configurationpublic Session getSession()
public void setSession(Session session)
ConfigurableServletWebServerFactory
setSession
in interface ConfigurableServletWebServerFactory
session
- the session configurationpublic Map<Locale,Charset> getLocaleCharsetMappings()
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
ConfigurableServletWebServerFactory
setLocaleCharsetMappings
in interface ConfigurableServletWebServerFactory
localeCharsetMappings
- the Locale to Charset mappingspublic void setInitParameters(Map<String,String> initParameters)
ConfigurableServletWebServerFactory
ServletContext
.setInitParameters
in interface ConfigurableServletWebServerFactory
initParameters
- the init parametersprotected final ServletContextInitializer[] mergeInitializers(ServletContextInitializer... initializers)
ServletContextInitializer
parameters with those defined in this instance.initializers
- the initializers to mergeprotected boolean shouldRegisterJspServlet()
true
if the servlet should be registered, otherwise false
protected final File getValidDocumentRoot()
null
otherwise.protected final File getValidSessionStoreDir()
protected final File getValidSessionStoreDir(boolean mkdirs)