Atitit.url 汉字中文路径 404 resin4 resin 解决 v2 q329
Atitit.url 汉字中文路径 404 resin4 resin 解决 v2 q329
1. 原理
过滤器 ,,拦截jpg with %的url...read img ,直接输出..
2. Pluginx机制
//if()
if(inied==false || new File("c:\\chinese_filename_hook_ini_pertime").exists()) {
new Pluginx().remove_all_filters("chinese_filename_hook");
new Pluginx().add_action("chinese_filename_hook", new JpgFilerProcesser());
new Pluginx().add_action("chinese_filename_hook", new TxtFilerProcesser());
inied=true;
}
}
作者:: ★(attilax)>>> 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
3. Code
package com.attilax.corePkg;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import aaaCfg.IocX;
import com.attilax.core;
import com.attilax.jsonX;
import com.attilax.io.filex;
import com.attilax.io.pathx;
import com.attilax.lang.Global;
import com.attilax.lang.Pluginx;
import com.attilax.net.JpgFilerProcesser;
import com.google.common.collect.Maps;
import com.sun.image.codec.jpeg.JPEGCodec;
/**
* com.focusx.util
* EncodingFilter.java
* author:vincente 2013-8-19
*/
@WebFilter(filterName = "ChineseCharFileUrlFilterName", urlPatterns = "/*")
public class ChineseCharFileUrlFilter implements Filter {
private String charset;
public void destroy() {
// TODO Auto-generated method stub
}
@SuppressWarnings("all")
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
try {
if(Global.map.get()==null)
Global.map.set(new HashMap());
Global.map.get().put("FileSeverDir", "Z:\\动作类");
new Pluginx().remove_all_filters("chinese_filename_hook");
new Pluginx().add_action("chinese_filename_hook", new JpgFilerProcesser(),0,null,null);
//new Pluginx().add_action("chinese_filename_hook", new TxtFilerProcesser());
Map m=new HashMap ();
m.put("req", request);
m.put("res", response);
new Pluginx().do_action("chinese_filename_hook",m,null);
} catch (Exception e) {
e.printStackTrace();
}
core.log("--loadorderO9::EncodingFilter");
//用init方法取得的charset覆盖被拦截下来的request对象的charset
request.setCharacterEncoding(this.charset);
//将请求移交给下一下过滤器,如果还有的情况下。
chain.doFilter(request, response);
}
//private String getImgPath(String url2) {
//String str;
//try {
//str = new String(url2.toString().getBytes("iso8859_1"), "GB2312");
//} catch (UnsupportedEncodingException e) {
//e.printStackTrace();
//throw new RuntimeException(e);
//}
//String f = pathx.webAppPath() + File.separator + str;
//File file = new File(f);
//return f;
//}
public void init(FilterConfig config) throws ServletException {
//从web.xml中的filter的配制信息中取得字符集
this.charset = config.getInitParameter("charset");
}
}
4. 参考
url汉字中文路径404异常resin4 resin chinese char path 404 err解决
Atitit.url 汉字中文路径 404 resin4 resin 解决 v2 q329的更多相关文章
- Atitit.404错误解决标准流程and url汉字中文路径404错误resin4 resin chinese char path 404 err解决
Atitit.404错误解决标准流程and 错误resin4 resin chinese char path 404 err解决 1. #原因解析 1 2. #解决方式 2 3. 输出图片流... 2 ...
- GDAL打开HDF格式时遇到的中文路径问题(未解决)
众所周知,中文环境下(VS2010 C++工程编码为多字节编码),在使用1.8.0版本以后的GDAL打开中文路径下的影像文件(如GeoTiff文件)时, 需对中文文件路径做特殊处理,有2种方法:(我使 ...
- iOS url带中文下载时 报错解决方法
问题描述:下载文件时, 请求带中文的URL的资源时,比如:http://s237.sznews.com/pic/2010/11/23/e4fa5794926548ac953a8a525a23b6f2/ ...
- url中含有中文路径时访问出现404问题
/** * URL中文字符编码转换 * @param url 含中文字符的URL * @return */ public static String getChineseURICode(String ...
- Nginx 使用中文URL,中文目录路径
Nginx 使用中文URL,中文目录路径 分类: linux2012-05-03 11:04 2672人阅读 评论(0) 收藏 举报 nginxurl服务器translationcentosserve ...
- IE浏览器URL中的查询条件中包含中文时报404的解决办法
情况是比如我输入如下URL到IE浏览器: http://localhost:8090/RPT_TYSH_JL_ZD_DETAIL.html?pageIndex=1&year=2018& ...
- atitit 英文与中文与阿拉伯文的简化解决方案.docx
atitit 英文与中文与阿拉伯文的简化解决方案.docx 1. 英文与中文与阿拉伯文的简化意义1 2. 简化的主要方法分类2 2.1. 同音替代法(比如o2o)2 2.2. 符号法(比如英文i18n ...
- url传递中文的解决方案
本文转载:http://www.cnblogs.com/ghd258/archive/2005/10/23/260241.html url传递中文的解决方案 1.设置web.config文件. < ...
- ifstream中文路径问题分析
最近维护一个项目,遇到了ifstream在中文路径下打开文件失败的bug,我搜索了一下,最后整理成下文以后日后查阅. 一.问题重现 vs2008下创建一个简单win32工程. 使用ANSI编码方式:项 ...
随机推荐
- [SDK2.2]Windows Azure Virtual Network (4) 创建Web Server 001并添加至Virtual Network
<Windows Azure Platform 系列文章目录> 在上一章内容中,笔者已经介绍了以下两个内容: 1.创建Virtual Network,并且设置了IP range 2.创建A ...
- HBase单个RegionServer的region数目上限
前言 RegionServer维护Master分配给它的region,处理对这些region的IO请求,负责切分在运行过程中变得过大的region, 由于集群性能( 分配的内存和磁盘是有限的 )有限的 ...
- oracle 表被锁了解决方案
使用下面的语句来查询被锁定的表: SELECT /*+ rule */ lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username User_name, ...
- Css定位总结
CSS position static 默认值,没有定位.元素框正常生成.块级元素生成一个矩形框,作为文档流(normal flow)的一部分,行内元素则会创建一个或多个行框,置于其父元素中.to ...
- The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. 错误的原因及解决方案
异常描述: 数据访问用EF,在数据库中用getdate()设置的默认值,程序中没有赋值. 出现异常. 此错误在百度上在我写此文之前没有多少解决方案,谷歌之等到以下两个有用的页: http://stac ...
- Wojilu学习笔记 (02)
使用RequireJS (1)整个页面,应该只有一个 <script src="" > 标签,并且放在页面底部,用来引入 RequireJS 和 main.js 文件 ...
- PHP多种形式发送邮件
1. 使用 mail() 函数 没什么好讲的,就是使用系统自带的smtp系统来发送,一般是使用sendmail来发.这个按照各个系统不同而定.使用参考手册. 2. 使用管道的形式 昨天刚测试成功,使用 ...
- Win10怎么输入法切换
按 windows 键+空格键,或者CTRL+Shift,或者只按 Shift,或者CTRL+空格 试试 方法/步骤1在桌面上点击[控制面板],进入控制面板后使用分类显示控制面板内的选项.然后在语言下 ...
- C#再识委托
从C#1到C#3逐步认识委托,由于C#4与C#5对委托改动并不大,故不作说明. 好久没看.NET了,一直在搞HybridAPP,都忘得差不多了,这也是自己从书中摘下笔迹,供日后翻阅. C# 1 1.什 ...
- C#编程总结(九)字符编码
C#编程总结(九)字符编码 相信大家一定遇到过乱码的问题,为什么会乱码呢?输出的数据怎么就跟输入的不一样呢? 最近在总结加密问题,也遇到了同样的困扰.所以今天来集中解决这个问题. 什么是字符? 字符是 ...