Hi,

I have an application which needs to start an embedded Tomcat en share an object instance with a servlet which will run in the embedded tomcat servlet container. One solution is to use a static field of a class, but I prefer a direct way to do this, without using static fields.

Currently I do this, but I don't like that either:

       // Start the embedded server
       embedded.start();

       // Set the attribute on the servlet context.
       context.getServletContext().setAttribute(MY_ATTRIBUTE, myInstance);

One reason I don't like it is because there is a short period of time that the attribute is not set but the server is already running.

Is there a better way to do this?

Regards,
Sebastiaan


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to