How to add currentpage path in ResourceChangeListener.PATHS? | Community
Skip to main content
Level 2
March 10, 2023

How to add currentpage path in ResourceChangeListener.PATHS?

  • March 10, 2023
  • 1 reply
  • 1032 views

I am writing the ResourceChangeListener . I want current page path at  ResourceChangeListener.PATHS. 
PFB snippet where I want currentpage's path.
@8220494(immediate = true, service = ResourceChangeListener.class, enabled = true, property = {
"process.label = JSON Event Handler",
ResourceChangeListener.PATHS
+ "=CURRENTPAGEPATH",
ResourceChangeListener.CHANGES + "=ADDED", ResourceChangeListener.CHANGES + "=CHANGED" })

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Saravanan_Dharmaraj
Community Advisor
Community Advisor
March 10, 2023

As per the documentation you need to provide the path. Please see below

 

Array of paths or glob patterns - required.

A path is either absolute or relative. If it's a relative path, the relative path will be appended to all search paths of the resource resolver.

If the whole tree of all search paths should be observed, the special value . should be used.

A glob pattern must start with the glob: prefix (e.g. glob:**/*.html). The following rules are used to interpret glob patterns:

  • The * character matches zero or more characters of a name component without crossing directory boundaries.
  • The ** characters match zero or more characters crossing directory boundaries.
  • If the pattern is relative (does not start with a slash), the relative path will be appended to all search paths of the resource resolver.
Level 2
March 10, 2023

@saravanan_dharmaraj yes but I want to handle the event for component's dialog change and that component will present at all the pages. That's why I want current page path.

Saravanan_Dharmaraj
Community Advisor
Community Advisor
March 10, 2023

@anamika_13 if you want to capture change all the pages , then you can give "/content" itself, isnt it? 

 

Please see this example

https://github.com/francescaambrosio/esempio1aem/blob/master/bundle/src/main/java/com/adobe/acs/samples/events/impl/SampleResourceChangeListener.java