Sami
Sami

Reputation: 564

How to print Worklight properties using Java

We are trying to get All the properties inside the Worklight server using Java code running on the server.

Worklight Version 6.2.0.1

Based on the following URL:

https://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/html/refjava-worklight-server/html/com/worklight/server/bundle/api/WorklightConfiguration.html

I'm trying to use getAllProperties() API. However, I'm not getting it inside the code:

I imported java.util.Properties;

try{
     Properties p = new Properties();
     p.getAllProperties(); // This doesn't exist
     .
     .
}

enter image description here

Am I doing it wrong or missing something.? How can I read all the properties inside Worklight based on IBM URL mentioned above?

Upvotes: 0

Views: 97

Answers (1)

Laf
Laf

Reputation: 8215

If I got your problem correctly, the class WorklightConfiguration provides a method called getAllProperties() wich returns an instance of Properties. You haven't provided any code in your question, but a this code example might help you (disclaimer: I have never used Worklight before, so this might need some adjustments, but you'll get the idea):

WorklightConfiguration config = WorklightConfiguration.getInstance ();
Properties properties = config.getAllProperties ();

for (String propertyName: properties.propertyNames ()) {
    String property = properties.getProperty (propertyName);
    // rest of implementation...
} 

Upvotes: 2

Related Questions