在运行时操作jar文件

时间:2019-03-14 18:40:17

标签: java jar wso2 wso2carbon

我正在尝试在运行时在<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script> <script src="https://unpkg.com/@material-ui/core@3.9.2/umd/material-ui.production.min.js"></script> <div id="root"></div>文件中更改Java代码。在运行之前将.jar文件放在.jar中时。这种方法工作正常,但是当我尝试更改.jar文件时,wso2仍将我的旧类保存在jar中。这是我的代码:

wso2ei-6.4.0\lib

我的SQ:

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;
    }
}

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

将.jar放入<product home> / lib中时,它将在启动服务器时自动复制到<product home> / dropins目录中。如果您希望新的工件受到影响,请从<product home> / dropins中删除旧的相应工件。