Giter VIP home page Giter VIP logo

tomcat8.5.61's Introduction

Tomcat 8.5.61源码

用途

学习源码

JVM配置

VM options: -Dcatalina.home="/Users/liuyunyang/work/projects/idea/apache-tomcat-8.5.61"

// -D 是java设置参数的固定写法

// catalina.home 是参数名

// =的后面是tomcat源码项目的catalina-home的路径,当这个路径包含空格是需要使用引号括起来

源码下载地址

https://archive.apache.org/dist/tomcat/

配置过程参考文章

https://www.tqwba.com/x_d/jishu/6220.html

控制台乱码问题

修改两个类,如下: org.apache.tomcat.util.res.StringManager类

public class StringManager {
    // ......

    public String getString(final String key, final Object... args) {
        String value = getString(key);
        if (value == null) {
            value = key;
        }

        // 控制台乱码问题
        try {
            value = new String(value.getBytes("ISO-8859-1"), "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }

        MessageFormat mf = new MessageFormat(value);
        mf.setLocale(locale);
        return mf.format(args, new StringBuffer(), null).toString();
    }

    // ......
}

org.apache.jasper.compiler.Localizer类

public class Localizer {
    // ......

    public static String getMessage(String errCode) {
        String errMsg = errCode;
        try {
            if (bundle != null) {
                errMsg = bundle.getString(errCode);
            }
        } catch (MissingResourceException e) {
        }

        // 控制台乱码问题
        try {
            errMsg = new String(errMsg.getBytes("ISO-8859-1"), "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return errMsg;
    }

    // ......
}

tomcat8.5.61's People

Contributors

myturn0 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.