小任班长 发布的文章

  IT 之家 9 月 22 日消息近年来已经有不少的网盘宣布关闭,现在网易网盘也正式发布公告,称将在 2019 年 11 月 30 日关闭,用户需要在此之前将自己的文件下载保存。

58990-mx7mev9of9t.png

  网易表示,网盘服务将在 2019 年 11 月 30 日关闭,届时 http://wp.163.com 也将停止访问。网易邮箱的用户可以在网易邮箱首页左侧文件中心访问并使用网盘,微信微博登录的用户到时候无法再登录。官方提醒用户务必在 2019 年 11 月 30 日前备份数据。

  据悉,网易网盘是网易公司推出的在线存储服务,向用户提供文件的存储、访问、备份、共享等文件管理功能。提供的积分兑换最高免费容量为 3G,可上传不超过 100M 的任意格式文件,永久存储。

背景:

www.mydomain.com 和 test.mydomain.com的三级域名是不同的。默认情况下在相同浏览器、不同tab页访问分别访问这两个域名的session不共享的。因为cookie的domain是不一样的,所以浏览器不能携带同一目录的sessionId给服务器。登录一个域名,切换到第二个域名时,需要重新登录。

使用一个过渡域名,将sessionID更新成一致

如下:

 String JSESSIONID = request.getSession().getId();//获取当前JSESSIONID (不管是从主域还是二级域访问产生)

 Cookie cookie = new Cookie("JSESSIONID", JSESSIONID);
 cookie.setDomain(".test.com"); //关键在这里,将cookie设成主域名,确保不同域之间都能获取到该cookie的值,从而确保session统一
 response.addCookie(cookie);  //将cookie返回到客户端
 request.getRequestDispatcher("indes.jsp").forward(request, response);

tomcat配置context增加属性:

<Context sessionCookieDomain=".mydomain.com" sessionCookiePath="/">

FilenameUtils工具类

是一个Java操作文件的常用库,是Apache对java的IO包的封装,这里面有两个非常核心的类FilenameUtils跟FileUtils,其中FilenameUtils是对文件名操作的封装;FileUtils是文件封装,开发中对文件的操作。

  • 引入commons-io包
<dependency>  
      <groupId>commons-io</groupId>  
      <artifactId>commons-io</artifactId>  
      <version>2.4</version>  
</dependency>  
  • 测试类代码
import java.util.ArrayList;  
import java.util.List;  
import org.apache.commons.io.FilenameUtils;  
import org.apache.commons.io.IOCase;  
/** 
 * org.apache.commons.io.FilenameUtils工具类笔记 
 * @author Ickes 
 */  
