Hi,
I am using embedded tomcat 5.5.16. I am trying to embed tomcat server in my
java application. I tried to find how to set some attributes like
maxThreads, acceptCount and so on but was not able to find a good way to do
this in embedded tomcat application.
Secondly I am trying to feed SOAP request to this server, so where do i need
to set my wsdd file.
I have tried the following.
/**
*import* java.net.UnknownHostException;
***
import* org.apache.catalina.connector.Connector;
*
import* org.apache.catalina.Context;
*
import* org.apache.catalina.Engine;
*
import* org.apache.catalina.Host;
*
import* org.apache.catalina.LifecycleException;
*
import* org.apache.catalina.startup.Embedded;
*
public* *class* EmbeddedServer
{
*private* String path = *null*;
*private* Embedded embedded = *null*;
*private* Host host = *null*;
*private* *int* port ;
*private* Engine engine = *null*;
*private* Connector connector = *null*;
*private* Context context = *null*;
/**
* Basic Accessor setting the value of the context path
*
* [EMAIL PROTECTED] path - the path
*/
*public* *void* setPath(String path, *int* port) {
*this*.path = path;
*this*.port = port;
}
/**
* Basic Accessor returning the value of the context path
*
* [EMAIL PROTECTED] - the context path
*/
*public* String getPath() {
*return* path;
}
*public* *int* getPort() {
*return* port;
}
*public* *void* start() *throws* LifecycleException, UnknownHostException
{
// Set the home directory
System.*setProperty*("catalina.home", getPath());
embedded = *new* Embedded();
// Create an engine
engine = embedded.createEngine();
engine.setDefaultHost( "localhost" );
// Create a default virtual host
host = embedded.createHost(InetAddress.*getLocalHost*().getHostName(),
getPath()
+ "/webapps");
engine.addChild(host);
// Create the ROOT context
context = embedded.createContext("", getPath() + "/webapps/ROOT");
host.addChild(context);
// Install the assembled container hierarchy
embedded.addEngine(engine);
//Assemble and install a default HTTP connector
connector = embedded.createConnector((java.net.InetAddress) *null*,
getPort(), *false*);
// configure connector attributes
embedded.addConnector(connector);
// Start the embedded server
embedded.start();
}
/**
* This method Stops the Tomcat server.
*/
*public* *void* stopTomcat() *throws* Exception {
// Stop the embedded server
embedded.stop();
}
}
*/
I am not sure how can i set up attributes for my Connector and how to use
WSDD file. Thanks in advance for any help or hints to fix this issue.
Thanks!