com.caucho.resin
Class ResinEmbed

java.lang.Object
  extended by com.caucho.resin.ResinEmbed

public class ResinEmbed
extends java.lang.Object

Embeddable version of the Resin server.

 ResinEmbed resin = new ResinEmbed();

 HttpEmbed http = new HttpEmbed(8080);
 resin.addPort(http);

 WebAppEmbed webApp = new WebAppEmbed("/foo", "/home/ferg/ws/foo");

 resin.addWebApp(webApp);

 resin.start();

 resin.join();
 


Constructor Summary
ResinEmbed()
          Creates a new resin server.
ResinEmbed(java.lang.String configFile)
          Creates a new resin server.
 
Method Summary
 void addBean(BeanEmbed bean)
          Adds a web bean.
 void addPort(PortEmbed port)
          Adds a port to the server, e.g.
 void addScanRoot()
           
 void addWebApp(WebAppEmbed webApplication)
          Adds a web-app to the server.
 void destroy()
          Destroys the embedded server
protected  void finalize()
           
 void initializeEnvironment()
          Initialize the Resin environment
 void join()
          Waits for the Resin process to exit.
static void main(java.lang.String[] args)
          Basic embedding server.
 void removeWebApp(WebAppEmbed webApplication)
           
 void request(java.io.InputStream is, java.io.OutputStream os)
          Sends a HTTP request to the embedded server for testing.
 java.lang.String request(java.lang.String httpRequest)
          Sends a HTTP request to the embedded server for testing.
 void request(java.lang.String httpRequest, java.io.OutputStream os)
          Sends a HTTP request to the embedded server for testing.
 void resetLogManager()
          Set log handler
 void setConfig(java.lang.String configFile)
          Sets the config file
 void setDevelopmentMode(boolean isDevelopment)
           
 void setPorts(PortEmbed[] ports)
          Sets a list of ports.
 void setRootDirectory(java.lang.String rootUrl)
          Sets the root directory
 void setServerHeader(java.lang.String serverName)
          Sets the server header
 void setWebApps(WebAppEmbed[] webApps)
          Sets a list of webapps
 void start()
          Starts the embedded server
 void stop()
          Stops the embedded server
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResinEmbed

public ResinEmbed()
Creates a new resin server.


ResinEmbed

public ResinEmbed(java.lang.String configFile)
Creates a new resin server.

Method Detail

setRootDirectory

public void setRootDirectory(java.lang.String rootUrl)
Sets the root directory


setConfig

public void setConfig(java.lang.String configFile)
Sets the config file


addPort

public void addPort(PortEmbed port)
Adds a port to the server, e.g. a HTTP port.

Parameters:
port - the embedded port to add to the server

setPorts

public void setPorts(PortEmbed[] ports)
Sets a list of ports.


setServerHeader

public void setServerHeader(java.lang.String serverName)
Sets the server header


addWebApp

public void addWebApp(WebAppEmbed webApplication)
Adds a web-app to the server.


removeWebApp

public void removeWebApp(WebAppEmbed webApplication)

setWebApps

public void setWebApps(WebAppEmbed[] webApps)
Sets a list of webapps


addBean

public void addBean(BeanEmbed bean)
Adds a web bean.


setDevelopmentMode

public void setDevelopmentMode(boolean isDevelopment)

initializeEnvironment

public void initializeEnvironment()
Initialize the Resin environment


resetLogManager

public void resetLogManager()
Set log handler


addScanRoot

public void addScanRoot()

start

public void start()
Starts the embedded server


stop

public void stop()
Stops the embedded server


join

public void join()
Waits for the Resin process to exit.


destroy

public void destroy()
Destroys the embedded server


request

public void request(java.io.InputStream is,
                    java.io.OutputStream os)
             throws java.io.IOException
Sends a HTTP request to the embedded server for testing.

Parameters:
is - input stream containing the HTTP request
os - output stream to receive the request
Throws:
java.io.IOException

request

public void request(java.lang.String httpRequest,
                    java.io.OutputStream os)
             throws java.io.IOException
Sends a HTTP request to the embedded server for testing.

Parameters:
httpRequest - HTTP request string, e.g. "GET /test.jsp"
os - output stream to receive the request
Throws:
java.io.IOException

request

public java.lang.String request(java.lang.String httpRequest)
                         throws java.io.IOException
Sends a HTTP request to the embedded server for testing.

Parameters:
httpRequest - HTTP request string, e.g. "GET /test.jsp"
Returns:
the HTTP result string
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Basic embedding server.

Throws:
java.lang.Exception