public class FilenameUtilsTest {  
    public static void main(String[] args) throws Exception {  
        String fileDirectory = "/D:/aa/bb/cc";   
        String fileName ="file.txt";  
        String fileFullName = fileDirectory +"/"+ fileName;  
        System.out.println("(1)显示linux路径:"+FilenameUtils.normalizeNoEndSeparator(fileFullName));  
        System.out.println("(2)合并目录和文件名为文件全路径:"+FilenameUtils.concat(fileDirectory, fileName));  
        System.out.println("(3)文件路径去除目录和后缀后的文件名:"+FilenameUtils.getBaseName(fileFullName));  
        System.out.println("(4)获取文件的后缀:"+FilenameUtils.getExtension(fileFullName));  
        System.out.println("(5)获取文件的完整目录:"+FilenameUtils.getFullPath(fileFullName));  
        System.out.println("(6)获取文件的目录不包含结束符:"+FilenameUtils.getFullPathNoEndSeparator(fileFullName));  
        System.out.println("(7)获取文件名称,包含后缀:"+FilenameUtils.getName(fileFullName));  
        System.out.println("(8)去除前缀的路径:"+FilenameUtils.getPath(fileFullName));   
        System.out.println("(9)去除前缀并结尾去除分隔符:"+FilenameUtils.getPathNoEndSeparator(fileFullName));  
        System.out.println("(10)获取前缀:"+FilenameUtils.getPrefix(fileFullName));  
        System.out.println("(11)获取前缀长度:"+FilenameUtils.getPrefixLength(fileFullName));  
        System.out.println("(12)获取最后一个.的位置:"+FilenameUtils.indexOfExtension(fileFullName));  
        System.out.println("(13)获取最后一个/的位置:"+FilenameUtils.indexOfLastSeparator(fileFullName));  
        System.out.println("(14)获取当前系统格式化路径:"+FilenameUtils.normalize(fileFullName));  
        System.out.println("(16)获取当前系统无结尾分隔符的路径:"+FilenameUtils.normalizeNoEndSeparator(fileDirectory));  
        System.out.println("(17)获取linux系统无结尾分隔符的路径:"+FilenameUtils.normalizeNoEndSeparator(fileDirectory));  
        System.out.println("(18)移除文件的扩展名:"+FilenameUtils.removeExtension(fileFullName));  
        System.out.println("(19)转换分隔符为当前系统分隔符:"+FilenameUtils.separatorsToSystem(fileFullName));  
        System.out.println("(20)转换分隔符为linux系统分隔符:"+FilenameUtils.separatorsToUnix(fileFullName));  
        System.out.println("(21)转换分隔符为windows系统分隔符:"+FilenameUtils.separatorsToWindows(fileFullName));  
        System.out.println("(22)判断目录下是否包含指定文件或目录:"+FilenameUtils.directoryContains(fileDirectory, fileName));  
        String linuxFileName = FilenameUtils.normalize(fileFullName);  
        System.out.println("(23)判断文件路径是否相同:"+FilenameUtils.equals(fileFullName, linuxFileName));  
        System.out.println("(24)判断文件路径是否相同,格式化并大小写不敏感:"+FilenameUtils.equals(fileFullName,   
                FilenameUtils.normalize(fileFullName),true,IOCase.INSENSITIVE));  
        System.out.println("(25)判断文件路径是否相同,格式化并大小写敏感:"   
                + FilenameUtils.equalsNormalized(fileFullName, linuxFileName));  
        System.out.println("(26)判断文件路径是否相同,不格式化,大小写敏感根据系统规则:windows:敏感;linux:不敏感:"  
                + FilenameUtils.equalsOnSystem(fileFullName, linuxFileName));   
        List<String> extensions = new ArrayList<>();    
        extensions.add("txt");    
        extensions.add("java");   
        System.out.println("(27)判断文件扩展名是否包含在指定集合中:"  
                + FilenameUtils.isExtension(fileFullName, extensions));   
        System.out.println("(28)判断文件扩展名是否等于指定扩展名:"   
                + FilenameUtils.isExtension(fileFullName, "txt"));  
        System.out.println("(29)判断文件扩展名是否包含在指定字符串数组中:"   
                + FilenameUtils.isExtension(fileFullName, new String[]{"txt","java"}));  
        System.out.println("(30)判断文件扩展名是否和指定规则匹配,大小写敏感:"  
                + FilenameUtils.wildcardMatch(fileName, "*.???"));   
        System.out.println("(31)判断文件扩展名是否和指定规则匹配,大小写不敏感:"   
                + FilenameUtils.wildcardMatch(fileName, "*.???",IOCase.INSENSITIVE));  
        System.out.println("(32)判断文件扩展名是否和指定规则匹配,根据系统判断敏感型:windows:不敏感;linux:敏感:"   
                + FilenameUtils.wildcardMatchOnSystem(fileName, "*.???"));  
          
    }  
}  
  • 打印结果
