zoukankan      html  css  js  c++  java
  • 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:1466519819@qq.com

    转载请注明来源: http://blog.csdn.net/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解决

     

  • 相关阅读:
    .net日期类与UNIX时间戳的相互转换,长数字
    钉钉的生日模块在哪
    js判断手机是苹果(IOS)还是安卓(android) H5手机端自适应宽高
    .net网站部署winserver2008R2 IIS只列出目录 浏览只显示目录浏览
    ajax有时请求不到数据 后台,有时收不到返回值的解决办法
    overflow不超出时不显示滚动条 属性解决内容未超出依然显示滚动条轨道的问题
    PB取datawindow生成的语句。要在datawindow的sqlpreview事件
    电脑C盘缓存路径在哪,清理C盘哪个文件夹可以删
    PB里执行写SQL语句
    SQL SERVER合并行。将多行数据合并成一行,字符串拼接
  • 原文地址:https://www.cnblogs.com/attilax/p/5963413.html
Copyright © 2011-2022 走看看