3

I have some PDF Documents in my Servlet that contain ä,ö,ü,ß, etc. On accessing the documents like this http://hostname:8080/ServletName/test_ä.txt the tomcat initially responded with an 404. After changing the tomcat server.xml from this

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" tomcatAuthentication="false"/>

to this

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" tomcatAuthentication="false" URIEncoding="UTF-8"/>

I was able to access the documents.

My Problem starts when I want to get the documents via IIS (isapi_redirect). When I call http://hostname/ServletName/test_ä.txt the Tomcat allways returns 404. (Documents without umlaut are served correctly)

The corresponding lines in the tomcat access log look like this:

IP... - - [date...] "GET /ServletName/test_%C3%A4.txt HTTP/1.1" 200 6
IP... - - [date...] "GET /favicon.ico HTTP/1.1" 200 21630
IP... - - [date...] "GET /ServletName/test_%C3%A4.txt HTTP/1.1" 404 1001

The first two lines result from accessing the documents directly (http://hostname:8080/...). The last line results from accessing trough IIS and isapi_redirect.

I dont understand why the call from the isapi_redirect is treated diffenrently by tomcat despite beeing the exact same URL (from the tomcat point of view).

steloe
  • 141
  • 2

1 Answers1

1

Problem solved.

Someone at the tomcat mailing list pointed out that the "URIEncoding" had to be added to the AJP connector config.

So, besides the change in the <Connector port="8080" tag in the Tomcat Server.xml you have to change this line

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

to this:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>

Now it works.

steloe
  • 141
  • 2