(1)显示linux路径:\D:\aa\bb\cc\file.txt  
(2)合并目录和文件名为文件全路径:\D:\aa\bb\cc\file.txt  
(3)文件路径去除目录和后缀后的文件名:file  
(4)获取文件的后缀:txt  
(5)获取文件的完整目录:/D:/aa/bb/cc/  
(6)获取文件的目录不包含结束符:/D:/aa/bb/cc  
(7)获取文件名称,包含后缀:file.txt  
(8)去除前缀的路径:D:/aa/bb/cc/  
(9)去除前缀并结尾去除分隔符:D:/aa/bb/cc  
(10)获取前缀:/  
(11)获取前缀长度:1  
(12)获取最后一个.的位置:17  
(13)获取最后一个/的位置:12  
(14)获取当前系统格式化路径:\D:\aa\bb\cc\file.txt  
(16)获取当前系统无结尾分隔符的路径:\D:\aa\bb\cc  
(17)获取linux系统无结尾分隔符的路径:\D:\aa\bb\cc  
(18)移除文件的扩展名:/D:/aa/bb/cc/file  
(19)转换分隔符为当前系统分隔符:\D:\aa\bb\cc\file.txt  
(20)转换分隔符为linux系统分隔符:/D:/aa/bb/cc/file.txt  
(21)转换分隔符为windows系统分隔符:\D:\aa\bb\cc\file.txt  
(22)判断目录下是否包含指定文件或目录:false  
(23)判断文件路径是否相同:false  
(24)判断文件路径是否相同,格式化并大小写不敏感:true  
(25)判断文件路径是否相同,格式化并大小写敏感:true  
(26)判断文件路径是否相同,不格式化,大小写敏感根据系统规则:windows:敏感;linux:不敏感:false  
(27)判断文件扩展名是否包含在指定集合中:true  
(28)判断文件扩展名是否等于指定扩展名:true  
(29)判断文件扩展名是否包含在指定字符串数组中:true  
(30)判断文件扩展名是否和指定规则匹配,大小写敏感:true  
(31)判断文件扩展名是否和指定规则匹配,大小写不敏感:true  
(32)判断文件扩展名是否和指定规则匹配,根据系统判断敏感型:windows:不敏感;linux:敏感:true

Xinhua News Agency, New Delhi, September 20 - Indian researchers have recently invented an environmentally friendly method of plastic degradation. They only need to place the plastic in a 70 ° C solution containing glucose and metal ions and continuously stir for several days to degrade the plastic into molecule.

A team led by researchers at the Indian Institute of Technology in Madras found that the new method can be used to degrade plastic materials such as Teflon. Related research papers have been published in the Journal of the American Chemical Society, Sustainable Chemistry and Engineering.

Polytetrafluoroethylene is a high performance material with heat resistance, chemical inertness, insulation stability and low friction. The researchers first placed a Teflon-coated magnetic stirrer in a 70 ° C solution for 15 days with metal ions and 1000 ppm glucose (1 ppm in parts per million).

The researchers then found tiny fragments of bright red glow on the surface of the solution. As a result, these bright tiny particles contained molecular fragments of a polytetrafluoroethylene polymer.

The study also found that Teflon did not show this degradation in the absence of agitation, glucose or metal ions; at room temperature, the degradation rate decreased; as the glucose content in the solution increased, the degradation of polytetrafluoroethylene The effect will be enhanced.

The researchers explained that PTFE may be electrically degraded into molecules by triboelectric stirring. They cautioned that because many modern cookware are coated with Teflon, similar chemical reactions can also occur on cookware, resulting in microplastics in food. Similarly, this triboelectric degradation process can also occur in the ocean, where there are a large number of metal ions, and the waves provide continuous agitation, which may be one of the ways in which marine microplastics are produced.

9 月 17 日,JDK/Java 13 正式 GA

79853-8p1si34rkrk.png

此版本带来了以下几大新特性:

JEP 350,Dynamic CDS Archives:扩展应用程序类-数据共享,以允许在 Java 应用程序执行结束时动态归档类。归档类将包括默认的基础层 CDS(class data-sharing)存档中不存在的所有已加载的应用程序类和库类。
JEP 351,ZGC: Uncommit Unused Memory:增强 ZGC 以将未使用的堆内存返回给操作系统。
JEP 353,Reimplement the Legacy Socket API:使用易于维护和调试的更简单、更现代的实现替换 java.net.Socket 和 java.net.ServerSocket API 使用的底层实现。

JEP 354: Switch Expressions (Preview):可在生产环境中使用的 switch 表达式,JDK 13 中将带来一个 beta 版本实现。switch 表达式扩展了 switch 语句,使其不仅可以作为语句(statement),还可以作为表达式(expression),并且两种写法都可以使用传统的 switch 语法,或者使用简化的“case L ->”模式匹配语法作用于不同范围并控制执行流。这些更改将简化日常编码工作,并为 switch 中的模式匹配(JEP 305)做好准备。

JEP 355,Text Blocks (Preview):将文本块添加到 Java 语言。文本块是一个多行字符串文字,它避免了对大多数转义序列的需要,以可预测的方式自动格式化字符串,并在需要时让开发人员控制格式。

详情查看:http://openjdk.java.net/projects/jdk/13

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。