public abstract class AbstractServletWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableServletWebServerFactory
ConfigurableServletWebServerFactory
implementations.Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
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.
|
Jsp |
getJsp() |
Map<Locale,Charset> |
getLocaleCharsetMappings()
Return the Locale to Charset mappings.
|
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
File |
getSessionStoreDir() |
int |
getSessionTimeout()
Return the session timeout in seconds.
|
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 |
isPersistSession() |
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 |
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 |
setPersistSession(boolean persistSession)
Sets if session data should be persisted between restarts.
|
void |
setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered.
|
void |
setSessionStoreDir(File sessionStoreDir)
Set the directory used to store serialized session data.
|
void |
setSessionTimeout(int sessionTimeout)
The session timeout in seconds (default 30 minutes).
|
void |
setSessionTimeout(int sessionTimeout,
TimeUnit timeUnit)
The session timeout in the specified
TimeUnit (default 30 minutes). |
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, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProvider
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProvider
addErrorPages
getWebServer
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 int getSessionTimeout()
public void setSessionTimeout(int sessionTimeout)
ConfigurableServletWebServerFactory
setSessionTimeout
in interface ConfigurableServletWebServerFactory
sessionTimeout
- the session timeoutpublic void setSessionTimeout(int sessionTimeout, TimeUnit timeUnit)
ConfigurableServletWebServerFactory
TimeUnit
(default 30 minutes). If 0 or
negative then sessions never expire.setSessionTimeout
in interface ConfigurableServletWebServerFactory
sessionTimeout
- the session timeouttimeUnit
- the time unitpublic boolean isPersistSession()
public void setPersistSession(boolean persistSession)
ConfigurableServletWebServerFactory
setPersistSession
in interface ConfigurableServletWebServerFactory
persistSession
- true
if session data should be persistedpublic File getSessionStoreDir()
public void setSessionStoreDir(File sessionStoreDir)
ConfigurableServletWebServerFactory
setSessionStoreDir
in interface ConfigurableServletWebServerFactory
sessionStoreDir
- the directory or null
to use a default location.public boolean isRegisterDefaultServlet()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableServletWebServerFactory
true
so that
files from the document root
will be served.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 Map<Locale,Charset> getLocaleCharsetMappings()
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
ConfigurableServletWebServerFactory
setLocaleCharsetMappings
in interface ConfigurableServletWebServerFactory
localeCharsetMappings
- the Locale to Charset mappingsprotected 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)
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.