@UsesSunHttpServer public class SimpleHttpServerFactoryBean extends 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>)| 构造器和说明 |
|---|
SimpleHttpServerFactoryBean() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
com.sun.net.httpserver.HttpServer |
getObject() |
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(Map<String,com.sun.net.httpserver.HttpHandler> contexts)
Register
HttpHandlers
for specific context paths. |
void |
setExecutor(Executor executor)
Set the JDK concurrent executor to use for dispatching incoming requests.
|
void |
setFilters(List<com.sun.net.httpserver.Filter> filters)
Register common
Filters to be
applied to all locally registered contexts. |
void |
setHostname(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(String hostname)
public void setBacklog(int backlog)
public void setShutdownDelay(int shutdownDelay)
public void setExecutor(Executor executor)
HttpServer.setExecutor(java.util.concurrent.Executor)public void setContexts(Map<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.SimpleHessianServiceExporterpublic void setFilters(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 IOException
afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBeanIOExceptionpublic com.sun.net.httpserver.HttpServer getObject()
getObject 在接口中 org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public Class<? extends com.sun.net.httpserver.HttpServer> getObjectType()
getObjectType 在接口中 org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public boolean isSingleton()
isSingleton 在接口中 org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>public void destroy()
destroy 在接口中 org.springframework.beans.factory.DisposableBean