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
ServletContextInitializers 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, getPort, getServerHeader, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setPort, setServerHeader, setSsl, setSslStoreProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetAddress, setCompression, setErrorPages, setPort, setServerHeader, setSsl, setSslStoreProvideraddErrorPagesgetWebServerpublic 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)
ConfigurableServletWebServerFactorysetContextPath in interface ConfigurableServletWebServerFactorycontextPath - the contextPath to setpublic String getDisplayName()
public void setDisplayName(String displayName)
ConfigurableServletWebServerFactorysetDisplayName in interface ConfigurableServletWebServerFactorydisplayName - the displayName to setpublic int getSessionTimeout()
public void setSessionTimeout(int sessionTimeout)
ConfigurableServletWebServerFactorysetSessionTimeout in interface ConfigurableServletWebServerFactorysessionTimeout - the session timeoutpublic void setSessionTimeout(int sessionTimeout,
TimeUnit timeUnit)
ConfigurableServletWebServerFactoryTimeUnit (default 30 minutes). If 0 or
negative then sessions never expire.setSessionTimeout in interface ConfigurableServletWebServerFactorysessionTimeout - the session timeouttimeUnit - the time unitpublic boolean isPersistSession()
public void setPersistSession(boolean persistSession)
ConfigurableServletWebServerFactorysetPersistSession in interface ConfigurableServletWebServerFactorypersistSession - true if session data should be persistedpublic File getSessionStoreDir()
public void setSessionStoreDir(File sessionStoreDir)
ConfigurableServletWebServerFactorysetSessionStoreDir in interface ConfigurableServletWebServerFactorysessionStoreDir - the directory or null to use a default location.public boolean isRegisterDefaultServlet()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableServletWebServerFactorytrue so that
files from the document root will be served.setRegisterDefaultServlet in interface ConfigurableServletWebServerFactoryregisterDefaultServlet - if the default servlet should be registeredpublic MimeMappings getMimeMappings()
public void setMimeMappings(MimeMappings mimeMappings)
ConfigurableServletWebServerFactorysetMimeMappings in interface ConfigurableServletWebServerFactorymimeMappings - the mime type mappings (defaults to
MimeMappings.DEFAULT)public File getDocumentRoot()
public void setDocumentRoot(File documentRoot)
ConfigurableServletWebServerFactorysetDocumentRoot in interface ConfigurableServletWebServerFactorydocumentRoot - the document root or null if not requiredpublic void setInitializers(List<? extends ServletContextInitializer> initializers)
ConfigurableServletWebServerFactoryServletContextInitializer that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.setInitializers in interface ConfigurableServletWebServerFactoryinitializers - the initializers to setConfigurableServletWebServerFactory.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)public void addInitializers(ServletContextInitializer... initializers)
ConfigurableServletWebServerFactoryServletContextInitializers to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.addInitializers in interface ConfigurableServletWebServerFactoryinitializers - the initializers to addConfigurableServletWebServerFactory.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)public Jsp getJsp()
public void setJsp(Jsp jsp)
ConfigurableServletWebServerFactorysetJsp in interface ConfigurableServletWebServerFactoryjsp - the JSP servlet configurationpublic Map<Locale,Charset> getLocaleCharsetMappings()
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
ConfigurableServletWebServerFactorysetLocaleCharsetMappings in interface ConfigurableServletWebServerFactorylocaleCharsetMappings - 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 falseprotected final File getValidDocumentRoot()
null otherwise.protected final File getValidSessionStoreDir()
protected final File getValidSessionStoreDir(boolean mkdirs)
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.