cancel
Showing results for 
Search instead for 
Did you mean: 

Get system properties in the webscript

fedorow
Elite Collaborator
Elite Collaborator

How to get system properties like alfresco.host, share.host, share.port, e.t.c in the webscript?

This code works in the Javascript console, but does not for the webscript.

var ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var properties =  ctxt.getBean('global-properties', java.util.Properties);

var protocol = properties["share.protocol"] || 'http';
var host = properties["share.host"] || 'localhost';
var port = properties["share.port"] || '8080'

Webscript returns: Packages not defined.

1 ACCEPTED ANSWER

angelborroy
Community Manager Community Manager
Community Manager

You may try using this approach:

https://github.com/aborroy/alfresco-script-root-object

Hyland Developer Evangelist

View answer in original post

1 REPLY 1

angelborroy
Community Manager Community Manager
Community Manager

You may try using this approach:

https://github.com/aborroy/alfresco-script-root-object

Hyland Developer Evangelist