Re: Application front door URL

Patrick Middleton <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
On 21 Feb 2006, at 10:59, Markus Ruggiero wrote:

>
> On 21.02.2006, at 10:51, Paul Lynch wrote:
>
>> If you have access to the WORequest, it has various methods to  
>> provide parts of the url/uri.  applicationPrefix(), applicationName 
>> (), uri(), etc.  I don't think there is an accessor provided for  
>> the host name part.
>>
> That's exactly my problem. I am writing utility classes that need  
> this information but may operate outside of a R-R-Loop. Ideally I'd  
> like to have this info globally available in MyApplication either  
> as a public static String var or method(). Can I simply create a  
> WORequest object out of the blue in the application constructor and  
> it will work? When a WO app starts it prints the application front  
> door URL to the console. So the app knows it but there is no  
> request yet. There are a couple of URL related methods in  
> WOApplication but none gives what I need (eg directConnectUrl()  
> webServerConnectUrl())
>
> Thanks for your help
> ---markus---
>
>> Paul
>>
>> On 21 Feb 2006, at 09:03, Markus Ruggiero wrote:
>>
>>> Probably simple, but I cannot find an answer: How can an  
>>> application find out its own front door url? (/cgi-bin/WebObjects/ 
>>> MyApplication), be it direct action or component action.


Yes.  Have a look at the Applications page in JavaMonitor:
>  Application names do not need to match the Application  
> executable's filename.
>  Application names are used by the adaptor for load-balancing.

This is true even if you're not using JavaMonitor or Monitor.  Those  
apps are used for editing configuration which gets pushed to  
wotaskd.  The Apache DSO (or equivalent module for other HTTP daemon)  
may take configuration from wotaskd or a similar configuration from  
eg a file.  Either way, the "front door URL" will need to include the  
application name, not the Application executable's filename, and as  
previously stated these need not be the same, and the application  
would need to discover that information the same way that the Apache  
DSO does.

The approach Paul suggests is the way to go if you need to parse the  
request URL to discover applicationName etc; I generally don't need  
this, and can get everything I want from the HTTP headers.

If you need this outside of the request/response loop, the way to do  
it is to cache it while still in the request/response loop, possibly  
loading your cache by overriding appendToResponse(,).  [I have done  
this in the past in my WOApplication subclasses to be able to report  
the applicationNumber in log messages when working with WOLongResponse.]



Patrick Middleton
--
OneStep Solutions plc
351 London Road             Phone: +44 (0)1702 426400
Hadleigh                    Fax:   +44 (0)1702 556855
Essex. SS7 2BT              Email: [email protected]
England                            (MIME welcome)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.