分类 技术相关 下的文章

在属性文件中定义session.timeout=:

server.port=8080
server.servlet.session.timeout=60m

springboot session

测试验证,在登录后的controll中输出超时时间:

HttpServletRequest request = ((ServletRequestAttributes)(RequestContextHolder.getRequestAttributes())).getRequest();
int maxInactiveInterval= request.getSession().getMaxInactiveInterval();

核心方法:

clearQueue
Method Call'clearQueue'
Remove all items from the file queue.

如点击事件:

<a href="javascript:$('#file_upload').uploadifive('clearQueue')">Clear Queue</a> 

常用的是在 onUploadComplete 后面执行,

'onUploadComplete' : function(file, data) {
            $(this).uploadifive('clearQueue'); 
  }

传统方式

File file = new File("/temp/1.txt");
//init array with file length
byte[] bytesArray = new byte[(int) file.length()];

FileInputStream fis = new FileInputStream(file);
fis.read(bytesArray); //read file into bytes[]
fis.close();

return bytesArray;

java.nio 方式,相对比较简洁

String filePath = "/temp/1.txt";

byte[] bFile = Files.readAllBytes(new File(filePath).toPath());
//or this
byte[] bFile = Files.readAllBytes(Paths.get(filePath));
免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。