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() |
String |
getContextPath()
Returns the context path for the embedded servlet container.
|
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
ErrorPage s that will be used when handling
exceptions. |
protected String |
getJspServletClassName() |
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
int |
getPort()
The port that the embedded server listens on.
|
int |
getSessionTimeout() |
Ssl |
getSsl() |
boolean |
isRegisterDefaultServlet()
Flag to indicate that the default servlet should be registered.
|
boolean |
isRegisterJspServlet()
Flag to indicate that the JSP servlet should be registered if available on the
classpath.
|
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 |
setContextPath(String contextPath)
Sets the context path for the embedded servlet container.
|
void |
setDocumentRoot(File documentRoot)
Sets the document root folder 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 |
setJspServletClassName(String jspServletClassName)
The class name for the jsp servlet if used.
|
void |
setMimeMappings(MimeMappings mimeMappings)
Sets the mime-type mappings.
|
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 |
setSessionTimeout(int sessionTimeout)
The session timeout in seconds (default 30).
|
void |
setSessionTimeout(int sessionTimeout,
TimeUnit timeUnit)
The session timeout in the specified
TimeUnit (default 30 seconds). |
void |
setSsl(Ssl ssl)
Sets the SSL configuration that will be applied to the container's default
connector.
|
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 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 seconds). If 0 or
negative then sessions never expire.setSessionTimeout
in interface ConfigurableEmbeddedServletContainer
sessionTimeout
- the session timeouttimeUnit
- the time unitpublic int getSessionTimeout()
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()
ErrorPage
s 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 boolean isRegisterJspServlet()
public 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 registeredpublic boolean isRegisterDefaultServlet()
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 usedpublic void setSsl(Ssl ssl)
ConfigurableEmbeddedServletContainer
setSsl
in interface ConfigurableEmbeddedServletContainer
ssl
- the SSL configurationpublic Ssl getSsl()
protected String getJspServletClassName()
protected final ServletContextInitializer[] mergeInitializers(ServletContextInitializer... initializers)
ServletContextInitializer
parameters with those defined in this instance.initializers
- the initializers to mergeCopyright © 2014 Pivotal Software, Inc.. All rights reserved.