On Thu, 14 Mar 2002, WATKINS, Andy, FM wrote:

> Date: Thu, 14 Mar 2002 16:15:28 -0000
> From: "WATKINS, Andy, FM" <[EMAIL PROTECTED]>
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Running tomcat as an embedded servlet engine
>
> My apologies from cross posting this to the users list.
> Only afterwards did I realise it really a developer question
> as it involves coding...
>
>
>
> Im trying to run Tomcat in an embedded fashion (ie started from a main()
> in our program ), with a single servlet.
>
> Im using the Embedded.java class in Catalina, but am having trouble
> configuring it so that my single servlet answers on port 8080.
> The sample code in main in Embedded.java doesnt really have
> an example for a servlet.
>
> Has anyone else tried to do this (run an embedded servlet engine without
> swathes of configuration files)?
>

The example code in the main() method does indeed start a web application
-- it sets up the "/examples" webapp from the standard Tomcat
distribution.  The important point is that the "docBase" property of the
Context you create must point at a directory (or a WAR) that contains a
standard servlet application, with a /WEB-INF/web.xml file and everything
associated with it.  Setting up such a webapp to have a single servlet
answer all requests is trivially simple, and is no different for embedded
mode than it is for standard Tomcat mode of operation.

Embedded mode is for when you want to manage Tomcat's configuration
yoursel, without using server.xml.  If you don't want web.xml either, you
will probably find Tomcat too heavyweight to start with -- I'd suggest
exploring the web for lighter weight HTTP frameworks written in Java -- or
just use the HTTP connector in Tomcat and write your own Container
implementation instead of using the standard Engine, Host, and Context
components.

>
> Andy
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to