This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Dec 26, 2013, 6:05 AM
4 Posts

How to get port number in a url in xpage?

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0
  • Role:
  • Tags:
  • Replies: 6

Here is my situation.

I have 12 domino servers running inside of corp.

And I setup a reverse proxy server called m.corp.com to visit these domino servers using ports from 81 to 92.

for example:

I wish to get the following url into xpages code.

https://m.corp.com:81/cc.nsf/vfdefault.xsp?documentId=3A47BD1C3BF869DD48257C4C001EBBB0&action=openDocument

I try to use 

context.getUrl()

Then I get https://m.corp.com/cc.nsf/vfdefault.xsp?documentId=3A47BD1C3BF869DD48257C4C001EBBB0&action=openDocument

This is not correct.

Then I tried facesContext.getExternalContext().getRequest().getRequestURL()

still the same problem.

The question is :

is there a xpage code can get the full url including the port number?

 

Dec 26, 2013, 9:45 AM
54 Posts
return context.getUrl().toString().split(facesContext.getExternalContext().getRequest().ge...

You can use return context.getUrl().toString().split(facesContext.getExternalContext().getRequest().getRequestURI())[0]

Dec 27, 2013, 8:10 AM
4 Posts
is there any body has any idea for this?

is there any body has any idea for this?

Or it's a bug for xpage?

Dec 27, 2013, 11:18 PM
366 Posts
Use the following syntax

This will return the host including the http or https as well as the port if any is set

var host = context.getUrl().getHost()+":"+context.getUrl().getPort();

Dec 30, 2013, 9:15 AM
4 Posts
I think the problem goes to the reverse proxy port could not be access by xpage code.
Use the following syntax

This will return the host including the http or https as well as the port if any is set

var host = context.getUrl().getHost()+":"+context.getUrl().getPort();

it's very wield, have you tried it?

it's returning m.corp.com:-1

I think the problem goes to the reverse proxy port could not be access by xpage code.

but csjs code "location.href" can do that.

and is there any way to pass the csjs code to ssjs code?

Dec 30, 2013, 7:11 PM
366 Posts
I use this in production...

all the time.  not with a proxy server though.  that may be your weak link.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal