On Thu, March 16, 2006 4:29 pm, Leon Rosenberg said: > On 3/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: >> Hmm... yeah, I guess your right :) D'oh! I made the onconscious >> assumption that the slave would know about itself, but if that were true >> there wouldn't be any reason to do any of this, it could just send that >> information to the master straight away. Sorry, I missed the obvious :) > > :-) > > Personally, I still think that parsing the server.xml and the > context.xml or whatever config files the webserver is using is the > second best option.
At this point I think your right... I'd be loathe to use a vendor-specific solution, but that seems like the option to go with. > The best option imho would be simply configure it with an external > configuration file / system and don't spend too much time with magic > and trickery. Agreed. I had a similar requirement last year where I had a number of instances of an app accross a cluster, and I had some background threads that did periodic processing. Problem was, the threads could only execute on one machine at a time, so they had to communicate with each other. I spent some time trying to find a really cool, dynamic answer, but in the end I wound up just hard-coding some necessary values in the config file. > But this thread and especially your ideas, Frank, are a welcome > alternation to the day in, day out same questions about validators and > ajax :-))) Glad I could entertain you :) LOL Actually, I *thought* I was on to something a second ago... let me post what I had, in the hopes that someone can see why it doesn't work... A simple servlet: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.net.*; public class TestServlet extends HttpServlet { public void init(ServletConfig config) { try { ServletContext context = config.getServletContext(); URL u = context.getResource("/test.fwz"); System.out.println(u.getProtocol() + "://" + u.getHost() + ":" + u.getPort() + "/" + context.getServletContextName()); } catch (Exception e) { e.printStackTrace(); } } } >From my reading of the docs, getResource() should be returning a URL to that resource, which does exist (NPE if it didn't) which would have all the details needed. Unfortunately, the only detail that is coming up properly is the ServletContextName... I get JNDI for the protocol, -1 for the port and I think nothing for the host. Am I reading the docs wrong, should that actually NOT work, as I'm seeing? Because you can get at the ServletContext from a plug-in too, this seemed like the perfect answer. Unfortunately, it has one minor drawback: it doesn't work :) > regards > Leon Frank --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]