I really don't understand what's so bad about allowing to application to figure 
out what its deployment environment looks like.  And so what if an application 
is attached to multiple hosts - I may want to know that and act differently.

Part of the reason I'm having this problem is that my app is hosted in a 
servlet container and it's not clear to me how I would pass the host info to 
the constructor.

--Chuck

 

-----Original Message-----
From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 2:01 PM
To: discuss@restlet.tigris.org
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 À : discuss@restlet.tigris.org 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: discuss@restlet.tigris.org
> 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 À : discuss@restlet.tigris.org 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: discuss@restlet.tigris.org
> > 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 À : discuss@restlet.tigris.org 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)
> > >  

Reply via email to