import sun.net.www.ParseUtil; //导入方法依赖的package包/类

private CodeSource canonicalizeCodebase(CodeSource cs,

boolean extractSignerCerts) {

String path = null;

CodeSource canonCs = cs;

URL u = cs.getLocation();

if (u != null) {

if (u.getProtocol().equals("jar")) {

// unwrap url embedded inside jar url

String spec = u.getFile();

int separator = spec.indexOf("!/");

if (separator != -1) {

try {

u = new URL(spec.substring(0, separator));

} catch (MalformedURLException e) {

// Fail silently. In this case, url stays what

// it was above

}

}

}

if (u.getProtocol().equals("file")) {

boolean isLocalFile = false;

String host = u.getHost();

isLocalFile = (host == null || host.equals("") ||

host.equals("~") || host.equalsIgnoreCase("localhost"));

if (isLocalFile) {

path = u.getFile().replace('/', File.separatorChar);

path = ParseUtil.decode(path);

}

}

}

if (path != null) {

try {

URL csUrl = null;

path = canonPath(path);

csUrl = ParseUtil.fileToEncodedURL(new File(path));

if (extractSignerCerts) {

canonCs = new CodeSource(csUrl,

getSignerCertificates(cs));

} else {

canonCs = new CodeSource(csUrl,

cs.getCertificates());

}

} catch (IOException ioe) {

// leave codesource as it is, unless we have to extract its

// signer certificates

if (extractSignerCerts) {

canonCs = new CodeSource(cs.getLocation(),

getSignerCertificates(cs));

}

}

} else {

if (extractSignerCerts) {

canonCs = new CodeSource(cs.getLocation(),

getSignerCertificates(cs));

}

}

return canonCs;

}

java encodedurl_Java ParseUtil.fileToEncodedURL方法代码示例相关推荐

  1. java kryo_Kryo框架使用方法代码示例

    Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...

  2. java readtimeout_Java HttpURLConnection.getReadTimeout方法代码示例

    import java.net.HttpURLConnection; //导入方法依赖的package包/类 /** * 得到响应对象 * * @param urlConnection * @retu ...

  3. java invalidate_Java Component.invalidate方法代码示例

    import java.awt.Component; //导入方法依赖的package包/类 /** Installs the component we will embed to display t ...

  4. java hasmoreelements_Java IOException.hasMoreElements方法代码示例

    import java.io.IOException; //导入方法依赖的package包/类 /** * fileName���� ���� package �������� ������ ���� ...

  5. java methode_Java Method.getTypeParameters方法代码示例

    import java.lang.reflect.Method; //导入方法依赖的package包/类 private void validateRuleMethod(MethodRuleDefin ...

  6. java setmethod_Java Operation.setJavaMethod方法代码示例

    import com.sun.tools.internal.ws.processor.model.Operation; //导入方法依赖的package包/类 private void createJ ...

  7. java cancel_Java RunnableFuture.cancel方法代码示例

    import java.util.concurrent.RunnableFuture; //导入方法依赖的package包/类 @Test public void testSnapshotAsyncC ...

  8. java getevent_Java ActionEvent.getWhen方法代码示例

    import java.awt.event.ActionEvent; //导入方法依赖的package包/类 @Override final public void actionPerformed(A ...

  9. java deepcopy_Java JsonNode.deepCopy方法代码示例

    import com.fasterxml.jackson.databind.JsonNode; //导入方法依赖的package包/类 /** * Applies this schema rule t ...

最新文章

  1. Linux运维需要知道的Redis经验
  2. 使用XML作为配置表,WinForm程序读取配置表来动态显示控件
  3. 多元化和专一化的关系
  4. Golang之channel操作
  5. 推荐一款基于web的Unix系统管理工具webmin
  6. win10下markdownpad2显示问题
  7. div中同时存在文本和数字超过两行出省略号
  8. 【Ansible】Ansible控制windows插件安装及运行error与解决方法
  9. django-cbv与fbv
  10. 【2018/04/02】学习小记
  11. acl的access-list命令使用详解
  12. DHTML中window的使用
  13. 分享30个网页设计色彩搭配的优秀案例
  14. web安全的学习路线
  15. ad18/ad19/ad20/ad21/ad22新版ADgaber导出(含官方教程)(含坐标文件)
  16. led灯条串联图_10个LED灯并联再串联
  17. Linux 复制文件
  18. 空间滤波器 平滑滤波器 锐化滤波器
  19. php在线编译器插件火狐,Firefox浏览器JS调试插件下载
  20. 食品加工企业自营商城小程序开发,帮助企业增加销售渠道,提高销量

热门文章

  1. 【发布】温度监测报警器v1.3a稳定版!
  2. linux 进程防火墙连接管理,Linux系统管理初步(五)系统防火墙控制程序firewalld...
  3. 标准PSO辨识NARMAX模型源码程序
  4. 汇编指令:LDM、STM详解
  5. C#当中的BeginInvoke和EndInvoke
  6. 天津:第十六届西青区民俗文化旅游节开幕
  7. ora-01017 invalid username/password logon denied
  8. spring_security权限应用
  9. 怎样在Github参与一个开源项目
  10. table中tr使用toggle不好,选择换一张方式