Lius
2024-06-18 3b2decedde042efe481330a20981a374efdf5978
提交
已添加1个文件
73 ■■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/JaxWsDynamicClientFactory.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/JaxWsDynamicClientFactory.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,73 @@
package org.jeecg.modules.mdc.util;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.endpoint.EndpointImplFactory;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
import org.apache.cxf.jaxws.support.JaxWsEndpointImplFactory;
import java.io.File;
import java.util.List;
/**
 * @author Lius
 * @date 2024/6/14 11:07
 * æ³¨ï¼šè§£å†³æ­¤ï¼ˆé”™è¯¯ï¼šç¼–码GBK的不可映射字符)问题
 */
public class JaxWsDynamicClientFactory extends DynamicClientFactory {
    protected JaxWsDynamicClientFactory(Bus bus) {
        super(bus);
    }
    @Override
    protected EndpointImplFactory getEndpointImplFactory() {
        return JaxWsEndpointImplFactory.getSingleton();
    }
    protected boolean allowWrapperOps() {
        return true;
    }
    /**
     * Create a new instance using a specific <tt>Bus</tt>.
     *
     * @param b the <tt>Bus</tt> to use in subsequent operations with the
     *            instance
     * @return the new instance
     */
    public static JaxWsDynamicClientFactory newInstance(Bus b) {
        return new JaxWsDynamicClientFactory(b);
    }
    /**
     * Create a new instance using a default <tt>Bus</tt>.
     *
     * @return the new instance
     */
    public static JaxWsDynamicClientFactory newInstance() {
        Bus bus = CXFBusFactory.getThreadDefaultBus();
        return new JaxWsDynamicClientFactory(bus);
    }
    /**
     * è¦†å†™çˆ¶ç±»çš„该方法<br/>
     * æ³¨ï¼šè§£å†³æ­¤ï¼ˆé”™è¯¯ï¼šç¼–码GBK的不可映射字符)问题
     *
     * @return
     */
    @Override
    protected boolean compileJavaSrc(String classPath, List<File> srcList, String dest) {
        org.apache.cxf.common.util.Compiler javaCompiler
                = new org.apache.cxf.common.util.Compiler();
        // è®¾ç½®ç¼–译编码格式(此处为新增代码)
        javaCompiler.setEncoding("UTF-8");
        javaCompiler.setClassPath(classPath);
        javaCompiler.setOutputDir(dest);
        javaCompiler.setTarget("1.6");
        return javaCompiler.compileFiles(srcList);
    }
}