I need to check whether the resource object is valid or not for the below 'resource' object. For example If I pass any url like getResource("some path which is not available in cq") in this case I need to 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 any way to do?
                        
If you are using
getResourcea null check is sufficient. If you useresolve, then you have to use the!ResourceUtil.isNonExistingResource(resource). On Node level you can check the existence of a property withhasProperty.