spring-context

org.springframework.remoting.support
Class SimpleHttpServerFactoryBean

java.lang.Object
  extended by org.springframework.remoting.support.SimpleHttpServerFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>, org.springframework.beans.factory.InitializingBean

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.

Since:
2.5.1
Author:
Juergen Hoeller, Arjen Poutsma
See Also:
setPort(int), setContexts(java.util.Map)

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
SimpleHttpServerFactoryBean()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

SimpleHttpServerFactoryBean

public SimpleHttpServerFactoryBean()
Method Detail

setPort

public void setPort(int port)
Specify the HTTP server's port. Default is 8080.


setHostname

public void setHostname(java.lang.String hostname)
Specify the HTTP server's hostname to bind to. Default is localhost; can be overridden with a specific network address to bind to.


setBacklog

public void setBacklog(int backlog)
Specify the HTTP server's TCP backlog. Default is -1, indicating the system's default value.


setShutdownDelay

public void setShutdownDelay(int shutdownDelay)
Specify the number of seconds to wait until HTTP exchanges have completed when shutting down the HTTP server. Default is 0.


setExecutor

public void setExecutor(java.util.concurrent.Executor executor)
Set the JDK concurrent executor to use for dispatching incoming requests.

See Also:
HttpServer.setExecutor(java.util.concurrent.Executor)

setContexts

public void setContexts(java.util.Map<java.lang.String,com.sun.net.httpserver.HttpHandler> contexts)
Register HttpHandlers for specific context paths.

Parameters:
contexts - a Map with context paths as keys and HttpHandler objects as values
See Also:
org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter, org.springframework.remoting.caucho.SimpleHessianServiceExporter, org.springframework.remoting.caucho.SimpleBurlapServiceExporter

setFilters

public void setFilters(java.util.List<com.sun.net.httpserver.Filter> filters)
Register common Filters to be applied to all locally registered contexts.


setAuthenticator

public void setAuthenticator(com.sun.net.httpserver.Authenticator authenticator)
Register a common Authenticator to be applied to all locally registered contexts.


afterPropertiesSet

public void afterPropertiesSet()
                        throws java.io.IOException
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.io.IOException

getObject

public com.sun.net.httpserver.HttpServer getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>

getObjectType

public java.lang.Class<? extends com.sun.net.httpserver.HttpServer> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<com.sun.net.httpserver.HttpServer>

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean

spring-context