Question

I have to access few WL Server properties (from worklight.properties) in the Adapter JS file. I know we can access properties in the Adapter xml file but I have to access in the JS file.

{ WL.Server.configuration["local.IPAddress"] } 

Is this possible?

Était-ce utile?

La solution

The answer is yes.

For example, using a newly created adapter,

  1. I've added the following before the return in the getStories() function:

    WL.Logger.info("##################### Worklight protocal: " + WL.Server.configuration["publicWorkLightProtocol"]);
    
  2. In order to see this log line in the Worklight Development Server's console in Eclipse, go to and change:

    • Servers view > server.xml > Logging section > Console log level >> INFO

  3. Run As > Deploy Worklight Adapter
  4. Run As > Invoke Worklight Procedure
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top