Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-17 Thread Leon Rosenberg
On 3/17/06, Wojciech Ciesielski <[EMAIL PROTECTED]> wrote: > I didn't expect to trigger such an elaborate discussion ;-) > > > 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. > > There is a

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
Are these slaves servers that you have some degree of control over? I ask because if so, can you just dictate that they have to run on some known port, and then you can still get the rest of the information dynamically. Or, almost as good... although my idea of scanning for the port was obvi

RE: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Wojciech Ciesielski
> even if it would work, how can you guarantee it resolves the proper > hostname? the default linux installation resolves > InetAdress.getLocalhost() to "localhost" until you remove the > 127.0.0.1 line from your etc/hosts. Right now the port was the problem. We are not using name-based virtual ho

RE: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Wojciech Ciesielski
I didn't expect to trigger such an elaborate discussion ;-) > 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. There is another problem - how can you get path to tomcat root directory? It's no

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
Leon Rosenberg wrote: On 3/16/06, Dave Newton <[EMAIL PROTECTED]> wrote: Frank W. Zammetti wrote: Unfortunately, it has one minor drawback: it doesn't work :) Minor quibble. Dave Frank, Dave... even if it would work, how can you guarantee it resolves the proper hostname? the default linu

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
Dave Newton wrote: Two things jump out at me: 1) It looks like it's container-dependent: "The servlet container must implement the URL handlers and |URLConnection| objects that are necessary to access the resource." 2) It's not making a "real" request so the container might short-circuit the no

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
On 3/16/06, Dave Newton <[EMAIL PROTECTED]> wrote: > Frank W. Zammetti wrote: > > > Unfortunately, it has one minor drawback: it doesn't work :) > > > > Minor quibble. > > Dave Frank, Dave... even if it would work, how can you guarantee it resolves the proper hostname? the default linux installat

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Dave Newton
Frank W. Zammetti wrote: > 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.getServl

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
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

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
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 mast

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
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 :) -- Frank W. Z

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
On 3/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > Ok, here's another possibility... > > From the plug-in, launch a daemon thread (daemon just in case the server > has to go down before the thread is done, in which case it won't block the > shutdown). Have the thread sleep for some amount

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Dave Newton
Frank W. Zammetti wrote: > >From the plug-in, launch a daemon thread (daemon just in case the server > has to go down before the thread is done, in which case it won't block the > shutdown). Have the thread sleep for some amount of time, 30 seconds > maybe, however long on average it takes your ap

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Dave Newton
Leon Rosenberg wrote: > hmm, I suppose the poster wants to run a n workers for m applications > scenario with own load balancing, and wants to add new applications > and servers dynamically. > That was my assumption; random slaves should be able to volunteer automagically on startup. Really I

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
Ok, here's another possibility... >From the plug-in, launch a daemon thread (daemon just in case the server has to go down before the thread is done, in which case it won't block the shutdown). Have the thread sleep for some amount of time, 30 seconds maybe, however long on average it takes your

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
hmm, I suppose the poster wants to run a n workers for m applications scenario with own load balancing, and wants to add new applications and servers dynamically. right? Leon On 3/16/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > On 3/16/06, Leon Rosenberg <[EMAIL PROTECTED]> wrote: > > On 3/16/06, M

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Mark Lowe
On 3/16/06, Leon Rosenberg <[EMAIL PROTECTED]> wrote: > On 3/16/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > > Why cant the master server provide the information, as i assume that > > some form of request is being made via a socket or otherwise to > > register the client? Even if no you can still do

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
On 3/16/06, Mark Lowe <[EMAIL PROTECTED]> wrote: > Why cant the master server provide the information, as i assume that > some form of request is being made via a socket or otherwise to > register the client? Even if no you can still do what you need by > creating a socket or url connection to the

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Mark Lowe
Why cant the master server provide the information, as i assume that some form of request is being made via a socket or otherwise to register the client? Even if no you can still do what you need by creating a socket or url connection to the master, and have the master send the details back. A bit

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
On Thu, March 16, 2006 1:33 pm, Dave Newton said: > Frank W. Zammetti wrote: >> How about having a servlet as part of your webapp that starts up before >> Struts does... then, from your plugin, you scan the local machine by >> sending a request to every port from 1 to 1, and whichever you get >

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Dave Newton
Frank W. Zammetti wrote: > How about having a servlet as part of your webapp that starts up before > Struts does... then, from your plugin, you scan the local machine by > sending a request to every port from 1 to 1, and whichever you get the > appropriate reply from is your port. Since we alr

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
On Thu, March 16, 2006 1:07 pm, Leon Rosenberg said: > a bit crazy suggestion. Why don't you just parse the server.xml at > startup to determine the port? I'll one-up your crazyness Leon... How about having a servlet as part of your webapp that starts up before Struts does... then, from your plug

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Leon Rosenberg
a bit crazy suggestion. Why don't you just parse the server.xml at startup to determine the port? regards Leon On 3/16/06, Wojciech Ciesielski <[EMAIL PROTECTED]> wrote: > OK, thank you all. I thought that it's possible in some easy way through > J2EE/Struts API. If not we will try to work around

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Wojciech Ciesielski
OK, thank you all. I thought that it's possible in some easy way through J2EE/Struts API. If not we will try to work around it somehow... Reagards, Wojtek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Wojciech Ciesielski
Hehe, don't feel bad... I was *this* close to replying with pretty much the same thing you did, I realized I would have been wrong just before I clicked Send :) So may be I should apologize for lack of precision in initial post :-) Absolutely no offense taken anyway and thanks for will to as

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Dave Newton
[EMAIL PROTECTED] wrote: > Did you even _LOOK_ at the url that I sent the first time? Your slave > starts and fires init() and makes a call to the master, the master will > take the request and reconstruct the URL from the slave. > How does this help? This is the URL that the slave requested

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Frank W. Zammetti
ond. > > -Dennis > > > > > > [EMAIL PROTECTED] > 03/16/2006 11:21 AM > Please respond to > "Struts Users Mailing List" > > > To > "Struts Users Mailing List" > cc > > Subject > Re: [OT ]Re: obtaining server URL (or ip

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread DGraham
om/egs/javax.servlet/GetReqUrl.html -Dennis Wojciech Ciesielski <[EMAIL PROTECTED]> 03/16/2006 11:14 AM Please respond to "Struts Users Mailing List" To Struts Users Mailing List cc Subject Re: [OT ]Re: obtaining server URL (or ip and port) from plugin [EMAIL PROTECTED] wrote:

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread DGraham
Wojciech Ciesielski <[EMAIL PROTECTED]> 03/16/2006 11:14 AM Please respond to "Struts Users Mailing List" To Struts Users Mailing List cc Subject Re: [OT ]Re: obtaining server URL (or ip and port) from plugin [EMAIL PROTECTED] wrote: > Assuming all of the "sl

Re: [OT ]Re: obtaining server URL (or ip and port) from plugin

2006-03-16 Thread Wojciech Ciesielski
[EMAIL PROTECTED] wrote: Assuming all of the "slaves" know the id of the "master", then maybe you have a RegisterServlet that's called by a slave processing servers during their init? http://javaalmanac.com/egs/javax.servlet/GetReqUrl.html -Dennis The problem is that slaves know master's