maven - Apache Tomcat Maven 插件 uriEncoding 不适用于 https

标签 maven tomcat utf-8 https maven-tomcat-plugin

我正在使用 tomcat7-maven-plugin 来运行我的应用程序 (tomcat7:run)。我用的是 <uriEncoding>utf-8</uriEncoding>在没有 https 的配置中,一切正常。但是一旦我添加了 https,编码就停止工作了。

当我在客户端发出这样的请求时:https://localhost:8443/ROOT/checkName?mediaName=%C3%A7%C3%A7

我在服务器上收到这个:çç

这是我的一些 pom.xml:

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <warSourceDirectory>src/main/webapp</warSourceDirectory>
                    <path>/${project.warname}</path>
                    <warFile>target/${project.warname}##${maven.build.timestamp}-${project.name}-v${project.version}</warFile>
                    <uriEncoding>utf-8</uriEncoding>

                    <!-- HTTPS -->
                    <httpsPort>8443</httpsPort>
                    <keystoreFile>${user.home}/.mvnkeystore</keystoreFile>
                    <keystorePass>changeit</keystorePass>
                    <!-- HTTPS -->

                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.25</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.tomcat.embed</groupId>
                        <artifactId>tomcat-embed-core</artifactId>
                        <version>${tomcat.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

和 web.xml:

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>securedapp</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

如果我删除 https 标签,uriEncondig再次开始工作。

最佳答案

这是 Apache Tomcat Maven 插件的已报告错误 - MTOMCAT-264 . 有一个开放的PR in github修复它。

您或许可以使用 serverXml 解决此问题带有文档中提到的警告的参数。

serverXml: server.xml to use Note if you use this you must configure in this file your webapp paths.

关于maven - Apache Tomcat Maven 插件 uriEncoding 不适用于 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34619248/

相关文章:

php - utf-8 的 preg_match 规则

android - 错误:找不到com.android.tools.build:gradle:3.1.4。需要的人:com.jakewharton:butterknife-gradle-plugin:10.1.0

java - 将 Maven 项目转换为 EAR

java - Tomcat 7 和 Grails 部署 - conf/web.xml 应该是什么样的?

MYSQL| ENCODE() 输出 blob 而不是文本

错误为 "illegal/malformed utf-8"的 Ruby to_json 问题

maven - 运行 jar 文件时 spring boot 中的 java.lang.ClassNotFoundException - 添加了库

java - 带有 maven 和无法解析的构建扩展的 Android : Plugin com. jayway.maven.plugins.android.generation2 :android-maven-plugin:3. 9.0-rc.3

java - Spring Boot 应用程序未在 Tomcat 上启动

linux - 无法使用 visualvm 和相同的 tempdir 分析本地 tomcat