Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Programmatic publishing a AEM page

Avatar

Level 1

Hi All,

I have more then 100 pages in my AEM site with the name containing lots of '_-' together so for sanitizing the page name i have written a java servlet which will compare the page title of the page with the sanitized title and if it does not match it will copy the page with correct title to the same location and delete the old page.

Question- Is there any way so that i can publish all the pages programmatic which are going through title change.

I am using pageManager.copy() and pageManager.delete().

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can use Replicator to make your job:

@Reference private Replicator replicator;

String path = "PATH OF THE RESOURCE HERE";

Session session = //Get the session from eg. a the request

try

{

replicator.replicate(session, "ACTIVATE", path);

}

catch(ReplicationException replicationException)

{

//Handle the replication exception

}

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

You can use Replicator to make your job:

@Reference private Replicator replicator;

String path = "PATH OF THE RESOURCE HERE";

Session session = //Get the session from eg. a the request

try

{

replicator.replicate(session, "ACTIVATE", path);

}

catch(ReplicationException replicationException)

{

//Handle the replication exception

}