how to publish a page programmatically in cq5
how to publish a page programmatically in cq5
how to publish a page programmatically in cq5
Hi.
It is possible form a servlet to get hold of a replicator by using the @Reference annotation.
(more info about that here http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/replication/Replicator.html)
To get hold of a replicator you can use the following code:
@Reference private Replicator replicator;
Then you can use the following code to replicate a page to a publish instance:
String path = "PATH OF THE RESOURCE HERE"; Session session = //Get the session fro eg. a the request try { replicator.replicate(session, "ACTIVATE", path); } catch(ReplicationException replicationException) { //Handle the replication exception }The same goes for any deactivation of a resource.
Hope that will help you.
/Johan
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.