org.springframework.boot.context.embedded
Interface ConfigurableEmbeddedServletContainerFactory

All Superinterfaces:
EmbeddedServletContainerFactory
All Known Implementing Classes:
AbstractEmbeddedServletContainerFactory, JettyEmbeddedServletContainerFactory, TomcatEmbeddedServletContainerFactory

public interface ConfigurableEmbeddedServletContainerFactory
extends EmbeddedServletContainerFactory

Simple interface that represents customizations to an EmbeddedServletContainerFactory.

Author:
Dave Syer
See Also:
EmbeddedServletContainerFactory

Method Summary
 void addErrorPages(ErrorPage... errorPages)
          Adds error pages that will be used when handling exceptions.
 void addInitializers(ServletContextInitializer... initializers)
          Add ServletContextInitializers to those that should be applied in addition to EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...) parameters.
 int getPort()
          The port that the embedded server listens on.
 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).
 
Methods inherited from interface org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
getEmbeddedServletContainer
 

Method Detail

setContextPath

void setContextPath(String contextPath)
Sets the context path for the embedded servlet container. The context should start with a "/" character but not end with a "/" character. The default context path can be specified using an empty string.

Parameters:
contextPath - the contextPath to set

setPort

void setPort(int port)
Sets the port that the embedded servlet container should listen on. If not specified port '8080' will be used. Use port 0 to switch off the server completely.

Parameters:
port - the port to set

getPort

int getPort()
The port that the embedded server listens on.

Returns:
the port

setSessionTimeout

void setSessionTimeout(int sessionTimeout)
The session timeout in seconds (default 30). If 0 or negative then sessions never expire.

Parameters:
sessionTimeout - the session timeout

setSessionTimeout

void setSessionTimeout(int sessionTimeout,
                       TimeUnit timeUnit)
The session timeout in the specified TimeUnit (default 30 seconds). If 0 or negative then sessions never expire.

Parameters:
sessionTimeout - the session timeout
timeUnit - the time unit

setAddress

void setAddress(InetAddress address)
Sets the specific network address that the server should bind to.

Parameters:
address - the address to set (defaults to null)

setJspServletClassName

void setJspServletClassName(String jspServletClassName)
The class name for the jsp servlet if used. If 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.

Parameters:
jspServletClassName - the class name for the JSP servlet if used

setRegisterJspServlet

void setRegisterJspServlet(boolean registerJspServlet)
Set if the JspServlet should be registered if it is on the classpath. Defaults to true so that files from the document root will be served.

Parameters:
registerJspServlet - if the JSP servlet should be registered

setRegisterDefaultServlet

void setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered. Defaults to true so that files from the document root will be served.

Parameters:
registerDefaultServlet - if the default servlet should be registered

addErrorPages

void addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.

Parameters:
errorPages - the error pages

setErrorPages

void setErrorPages(Set<ErrorPage> errorPages)
Sets the error pages that will be used when handling exceptions.

Parameters:
errorPages - the error pages

setMimeMappings

void setMimeMappings(MimeMappings mimeMappings)
Sets the mime-type mappings.

Parameters:
mimeMappings - the mime type mappings (defaults to MimeMappings.DEFAULT)

setDocumentRoot

void setDocumentRoot(File documentRoot)
Sets the document root folder which will be used by the web context to serve static files.

Parameters:
documentRoot - the document root or null if not required

setInitializers

void setInitializers(List<? extends ServletContextInitializer> initializers)
Sets ServletContextInitializer that should be applied in addition to EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...) parameters. This method will replace any previously set or added initializers.

Parameters:
initializers - the initializers to set
See Also:
addInitializers(org.springframework.boot.context.embedded.ServletContextInitializer...)

addInitializers

void addInitializers(ServletContextInitializer... initializers)
Add ServletContextInitializers to those that should be applied in addition to EmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...) parameters.

Parameters:
initializers - the initializers to add
See Also:
setInitializers(java.util.List)


Copyright © 2013. All Rights Reserved.