The more I think about this, the more it seems that something is fundamentally wrong here.
According to AWWW[1], "Assign distinct URIs to distinct resources." So if an application is the thing that manages a set of resources (i.e,. a URI space), having it attached to multiple virtual hosts guarantees that your resources will not have distinct URIs. I'm also wondering if the baby's being thrown out with the bathwater here. Just because some people want to attach an application to multiple virtual hosts doesn't rule out the case the some people will only ever attach an application to a single virtual host. Perhaps its worth revisiting the way virtual hosting is being handled. Or maybe I'm misunderstanding who is repsonsible for managing an application's URI space. As for using the application's context in web.xml - that's just plain ugly; everytime I deploy, I have to unwrap my war so I can modify web.xml to change hostname and port info. (Deployment-specific config info just shouldn't be in web.xml) Oh well, for now web.xml will have to do for a temporary solution. --Chuck [1]http://www.w3.org/TR/webarch/#id-resources -----Original Message----- From: Jerome Louvel [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 20, 2007 2:01 PM To: [email protected] Subject: RE: RE: RE: Find host info from Application That's interesting :) Another aspect to consider is the fact that a virtual host can correspond/accept multiple domain names, multiple ports, etc. In addition the sample application instance could perfectly well be attached to several virtual hosts at the same time. For those reasons, I don't want to change the API. The best in your case is to manually pass this info to your application. You can also rely on application's context parameters to pass the host info as this will be more portable when support WAR-style packaging in 1.1. Best regards, Jerome > -----Message d'origine----- > De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : mardi 20 > février 2007 19:01 À : [email protected] Objet : RE: RE: RE: > Find host info from Application > > Except that when I need the host info, I don't have a Request object > handy. In fact, when I need the host info, my application may not > have even received any requests yet. > > The application needs to know host info for application > initialization. There are data structures that need to be set up > before any requests are ever handled. > > --Chuck > > -----Original Message----- > From: Jerome Louvel [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 20, 2007 12:43 PM > To: [email protected] > Subject: RE: RE: Find host info from Application > > > Ok I see. For this you can use the Request.getRootRef() method that > was recently added. > > Best regards, > Jerome > > > -----Message d'origine----- > > De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : > mardi 20 > > février 2007 18:29 À : [email protected] Objet : > RE: RE: Find > > host info from Application > > > > I need, for example, to find out what the canonical > hostname/base url > > of my deployment environment is. > > > > For example, when creating atom:source elements, I have to > be able to > > construct a URL for a feed (that's part of my application), and I > > can't do that if I don't know what my hostname and port number are. > > > > --Chuck > > > > -----Original Message----- > > From: Jerome Louvel [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, February 20, 2007 12:12 PM > > To: [email protected] > > Subject: RE: Find host info from Application > > > > > > Hi Chuck, > > > > As an Application is expected to be portable from one deployment > > environment to another, we intentionally don't have a > reference to the > > parent VirtualHost. > > > > I would be interested to know what is the requirement > leading you in > > the path. For now, if you really need this reference, you should > > manually pass it to the constructor of your application. > > > > Best regards, > > Jerome > > > > > -----Message d'origine----- > > > De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : > > mardi 20 > > > février 2007 18:06 À : [email protected] Objet : > Find host > > > info from Application > > > > > > > > > From within an Application, how does one get hold of the > > VirtualHost > > > to which the application is attached? > > > > > > --Chuck > > > > > > > > > ------------------------------------ > > > Chuck Hinson > > > Gestalt LLC > > > phone: 610.994.2833 > > > IM: chucking24 (Yahoo) > > >

