cq5 - CQ - Check whether the resource object is valid -
i need check whether resource object valid or not below 'resource' object. example if pass url getresource("some path not available in cq")
in case need restrict it
resource resource= resourceresolver.getresource(/content/rc/test/jcr:content"); node node = resource.adaptto(node.class); string parentpagepath= node.getproperty("someproperty").getvalue().getstring();
is there way do?
if using getresource
null check sufficient. if use resolve
, have use !resourceutil.isnonexistingresource(resource)
. on node level can check existence of property hasproperty
.
Comments
Post a Comment