@UsesSunHttpServer
public class SimpleHttpServerFactoryBean
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
FactoryBean that creates a simple
HTTP server, based on the HTTP server that is included in Sun's JRE 1.6.
Starts the HTTP server on initialization and stops it on destruction.
Exposes the resulting HttpServer object.
Allows for registering HttpHandlers
for specific context paths. Alternatively,
register such context-specific handlers programmatically on the
HttpServer itself.
setPort(int),
setContexts(java.util.Map<java.lang.String, com.sun.net.httpserver.HttpHandler>)| Constructor and Description |
|---|
SimpleHttpServerFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
com.sun.net.httpserver.HttpServer |
getObject() |
java.lang.Class<? extends com.sun.net.httpserver.HttpServer> |
getObjectType() |
boolean |
isSingleton() |
void |
setAuthenticator(com.sun.net.httpserver.Authenticator authenticator)
Register a common
Authenticator to be
applied to all locally registered contexts. |
void |
setBacklog(int backlog)
Specify the HTTP server's TCP backlog.
|
void |
setContexts(java.util.Map<java.lang.String,com.sun.net.httpserver.HttpHandler> contexts)
Register
HttpHandlers
for specific context paths. |
void |
setExecutor(java.util.concurrent.Executor executor)
Set the JDK concurrent executor to use for dispatching incoming requests.
|
void |
setFilters(java.util.List<com.sun.net.httpserver.Filter> filters)
Register common
Filters to be
applied to all locally registered contexts. |
void |
setHostname(java.lang.String hostname)
Specify the HTTP server's hostname to bind to.
|
void |
setPort(int port)
Specify the HTTP server's port.
|
void |
setShutdownDelay(int shutdownDelay)
Specify the number of seconds to wait until HTTP exchanges have
completed when shutting down the HTTP server.
|
protected final Log logger
public void setPort(int port)
public void setHostname(java.lang.String hostname)
public void setBacklog(int backlog)
public void setShutdownDelay(int shutdownDelay)
public void setExecutor(java.util.concurrent.Executor executor)
HttpServer.setExecutor(java.util.concurrent.Executor)public void setContexts(java.util.Map<java.lang.String,com.sun.net.httpserver.HttpHandler> contexts)
HttpHandlers
for specific context paths.contexts - a Map with context paths as keys and HttpHandler
objects as valuesorg.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter,
org.springframework.remoting.caucho.SimpleHessianServiceExporter,
org.springframework.remoting.caucho.SimpleBurlapServiceExporterpublic void setFilters(java.util.List<com.sun.net.httpserver.Filter> filters)
Filters to be
applied to all locally registered contexts.public void setAuthenticator(com.sun.net.httpserver.Authenticator authenticator)
Authenticator to be
applied to all locally registered contexts.public void afterPropertiesSet()
throws java.io.IOException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.io.IOExceptionpublic com.sun.net.httpserver.HttpServer getObject()
getObject in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public java.lang.Class<? extends com.sun.net.httpserver.HttpServer> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean