Probably been said here before, but If you know that the client wll be HTTP 
1.1, you can rely on the HTTP Host Request header to contain the host and 
client from the originating HTTP
request.

-Eric


________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Jakob Fix 
[[email protected]]
Sent: Friday, March 04, 2011 6:58 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] how to retrieve the hostname, easily

Thanks to David and Geert for their pointers and explanation. It was
indeed simply the xdmp:host-name function I was looking for (doh!).


cheers,
Jakob.



On Fri, Mar 4, 2011 at 15:46, Geert Josten <[email protected]> wrote:
> Hi Jakob,
>
> There is of course xdmp:host and xdmp:host-name, but that won't return the 
> host-in-the-url entered by the end-user. The host-name could even be very 
> unusefull to the end-user, as it is the value entered in the admin interface, 
> and doesn't need to have any reference to reality as far as I know. You can 
> change it to anything you like at least..
>
> If you just want to show the host name as known to the end user, you could 
> alternatively use javascript within the html returned to the user.
>
> Clustering might be involved indeed, but I expect xdmp:host to return the 
> host ID of the evaluator node, e.g. the host that received the actual 
> request, not all other hosts that might be involved in data retrieval. If you 
> have load balancing, then different host names would be shown..
>
> Kind regards,
> Geert
>
> -----Oorspronkelijk bericht-----
> Van: [email protected] 
> [mailto:[email protected]] Namens Jakob Fix
> Verzonden: vrijdag 4 maart 2011 15:30
> Aan: General Mark Logic Developer Discussion
> Onderwerp: [MarkLogic Dev General] how to retrieve the hostname, easily
>
> Hi,
>
> I'm looking for a not-so-complicated way to retrieve the host name
> (i.e. the name that is displayed on top of each page in the MarkLogic
> admin interface).
> Why is there a xdmp:get-request-path, xdmp:get-request-protocol,
> xdmp:get-request-url, but no xdmp:get-host-name?
>
> Of course, I've ploughed through the Admin/ code, and finally found
> the function get-session-host-node() in session.xqy, but it also
> depends on an $hosts.xml variable which in turn uses yet another
> library.  In the end it's very involved if all you want to do is to
> display the hostname the current application is running on (I guess
> the fact that it's not easy probably has its reasons in the fact that
> more complicated scenarios involving clustering exist that need to be
> accounted for).
>
> cheers,
> Jakob.
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to