Skip to content

Instantly share code, notes, and snippets.

@minudika
Created November 3, 2019 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minudika/0b26284bdac135bc0ba4ff48a83a5346 to your computer and use it in GitHub Desktop.
Save minudika/0b26284bdac135bc0ba4ff48a83a5346 to your computer and use it in GitHub Desktop.
package com.wso2.test;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
import org.apache.synapse.registry.Registry;
import org.apache.synapse.config.Entry;
import org.apache.axiom.om.impl.llom.OMTextImpl;
public class RecourceFinder extends AbstractMediator {
String REGISTRY_MAPPING_STORAGE_URL = "conf:/repository/new";
String fileName = "converted.txt";
public boolean mediate(MessageContext context) {
Registry wso2Reg = context.getConfiguration().getRegistry();
Entry entry = new Entry(REGISTRY_MAPPING_STORAGE_URL+"/"+fileName);
Object obj = wso2Reg.getResource(entry, null);
OMTextImpl textImpl = (OMTextImpl) obj;
try{
String value = textImpl.getText();
System.out.println(value);
}catch(Exception e){
e.printStackTrace();
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment