public abstract class AbstractConfigurableEmbeddedServletContainer extends Object implements ConfigurableEmbeddedServletContainer
ConfigurableEmbeddedServletContainer
implementations.AbstractEmbeddedServletContainerFactory
Constructor and Description |
---|
AbstractConfigurableEmbeddedServletContainer()
Create a new
AbstractConfigurableEmbeddedServletContainer instance. |
AbstractConfigurableEmbeddedServletContainer(int port)
Create a new
AbstractConfigurableEmbeddedServletContainer instance with the
specified port. |
AbstractConfigurableEmbeddedServletContainer(String contextPath,
int port)
Create a new
AbstractConfigurableEmbeddedServletContainer instance with the
specified context path and port. |
Modifier and Type | Method and Description |
---|---|
void |
addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.
|
void |
addInitializers(ServletContextInitializer... initializers)
Add
ServletContextInitializer s to those that should be applied in addition
to
EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters. |
InetAddress |
getAddress()
Return the address that the embedded container binds to.
|
Compression |
getCompression() |
String |
getContextPath()
Returns the context path for the embedded servlet container.
|
String |
getDisplayName() |
File |
getDocumentRoot()
Returns the document root which will be used by the web context to serve static
files.
|
Set<ErrorPage> |
getErrorPages()
Returns a mutable set of
ErrorPages that will be used when
handling exceptions. |
JspServlet |
getJspServlet() |
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
int |
getPort()
The port that the embedded server listens on.
|
String |
getServerHeader() |
File |
getSessionStoreDir() |
int |
getSessionTimeout()
Return the session timeout in seconds.
|
Ssl |
getSsl() |
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 |
setAddress(InetAddress address)
Sets the specific network address that the server should bind to.
|
void |
setCompression(Compression compression)
Sets the compression configuration that will be applied to the container's default
connector.
|
void |
setContextPath(String contextPath)
Sets the context path for the embedded servlet container.
|
void |
setDisplayName(String displayName)
Sets the display name of the application deployed in the embedded servlet
container.
|
void |
setDocumentRoot(File documentRoot)
Sets the document root directory which will be used by the web context to serve
static files.
|
void |
setErrorPages(Set<ErrorPage> errorPages)
Sets the error pages that will be used when handling exceptions.
|
void |
setInitializers(List<? extends ServletContextInitializer> initializers)
Sets
ServletContextInitializer that should be applied in addition to
EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters. |
void |
setJspServlet(JspServlet jspServlet)
Sets the configuration that will be applied to the container's JSP servlet.
|
void |
setJspServletClassName(String jspServletClassName)
The class name for the jsp servlet if used.
|
void |
setMimeMappings(MimeMappings mimeMappings)
Sets the mime-type mappings.
|
void |
setPersistSession(boolean persistSession)
Sets if session data should be persisted between restarts.
|
void |
setPort(int port)
Sets the port that the embedded servlet container should listen on.
|
void |
setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered.
|
void |
setRegisterJspServlet(boolean registerJspServlet)
Set if the JspServlet should be registered if it is on the classpath.
|
void |
setServerHeader(String serverHeader)
Sets the server header value.
|
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). |
void |
setSsl(Ssl ssl)
Sets the SSL configuration that will be applied to the container's default
connector.
|
protected boolean |
shouldRegisterJspServlet()
Returns whether or not the JSP servlet should be registered with the embedded
container.
|
public AbstractConfigurableEmbeddedServletContainer()
AbstractConfigurableEmbeddedServletContainer
instance.public AbstractConfigurableEmbeddedServletContainer(int port)
AbstractConfigurableEmbeddedServletContainer
instance with the
specified port.port
- the port number for the embedded servlet containerpublic AbstractConfigurableEmbeddedServletContainer(String contextPath, int port)
AbstractConfigurableEmbeddedServletContainer
instance with the
specified context path and port.contextPath
- the context path for the embedded servlet containerport
- the port number for the embedded servlet containerpublic void setContextPath(String contextPath)
ConfigurableEmbeddedServletContainer
setContextPath
in interface ConfigurableEmbeddedServletContainer
contextPath
- the contextPath to setpublic String getContextPath()
public void setDisplayName(String displayName)
ConfigurableEmbeddedServletContainer
setDisplayName
in interface ConfigurableEmbeddedServletContainer
displayName
- the displayName to setpublic String getDisplayName()
public void setPort(int port)
ConfigurableEmbeddedServletContainer
setPort
in interface ConfigurableEmbeddedServletContainer
port
- the port to setpublic int getPort()
public void setAddress(InetAddress address)
ConfigurableEmbeddedServletContainer
setAddress
in interface ConfigurableEmbeddedServletContainer
address
- the address to set (defaults to null
)public InetAddress getAddress()
public void setSessionTimeout(int sessionTimeout)
ConfigurableEmbeddedServletContainer
setSessionTimeout
in interface ConfigurableEmbeddedServletContainer
sessionTimeout
- the session timeoutpublic void setSessionTimeout(int sessionTimeout, TimeUnit timeUnit)
ConfigurableEmbeddedServletContainer
TimeUnit
(default 30 minutes). If 0 or
negative then sessions never expire.setSessionTimeout
in interface ConfigurableEmbeddedServletContainer
sessionTimeout
- the session timeouttimeUnit
- the time unitpublic int getSessionTimeout()
public void setPersistSession(boolean persistSession)
ConfigurableEmbeddedServletContainer
setPersistSession
in interface ConfigurableEmbeddedServletContainer
persistSession
- true
if session data should be persistedpublic boolean isPersistSession()
public void setSessionStoreDir(File sessionStoreDir)
ConfigurableEmbeddedServletContainer
setSessionStoreDir
in interface ConfigurableEmbeddedServletContainer
sessionStoreDir
- the directory or null
to use a default location.public File getSessionStoreDir()
public void setInitializers(List<? extends ServletContextInitializer> initializers)
ConfigurableEmbeddedServletContainer
ServletContextInitializer
that should be applied in addition to
EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.setInitializers
in interface ConfigurableEmbeddedServletContainer
initializers
- the initializers to setConfigurableEmbeddedServletContainer.addInitializers(org.springframework.boot.context.embedded.ServletContextInitializer...)
public void addInitializers(ServletContextInitializer... initializers)
ConfigurableEmbeddedServletContainer
ServletContextInitializer
s to those that should be applied in addition
to
EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters.addInitializers
in interface ConfigurableEmbeddedServletContainer
initializers
- the initializers to addConfigurableEmbeddedServletContainer.setInitializers(java.util.List<? extends org.springframework.boot.context.embedded.ServletContextInitializer>)
public void setDocumentRoot(File documentRoot)
ConfigurableEmbeddedServletContainer
setDocumentRoot
in interface ConfigurableEmbeddedServletContainer
documentRoot
- the document root or null
if not requiredpublic File getDocumentRoot()
public void setErrorPages(Set<ErrorPage> errorPages)
ConfigurableEmbeddedServletContainer
setErrorPages
in interface ConfigurableEmbeddedServletContainer
errorPages
- the error pagespublic void addErrorPages(ErrorPage... errorPages)
ConfigurableEmbeddedServletContainer
addErrorPages
in interface ConfigurableEmbeddedServletContainer
errorPages
- the error pagespublic Set<ErrorPage> getErrorPages()
ErrorPages
that will be used when
handling exceptions.public void setMimeMappings(MimeMappings mimeMappings)
ConfigurableEmbeddedServletContainer
setMimeMappings
in interface ConfigurableEmbeddedServletContainer
mimeMappings
- the mime type mappings (defaults to
MimeMappings.DEFAULT
)public MimeMappings getMimeMappings()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableEmbeddedServletContainer
true
so that
files from the document root
will be served.setRegisterDefaultServlet
in interface ConfigurableEmbeddedServletContainer
registerDefaultServlet
- if the default servlet should be registeredpublic void setRegisterJspServlet(boolean registerJspServlet)
ConfigurableEmbeddedServletContainer
true
so that files from the document root
will be served.setRegisterJspServlet
in interface ConfigurableEmbeddedServletContainer
registerJspServlet
- if the JSP servlet should be registeredConfigurableEmbeddedServletContainer.setJspServlet(org.springframework.boot.context.embedded.JspServlet)
,
JspServlet.setRegistered(boolean)
public boolean isRegisterDefaultServlet()
public void setSsl(Ssl ssl)
ConfigurableEmbeddedServletContainer
setSsl
in interface ConfigurableEmbeddedServletContainer
ssl
- the SSL configurationpublic Ssl getSsl()
public void setJspServletClassName(String jspServletClassName)
ConfigurableEmbeddedServletContainer
registerJspServlet
is true and this
class is on the classpath then it will be registered. Since both Tomcat and Jetty
use Jasper for their JSP implementation the default is
org.apache.jasper.servlet.JspServlet
.setJspServletClassName
in interface ConfigurableEmbeddedServletContainer
jspServletClassName
- the class name for the JSP servlet if usedConfigurableEmbeddedServletContainer.setJspServlet(org.springframework.boot.context.embedded.JspServlet)
,
JspServlet.setClassName(String)
public void setJspServlet(JspServlet jspServlet)
ConfigurableEmbeddedServletContainer
setJspServlet
in interface ConfigurableEmbeddedServletContainer
jspServlet
- the JSP servlet configurationpublic JspServlet getJspServlet()
public Compression getCompression()
public void setCompression(Compression compression)
ConfigurableEmbeddedServletContainer
setCompression
in interface ConfigurableEmbeddedServletContainer
compression
- the compression configurationpublic String getServerHeader()
public void setServerHeader(String serverHeader)
ConfigurableEmbeddedServletContainer
setServerHeader
in interface ConfigurableEmbeddedServletContainer
serverHeader
- the server header valueprotected final ServletContextInitializer[] mergeInitializers(ServletContextInitializer... initializers)
ServletContextInitializer
parameters with those defined in this instance.initializers
- the initializers to mergeprotected boolean shouldRegisterJspServlet()
true
if the container should be registered, otherwise false
Copyright © 2015 Pivotal Software, Inc.. All rights reserved.