我正在尝试在.jar
文件中的运行时更改我的Java
代码。当我将.jar文件放在wso2ei-6.4.0lib
中时。这样可以正常工作,但是当我尝试更改.jar文件时,wso2仍然可以将我的旧课放入罐子内。在这里我的代码:
package com.Sample.Sample;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
public class Sample extends AbstractMediator {
private static final Log log = LogFactory.getLog(Sample.class);
private String name;
public boolean mediate(MessageContext context) {
// TODO Implement your mediation logic here
printTheName(context);
return true;
}
private void printTheName(MessageContext context){
String getNameFromSQ = (String)context.getProperty("NAME");
log.debug("Name Value: " + getNameFromSQ);
String upCaseName = getNameFromSQ.toUpperCase();
context.setProperty("newName", "Logging newName new new:" + upCaseName);
}
public void setPrintTheName(String newName){
this.name=newName;
}
public String getPrintTheName(){
return name;
}
}
我的SQ:
<property name="NAME" value= "Kerem"/>
<class name="com.Sample.Sample.Sample">
<property name="printTheName" value= "Log from SQ"/>
</class>
<log>
<property name="newName" expression="get-property('newName')"/>
</log>
任何建议?
当您将.jar放入 <product home>
/lib中时,当您启动服务器时,它将自动复制到 <product home>
/dropins目录。如果您想影响新的工件,请从<product home>
/Dropins中删除旧的相应工件。