Explorer4JSP工具-JavaWeb-JSP技术研发人员必备工具

Explorer4JSP工具

——JavaWeb-JSP技术研发人员必备工具

简介

  Explorer4JSP是一款采用JSP技术编写的工具,用于对Jsp服务下指定目录的文件浏览。Tomcat或其它JavaWeb服务能设置目录文件的浏览,但那是对整个工程而言的,并且需要更改工程配置才能实现(需要重启Server),不灵活。我开发的这个文件浏览工具只有一个简单的JSP页面($files.jsp),将该页面放置在需要浏览的目录下,然后访问该文件,将显示该文件所在目录下的所有文件以及所有子目录下的文件。

工具特点

  1. 列表和缩略图两种浏览模式
  2. 预置7种尺寸缩略图
  3. 仿Win7地址栏导航方式
  4. 支持4种文件排序方式
  5. 大图片缩略图转换,能将超过512K的大图片(照片通常在1M以上)转换成缩略图尺寸,减小浏览器压力及带宽压力,提高浏览速度
  6. 缩略图缓存设置,能大大提高频繁切换路径的浏览速度
  7. 中文名支持,使用UTF8编码可完美支持中文文件名

示例

界面示例

(缩略图示例)

界面示例
(列表示例)

版本历史

  • V11.05.25-初始版本(已删除)
  • V11.05.31-缩略图优化版本(已删除)
  • V11.06.07-BUG修正版【允许工程目录+允许中文文件名+$files.jsp更名】

使用技巧

  • 支持中文名方法

  因为Tomcat默认使用ISO-8859-1来处理GET请求,所以只要更改Tomcat配置:

<Connector port="8080"

protocol="HTTP/1.1"

URIEncoding="utf-8"
maxThreads="150"

connectionTimeout="20000"
redirectPort="8443" />

  其中设置标红属性为UTF-8即可。

  其它JAVA WEB类同。

 

  附件是该工具文件,下载到需要浏览的JavaWeb目录,然后访问即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
package com.hexiang.utils; import java.io.*; /** * FileUtil. Simple file operation class. * * @author BeanSoft * */ public class FileUtil { /** * The buffer. */ protected static byte buf[] = new byte[1024]; /** * Read content from local file. FIXME How to judge UTF-8 and GBK, the * correct code should be: FileReader fr = new FileReader(new * InputStreamReader(fileName, "ENCODING")); Might let the user select the * encoding would be a better idea. While reading UTF-8 files, the content * is bad when saved out. * * @param fileName - * local file name to read * @return * @throws Exception */ public static String readFileAsString(String fileName) throws Exception { String content = new String(readFileBinary(fileName)); return content; } /** * 读取文件并返回为给定字符集的字符串. * @param fileName * @param encoding * @return * @throws Exception */ public static String readFileAsString(String fileName, String encoding) throws Exception { String content = new String(readFileBinary(fileName), encoding); return content; } /** * 读取文件并返回为给定字符集的字符串. * @param fileName * @param encoding * @return * @throws Exception */ public static String readFileAsString(InputStream in) throws Exception { String content = new String(readFileBinary(in)); return content; } /** * Read content from local file to binary byte array. * * @param fileName - * local file name to read * @return * @throws Exception */ public static byte[] readFileBinary(String fileName) throws Exception { FileInputStream fin = new FileInputStream(fileName); return readFileBinary(fin); } /** * 从输入流读取数据为二进制字节数组. * @param streamIn * @return * @throws IOException */ public static byte[] readFileBinary(InputStream streamIn) throws IOException { BufferedInputStream in = new BufferedInputStream(streamIn); ByteArrayOutputStream out = new ByteArrayOutputStream(10240); int len; while ((len

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值