This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.



Jun 8, 2012, 12:17 PM
20 Posts

Get server and domain

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: URL Server Host
  • Replies: 5
 I am developing an XPages workflow application which needs to send email notifications with a clickable URL link to the current document.  The application may be run on a Notes client or on a Web browser.  For the URL link to work, it must contain the name of the server along with its top level domain name.  Our Web server is called SAUSSW.org.  When the document is created on a Web browser, context.getUrl().getHost() returns "saussw.org," which is what is needed.
In the Notes client, however, this function returns "127.0.0.1" the IP address of the local host.
Using @Name("[CN]",@Subset(@DbName(),1)) returns "SAUSSW" without the '.org."
I know there is a way in JavaScript to get the complete server name, including domain, from a Notes client.  Unfortunately, I can't find the code I used to do this before.  Can anyone help?
Jun 8, 2012, 2:06 PM
135 Posts
Re: Get server and domain
I don't think the.org is available when running on Notes client. Do you have the name with .org stored in Server Document? If not I think you'll have to add it to your parameters.
 
EDIT: If it's not in Server Document it is probably in Internet Site Document.
 
- Panu 
Jun 8, 2012, 2:49 PM
589 Posts
Re: Get server and domain
 This really isn't ready for public consumption... as it's UGLY...  but I've been trying to work on an "XPages URL Cheatsheet".
 
Since you might need it here's an early look. 
 
 
 
I really don't know how helpful this is so please let me know. 
 
Dave 
NotesIn9 ScreenCast. 
 
Jun 9, 2012, 8:20 AM
20 Posts
Re: Get server and domain
 Dave, 
Thanks for the link.  I tried a lot of your code, but none of it gave me the .org part of the server name when running on a Notes client.  I could hard code the .org, but then the link might not work if the app gets replicated to a different server. 
Jun 11, 2012, 4:02 AM
126 Posts
Re: Get server and domain
Hi Jim,
 
The Teamroom template that ships with the ExtLib does exactly this. The way we do it is we have a setup page that only the admin can access and inside it there is an advanced tab with an editable URL (that you can override if necessary), it is pre filled with something similar to the javascript you mentioned above and that is bound to a "Mission" document that is held for application settings etc. This is then accessed to retrieve the URL whenever it is needed, this will overcome your issue
Jun 13, 2012, 3:03 PM
20 Posts
Re: Get server and domain
 Simon, 
The Teamroom database launches with a Domino frameset on the Notes client, and in an XPage on the Web. 
My application is pure XPages.  I have tried every facesContext, session, and database property I thought might be useful, and none of them provided the makings of a usable URL link for inclusion in an email when running on the Notes client.
 What I am thinking of doing is storing the Web URL in an application profile document.  When I call the Mail function in my script library, if @ClientType=="Web" I will store the URL in the profile document.  If @ClientType=="Notes" I will retrieve the URL from the profile document to append to the body of my email. 

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.