How to get resource resolver in replication preprocessor
Hi All,
I am trying to create replication preprocessor, which will restrict particular types of template from been replicated. For this I want to check the resource type of page been replicated and I need resource resolver object for it. I wanted to avoid resourceResolverFactory.getAdministrativeResourceResolver(null); rather use param.put(ResourceResolverFactory.SUBSERVICE, "readService"); but it is throwing a login exception any idea how to get resource using subservice?
@Reference
private transient ResourceResolverFactory resourceResolverFactory;
@Override
public void preprocess(ReplicationAction action, ReplicationOptions options) throws ReplicationException
{
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "readService");
try
{
ResourceResolver resolver = resourceResolverFactory.getServiceResourceResolver(param);
} catch (LoginException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
Thanks!
Shehjad