我使用tomcat7-maven-plugin运行我的应用程序(tomcat7 7: run )。我在没有https的配置中使用<uriEncoding>utf-8</uriEncoding>,一切都很好。但是一旦我添加了https,编码就停止工作了。
当我在client上提出这样的请求时: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将重新开始工作。
发布于 2016-01-06 10:12:47
这是Apache插件- MTOMCAT-264的一个报告错误。有一个开放的github中的PR来修复它。
您可能可以通过使用serverXml参数和文档中提到的警告来解决这个问题。
serverXml:要使用server.xml,如果您使用它,您必须在这个文件中配置webapp路径。
发布于 2016-01-05 22:56:01
我认为您需要在服务器.See 这里相关问题中配置HTTPS连接器。在httpsPort属性上赋值这一事实意味着您只启用了连接器(我猜有一些默认值)--作为插件文档显示。
您需要使用以下内容配置连接器:
<Connector port="443" protocol="HTTP/1.1"
maxThreads="150" connectionTimeout="20000"
SSLEnabled="true" scheme="https" secure="true"
keystoreFile="conf/.keystore"
keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"
URIEncoding="UTF-8" compression="on"/>希望它能帮上忙
https://stackoverflow.com/questions/34619248
复制相似问题