spring-framework / org.springframework.remoting.support / SimpleHttpServerFactoryBean

SimpleHttpServerFactoryBean

@UsesSunHttpServer open class SimpleHttpServerFactoryBean : FactoryBean<HttpServer>, InitializingBean, DisposableBean

org.springframework.beans.factory.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 com.sun.net.httpserver.HttpServer object.

Allows for registering com.sun.net.httpserver.HttpHandler for specific context paths. Alternatively, register such context-specific handlers programmatically on the com.sun.net.httpserver.HttpServer itself.

Author
Juergen Hoeller

Author
Arjen Poutsma

Since
2.5.1

See Also
#setPort#setContexts

Constructors

<init>

SimpleHttpServerFactoryBean()

org.springframework.beans.factory.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 com.sun.net.httpserver.HttpServer object.

Allows for registering com.sun.net.httpserver.HttpHandler for specific context paths. Alternatively, register such context-specific handlers programmatically on the com.sun.net.httpserver.HttpServer itself.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

destroy

open fun destroy(): Unit

getObject

open fun getObject(): HttpServer

getObjectType

open fun getObjectType(): Class<out HttpServer>

isSingleton

open fun isSingleton(): Boolean

setAuthenticator

open fun setAuthenticator(authenticator: Authenticator): Unit

Register a common com.sun.net.httpserver.Authenticator to be applied to all locally registered contexts.

setBacklog

open fun setBacklog(backlog: Int): Unit

Specify the HTTP server's TCP backlog. Default is -1, indicating the system's default value.

setContexts

open fun setContexts(contexts: MutableMap<String, HttpHandler>): Unit

Register com.sun.net.httpserver.HttpHandler for specific context paths.

setExecutor

open fun setExecutor(executor: Executor): Unit

Set the JDK concurrent executor to use for dispatching incoming requests.

setFilters

open fun setFilters(filters: MutableList<Filter>): Unit

Register common com.sun.net.httpserver.Filter to be applied to all locally registered contexts.

setHostname

open fun setHostname(hostname: String): Unit

Specify the HTTP server's hostname to bind to. Default is localhost; can be overridden with a specific network address to bind to.

setPort

open fun setPort(port: Int): Unit

Specify the HTTP server's port. Default is 8080.

setShutdownDelay

open fun setShutdownDelay(shutdownDelay: Int): Unit

Specify the number of seconds to wait until HTTP exchanges have completed when shutting down the HTTP server. Default is 0.