how to get the domain part in the url of ebase application?

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

how to get the domain part in the url of ebase application?

#1

Postby t4nu » Fri Mar 04, 2016 8:05 am

Hi,
supposing my ebase url is:
http://my.domain.com:3030/myAppName/myForm.eb

how can I get the http://my.domain.com:3030 from that url?
how can I get the name of the ebase app?

Thanks in advance for the help.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#2

Postby Steve James » Fri Mar 04, 2016 8:28 am

Have a look at system variables.

http://dev-docs.verj.io/ufs/doc/javadoc ... ables.html

http://dev-docs.verj.io/ufs/doc/script_ ... c357685858

You can also get at the client http headers

Code: Select all

var h = client.getRequest();
var en = h.getHeaderNames();
while(en.hasMoreElements())
{
        //get header name Accept,Accept-Charset,Authorization,Connection,Host etc.   
	var headerName = en.nextElement(); //nextElement() returns Object need type cast

        //get the value of the headerName 
        var headerValue = h.getHeader(headerName);
    }
The header named 'host' should return all but the protocol ie "my.domain.com:3030"
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#3

Postby Jon » Fri Mar 04, 2016 9:51 am

There's also a lot of usefeul information in the Http request object. In your example:

client.request.contextPath will return: "/myAppName"
client.request.serverName will return: "my.domain.com"
client.request.serverPort will return: "3030"
client.request.scheme will return: "http"

Here's the javadoc for HttpServletRequest for more info http://docs.oracle.com/javaee/6/api/jav ... quest.html
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#4

Postby t4nu » Fri Mar 04, 2016 4:13 pm

Thanks a lot guys.
:D
0 x


Who is online

Users browsing this forum: No registered users and 25 guests