I'm using tomcat7-maven-plugin to run my application (tomcat7:run). I was using <uriEncoding>utf-8</uriEncoding>
in configurations without https and everything was working fine. But once I added https the encoding stopped working.
When I make a request like this on client: https://localhost:8443/ROOT/checkName?mediaName=%C3%A7%C3%A7
I receive this on server: çç
Here is some of my 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>
And 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>
If I remove https tags, the uriEncondig
starts working again.
It is a reported bug of the Apache Tomcat Maven Plugin - MTOMCAT-264. There is an open PR in github to fix it.
You can probably workaround it by using serverXml
parameter with the caveat mentioned in the documentation.
serverXml
: server.xml to use Note if you use this you must configure in this file your webapp paths.