import oracle.webcenter.portalframework.sitestructure.SiteStructureContext;
import oracle.adf.controller.v2.lifecycle.PagePhaseEvent;
import oracle.adf.controller.v2.lifecycle.PagePhaseListener;
import oracle.adf.controller.v2.lifecycle.Lifecycle;
public final class CustomPhaseListener implements PagePhaseListener {
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
try {
SiteStructureContext ctx =
SiteStructureContext.getInstance();
ctx.getNavigationModel("/oracle/webcenter/portalapp/navigations/default-navigation- model.xml").invalidateCache();
} catch (ResourceNotFoundException ex) {
ex.printStackTrace();
}
}
}
import oracle.adf.controller.v2.lifecycle.PagePhaseEvent;
import oracle.adf.controller.v2.lifecycle.PagePhaseListener;
import oracle.adf.controller.v2.lifecycle.Lifecycle;
public final class CustomPhaseListener implements PagePhaseListener {
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
try {
SiteStructureContext ctx =
SiteStructureContext.getInstance();
ctx.getNavigationModel("/oracle/webcenter/portalapp/navigations/default-navigation- model.xml").invalidateCache();
} catch (ResourceNotFoundException ex) {
ex.printStackTrace();
}
}
}
Hi W!nkle!,
ReplyDeleteinteresting, but what was your use case for wanting to invalidating the cache of your naviation model? And why is it essential to do this in this particular phase?
And do you do this for a particular page, or for all pages in your portal?
regards,
Jaap
Hi Jaap,
DeleteThe use case is, When user clicked on Change language, the page needs to reload with selected language property bundle.
The given part of code written in Custom Phase listener to render content on each page load.
Rgds,
W!nkle!