Dynamically get host and port in webscript

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2012 11:59 AM
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.
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.
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2012 03:41 AM
Hi,
take a look to this topic https://forums.alfresco.com/en/viewtopic.php?f=48&t=35690
Generally using this approach could be useful http://wiki.alfresco.com/wiki/Web_Scripts#Global_and_Scoped_Config
Another possible way here http://stackoverflow.com/questions/13491604/how-to-retrieve-the-hostname-from-an-alfresco-share-webs...
Regards,
Andrea
take a look to this topic https://forums.alfresco.com/en/viewtopic.php?f=48&t=35690
Generally using this approach could be useful http://wiki.alfresco.com/wiki/Web_Scripts#Global_and_Scoped_Config
Another possible way here http://stackoverflow.com/questions/13491604/how-to-retrieve-the-hostname-from-an-alfresco-share-webs...
Regards,
Andrea

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2012 08:48 AM
Thanks a million Andrea,
The resources you have provided are extremely useful. Further I'll post the solution that I have provided.
Regards.
The resources you have provided are extremely useful. Further I'll post the solution that I have provided.
Regards.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2012 11:36 AM
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.
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.
