cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically get host and port in webscript

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi folks,

I'm wondering how could I get the host and port of the server where Share is running in, within a JS webscript. I have been searching in Google and in the forums but I didn't find anything useful. I was also searching in the Share's source code with the same result. Is it possible?

I've also been thinking about an alternative solution consisting in defining dynamically host an port in the component's config file, but I don't know whether it is possible or not.

Did anybody do it before?

Thanks.
3 REPLIES 3

alejandrogarcia
Champ in-the-making
Champ in-the-making
Thanks a million Andrea,

The resources you have provided are extremely useful. Further I'll post the solution that I have provided.

Regards.

alejandrogarcia
Champ in-the-making
Champ in-the-making
Finally I have solved the problem by a better approach such I don't need to get either host or port. I'm performing some customization to the WebView dashlet to make it automatically configurable, that's the reason of my needs.

Apart of that, I think that the definition of host and port as global config (http://wiki.alfresco.com/wiki/Web_Scripts#Global_and_Scoped_Config) and the retrieve them in the webscript could work and would be the best in my opinion. Furthermore, host and port could be dynamically replaced in config file with ant tasks.

I hope if helps others. Anybody interested or regarding question feel free to ask.

Cheers.