Skip to main content

Configuring URL Encoding on Tomcat Application Server

Application servers may have different settings for character encodings. We strongly recommend UTF-8 where possible.

By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received from a browser. This can cause problems when Confluence's encoding is UTF-8, and you are using international characters in the names of attachments or pages.

Tomcat

To configure the URL encoding in Tomcat:

Step 1 - Configure connector:
  1. Edit conf/server.xml and find the line where the Coyote HTTP Connector is defined. It will look something like this, possibly with more parameters:
    <Connector port="8080"/>
  2. Add a URIEncoding="UTF-8"property to the connector:
    <Connector port="8080" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443"
        URIEncoding="UTF-8"/>
  3. If you are using mod_jk you should apply the same URIEncoding parameter as above to the AJP connector if you are using mod_jk, and add the following option to your Apache mod_jk configuration:
   <Connector port="8009" protocol="AJP/1.3" URIEncoding="UTF-8"/>
    JkOptions +ForwardURICompatUnparsed



Step 2 - Add Encoding Filter:

The following filter settings need to be added  in  “web.xml” of {Tomcat_DIR}/conf folder:
  <!-- A filter that sets character encoding that is used to decode -->
  <!-- parameters in a POST request →

    <filter>
        <filter-name>setCharacterEncodingFilter</filter-name>
        <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </filter>
   <filter>
      <filter-name>Set Character Encoding</filter-name>
      <filter-class>com.matrixone.servlet.SetCharacterEncodingFilter</filter-class>
      <init-param>
         <param-name>encoding</param-name>
         <param-value>UTF-8</param-value>
      </init-param>
   </filter>

    <filter-mapping>
        <filter-name>setCharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


Step 3 - Restart Tomcat.





Related Blogs:

How To Install Apache Tomcat on Ubuntu
Tomcat Clustering: Loadbalancing with mod_jk and Apache

 




Comments

Popular posts from this blog

How to install Oracle JDK on Ubuntu from repository

This package provides Oracle Java JDK 7 (which includes Java JDK, JRE and the Java browser plugin). However, you can't only install Oracle JRE - the PPA only provides the full Oracle JDK7 package. To install: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-jdk7-installer And to uninstall: sudo apt-get remove oracle-jdk7-installer And to verify your installation: java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode) And to verify the web browser installation: http://java.com/en/download/installed.jsp Verified Java Version Congratulations! You have the recommended Java installed (1.7.0_51). And to update: If for some reason, the Java version in use is not 1.7.0, you can try to run the following command: sudo update-java-alternatives -s java-7-oracle To Install and Set in environment variable: To...

Configure Tomcat Web Management Interface

We already see, how to install tomcat in ubuntu in my previous blog( http://kmlsarwar.blogspot.com/2014/08/how-to-install-apache-tomcat-on-ubuntu.html ) In order to use the manager webapp installed, we must add a login to our Tomcat server. We will do this by editing the tomcat-users.xml file: sudo nano /etc/tomcat7/tomcat-users.xml    This file is filled with comments which describe how to configure the file. You may want to delete all the comments between the following two lines, or you may leave them if you want to reference the examples: <tomcat-users> </tomcat-users>  You will want to add a user who can access the manager-gui and admin-gui (the management interface that we installed in Step Three). You can do so by defining a user similar to the example below. Be sure to change the password and username if you wish: <tomcat-users> <user username="admin" password="password" roles="manager-gui,admin-gui"...

How to install play framework

Prerequisites To run the Play framework, you need JDK 6 or later . If you are using MacOS, Java is built-in. If you are using Linux, make sure to use either the Sun JDK or OpenJDK (and not gcj, which is the default Java command on many Linux distros). If you are using Windows, just download and install the latest JDK package. Note, Java 7 pre update 9 on MacOS has a bug that causes problems with futures and iteratees, including making large file uploads hang. If using Java 7 on MacOS, make sure you are using the latest version. Be sure to have the java and javac commands in the current path (you can check this by typing java -version and javac -version at the shell prompt). Download the binary package Download the latest Play standalone distribution and extract the archive to a location where you have both read and write access. (Running play writes some files to directories within the archive, so don’t install to /opt , /usr/local or anywhere else you’d need s...