Atitit.url 汉字中文路径  404 resin4 resin  解决  v2 q329

Atitit.url 汉字中文路径  404 resin4 resin  解决  v2 q329

1. Pluginx机制1

2. Code1

3. 参考4

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:[email protected]

转载请注明来源: 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 IOExceptionServletException {

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解决

时间: 2024-08-04 18:43:46

Atitit.url 汉字中文路径  404 resin4 resin  解决  v2 q329的相关文章

Atitit.404错误解决标准流程and url汉字中文路径404错误resin4 resin chinese char path 404 err解决

Atitit.404错误解决标准流程and url汉字中文路径404错误resin4 resin chinese char path 404 err解决 1. #原因解析 1 2. #解决方式 2 3. 输出图片流... 2 4. --code 2 5. 参考 3 1. #原因解析 查看累挂发送d url,,,俄使用的是ff..它把url转换成个 http://localhost/img/QQ%E6%88%AA%E5%9B%BE20140401175433.jpg 发送出去..每汉字3个%字符,

Mint Linux自定义快捷键不支持中文路径的问题的解决

/*********************************************************************  * Author  : Samson  * Date    : 04/28/2014  * Test platform:  *              3.11.0-12-generic #19-Ubuntu  *              GNU bash, version 4.2.45  * ****************************

IE浏览器URL中的查询条件中包含中文时报404的解决办法

情况是比如我输入如下URL到IE浏览器: http://localhost:8090/RPT_TYSH_JL_ZD_DETAIL.html?pageIndex=1&year=2018&month=7&merAddress=鹿港 会出现404错误. 解决办法是:修改IE浏览器中的配置: 点击IE浏览器右上方的设置按钮 --> Internet选项 --> 高级 --> "国际*"中勾选上"发送 Intranet URL的UTF-8字符串

iOS开发-url包含中文报错解决办法

经常, 我们用通过这样的方法调用API. NSString* urlString = [NSString stringWithFormat:@"http://api.douban.com/v2/movie/search?q=%@", content]; NSURL *url = [NSURL URLWithString:urlString]; testRequest = [ASIHTTPRequest requestWithURL:url]; [testRequest setDeleg

关于WWW加载有中文路径的问题

U3D的WWW加载虽然比较强大,功能很多,但是却不支持中文路径.这就有点杯具了,这个BUG到现在还没改过来…… 如果只开发移动端和网页端,支持不支持也没关系.但假设是开发客户端较为大型的游戏,未免会用到Assetbundle加载,一旦用到就涉及用户是否将游戏放在有中文的路径上了. 一旦有中文,所有ASSETBUNDLE都将无法加载成功. ASSETBUNDLE的路径假设有中文…… 方法1: FILESTREAM加载,再转换类型,这个方法还没测试,不过听说即便异步加载也会卡来卡去. 方法2:判断该

ajax url参数中文乱码解决

最近在学习编写门户网站时,通过ajax的url参数传递字符串给服务器遇到中文乱码的问题,如果需要传递的数据不通过url直接传递,比如用jquery.post参数方式传递变量,则不会出现乱码问题,网上搜索找到如下解决方法: 1. 对js的url中的中文参数值使用两次encodeURI(),即 encodeURI(encodeURI("url的中文参数值")), 2. C#中使用System.Web.HttpUtility.UrlDecode(context.Request["p

ifstream中文路径问题分析

最近维护一个项目,遇到了ifstream在中文路径下打开文件失败的bug,我搜索了一下,最后整理成下文以后日后查阅. 一.问题重现 vs2008下创建一个简单win32工程. 使用ANSI编码方式:项目属性页 ->配置属性 ->常规 ->项目默认值 ->字符集中选择"使用多字节字符集". 简单出错代码: #include "stdafx.h" #include <Windows.h> #include <fstream>

URL传中文参数导致乱码的解决方案之encodeURI

通过URL传中文参数时,在服务端后台获取到的值往往会出现乱码问题,解决方案有很多种,本文主要介绍如何通过encodeURI来解决中文乱码问题: first:前端传递参数的时候需要对中文参数进行两次encodeURI处理: ?var requestUrl = 'url?roleName='+encodeURI(encodeURI("rowObj.appName")); 注:rowObj.appName?表示即将传到后台的带中文的字符串 ?second:在服务器端后台程序代码中要用java

JS URL传递中文参数时出现乱码的处理

原文:JS URL传递中文参数时出现乱码的处理 在浏览器中显示的地址是这样的: 但是按F12调试的时候的地址却变化掉了: 这个肯定是是因为浏览器对url路径默认编码了.这个问题是在我们去取值的时候,得到的就是后面那一大串稀奇古怪的东西.得不到我们想要的值.怎么办呢?这里写出来的只是自己的解决方法,也许不能通用,跟大家分享下,有更好的方法,告我一声.      //得到url中的值 function request(paras){ var url = location.href; var para