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.
 
Method Summary
 void addBean(BeanEmbed bean)
          Adds a web bean.
 void addPort(PortEmbed port)
          Adds a port to the server, e.g.
 void addWebApp(WebAppEmbed webApp)
          Adds a web-app to the server.
 void destroy()
          Destroys the embedded server
protected  void finalize()
           
 void join()
          Waits for the Resin process to exit.
static void main(java.lang.String[] args)
          Basic embedding server.
 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 setPorts(PortEmbed[] ports)
          Sets a list of ports.
 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.

Method Detail

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.


addWebApp

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


setWebApps

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


addBean

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


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.lang.String httpRequest,
                    java.io.OutputStream os)
             throws java.lang.Exception
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.lang.Exception

request

public java.lang.String request(java.lang.String httpRequest)
                         throws java.lang.Exception
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.lang.Exception

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