On further reading... Server server = new Server(8080); Context root = new Context(server,"/",Context.SESSIONS); root.addServlet(new ServletHolder(new HelloServlet("Ciao")), "/*"); server.start();
You can pass the interface to your application into the HelloServlet's constructor. My app actually provides a hessian webservice to the application via jetty, so i couldn't do exactly as the example shows. Here is a snippet, if your interested. mJettyServer = new Server(); mJettyServer.addListener(mJettyIp + ":" + mJettyPort); ServletHttpContext ctx = (ServletHttpContext) mJettyServer.getContext("/webservice"); ServletHolder servletHolder = ctx.addServlet( "wservice", // servlet name "/wservice", // URI mapping pattern "com.caucho.hessian.server.HessianServlet" // class name ); servletHolder.setInitParameter("api-class", "com.mycompany.myapp.IWebservice"); servletHolder.setInitParameter("service-class", com.mycompany.myapp.WebserviceImp"); mJettyServer.start(); Ben On 1/23/07, ben short <[EMAIL PROTECTED]> wrote:
Hi, I have done something similar, but used Jetty [1] as I couldn't figure out how to get tomcat to do it.. My application registers a servlet and starts jetty. the servlet gets the interface to the application via a static method. But it all works OK. Maybe you could set the application interface into the ServletConfig somehow and the servlet could grab it in the init method. I hope this is of some help. Ben ps: sorry to mention jetty on a tomcat list ;) [1] http://docs.codehaus.org/display/JETTY/Embedding+Jetty On 1/23/07, Yiannis Mavroukakis <[EMAIL PROTECTED]> wrote: > Oh no, I mean the exact opposite :) > > > ----------------- > | Application | > | | > |---------------| > |Embedded TC | > ----------------- > > The application I am writing this for is a server daemon which has a cli > that enables the user to issue commands to it once it's up and running. > What I want, is to use Tomcat to serve a page that will present the user > with a friendlier way to issue these commands to the app. Since there is > no ready way for embedded Tomcat to "communicate" with the host > application that launched it, I assume that the best way is to do this > via localhost RMI calls from Tomcat to the host application > > > Y. > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Yiannis, > > > > Yiannis Mavroukakis wrote: > > > The scenario is a server daemon that has a cli for runtime > > > configuration and status. > > > > Oh, so you want to be able to reconfigure Tomcat remotely. I assume that > > you are talking about more interesting things than can be done with the > > Tomcat Manager application. > > > > > I intend to use embedded tomcat to replace/augment that cli and I > > > have actually done so succesfully, using RMI but I was wondering > > > whether there was some other solution that allows Tomcat to > > > communicate with the application it's embedded into. > > > > You're reached the limit of my knowledge regarding Tomcat configuration > > capabilities. I've never embedded it or another like that. > > > > - -chris > > > > > Note:__________________________________________________________________ > This message is for the named person's use only. It may contain > confidential, proprietary or legally privileged information. No > confidentiality or privilege is waived or lost by any mistransmission. > If you receive this message in error, please immediately delete it and > all copies of it from your system, destroy any hard copies of it and > notify the sender. You must not, directly or indirectly, use, disclose, > distribute, print, or copy any part of this message if you are not the > intended recipient. Jaguar Freight Services and any of its subsidiaries > each reserve the right to monitor all e-mail communications through its > networks. > Any views expressed in this message are those of the individual sender, > except where the message states otherwise and the sender is authorized > to state them to be the views of any such entity. > ________________________________________________________________________ > This e-mail has been scanned for all known viruses. > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]