com.faunos.util.net.http
Class Caroon

java.lang.Object
  extended by com.faunos.util.net.HandletServer
      extended by com.faunos.util.net.http.HttpServer
          extended by com.faunos.util.net.http.Caroon
All Implemented Interfaces:
ResponseFactoryConfig
Direct Known Subclasses:
SkwishHttpServer

public class Caroon
extends HttpServer
implements ResponseFactoryConfig

The Caroon HTTP server.

Author:
Babak Farhang
See Also:
ResponseFactoryConfig

Field Summary
protected  ResponseFactorySwitch factorySwitch
           
 
Fields inherited from class com.faunos.util.net.http.HttpServer
app
 
Fields inherited from class com.faunos.util.net.HandletServer
logger
 
Constructor Summary
  Caroon(InetAddress host, int port, ExecutorService exec)
           
  Caroon(InetAddress host, int port, ExecutorService exec, Logger logger)
           
  Caroon(int port)
           
protected Caroon(ResponseFactorySwitch factory, InetAddress host, int port, ExecutorService exec, Logger logger)
           
 
Method Summary
 ResponseFactory addMapping(String path, ResponseFactory factory)
          Adds the given URI path-to-factory mapping to the current mappings and returns the previous mapped factory, if any.
 void addMappings(Map<String,ResponseFactory> mappings)
          Adds the given URI path-to-factory mappings to the current mappings.
 ResponseFactory getMapping(String path)
          Returns the ResponseFactory mapped to the specified path, or null, if nothing is mapped to that path.
 SortedMap<String,ResponseFactory> getMappings()
          Returns a read-only snapshot of the current path-to-factory mappings.
 ResponseFactory removeMapping(String path)
          Removes the mapping for specified path and returns the old mapped ResponseFactory, if any; null otherwise.
 void setMappings(Map<String,ResponseFactory> mappings)
          Sets the URI path-to-factory mappings.
 
Methods inherited from class com.faunos.util.net.http.HttpServer
newHandlet
 
Methods inherited from class com.faunos.util.net.HandletServer
inputChannel, isAlive, outputChannel, setProcessingHintThreshold, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factorySwitch

protected final ResponseFactorySwitch factorySwitch
Constructor Detail

Caroon

public Caroon(int port)
       throws IOException
Throws:
IOException

Caroon

public Caroon(InetAddress host,
              int port,
              ExecutorService exec)
       throws IOException
Throws:
IOException

Caroon

public Caroon(InetAddress host,
              int port,
              ExecutorService exec,
              Logger logger)
       throws IOException
Throws:
IOException

Caroon

protected Caroon(ResponseFactorySwitch factory,
                 InetAddress host,
                 int port,
                 ExecutorService exec,
                 Logger logger)
          throws IOException
Throws:
IOException
Method Detail

setMappings

public void setMappings(Map<String,ResponseFactory> mappings)
Description copied from interface: ResponseFactoryConfig
Sets the URI path-to-factory mappings.

Specified by:
setMappings in interface ResponseFactoryConfig

getMappings

public SortedMap<String,ResponseFactory> getMappings()
Description copied from interface: ResponseFactoryConfig
Returns a read-only snapshot of the current path-to-factory mappings.

Specified by:
getMappings in interface ResponseFactoryConfig

addMappings

public void addMappings(Map<String,ResponseFactory> mappings)
Description copied from interface: ResponseFactoryConfig
Adds the given URI path-to-factory mappings to the current mappings.

Specified by:
addMappings in interface ResponseFactoryConfig

addMapping

public ResponseFactory addMapping(String path,
                                  ResponseFactory factory)
Description copied from interface: ResponseFactoryConfig
Adds the given URI path-to-factory mapping to the current mappings and returns the previous mapped factory, if any.

Specified by:
addMapping in interface ResponseFactoryConfig

removeMapping

public ResponseFactory removeMapping(String path)
Description copied from interface: ResponseFactoryConfig
Removes the mapping for specified path and returns the old mapped ResponseFactory, if any; null otherwise. To atomically remove multiple mappings, use ResponseFactoryConfig.getMappings() in combination with ResponseFactoryConfig.setMappings(Map).

Specified by:
removeMapping in interface ResponseFactoryConfig

getMapping

public ResponseFactory getMapping(String path)
Description copied from interface: ResponseFactoryConfig
Returns the ResponseFactory mapped to the specified path, or null, if nothing is mapped to that path.

Specified by:
getMapping in interface ResponseFactoryConfig


SourceForge.net Logo