Is there any way to find if resource exists using Java-script use api? | Community
Skip to main content
Raghava_Joijode
Level 2
May 31, 2017 10:03 AM UTC
Solved

Is there any way to find if resource exists using Java-script use api?

Hi All,

In java use API I can resolve a path(String) to resource and know if that resource exits or not. But in java-script use API, I am able to convert a path(String) to resource using  (granite.resource.resolve(path)) but how can I know if the string path which I converted to a resource exists in my JCR?

Thanks in Advance!!

-Raghava.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Employee
May 31, 2017 12:18 PM UTC

Do getResource() instead of resolve(), if it results in null then it doesn't exists.

2 replies

Feike_Visser1
Feike_Visser1Accepted solution
Employee
May 31, 2017 12:18 PM UTC

Do getResource() instead of resolve(), if it results in null then it doesn't exists.

Translate
cquser1
Level 7
May 31, 2017 10:50 AM UTC

Hi,

Not pretty sure, but guess you might have to make use of normal java code which uses WCMUSEPojo.

You can await inputs from other community members too on this.

Translate