Wednesday, March 25, 2009

My company's new website

http://www.codeark.com

comments will be happily accepted! :)

(even negative ones, just be gentle...)

Saturday, March 14, 2009

Wicket, Ajax, UTF-8 and Tomcat connectors

While working on one of my backoffice applications, I stumbled upon a problem where hebrew text would turn into encoded gibberish after inputing it into an ajax editable control (like AjaxEditableLabel or AjaxEditableMultiLineLabel).

After looking around in wicket's ajax debug console I found out that the problem was on the server side, quick googling action turned out the following possible problem/solution, the tomcat connector's declaration is missing a URIEncoding attribute:
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8"/>
Original post here

I was very happy its a simple solution and was almost 100% this would solve the problem, However, it didn't do the trick! why?!

Well, My tomcat sits behind an apache httpd server (proxy), because I like to complicate things sometimes (and because my server is a hybrid serving php, java, python perl and so on). Now, apache and tomcat communicate via AJP protocol, so the URIEncoding attribute should be present for that connector declaration as well:
<Connector
server="Apache PowerCore"
port="8009"
protocol="AJP/1.3"
URIEncoding="UTF-8" />
For the sake of computer voodoo, I left the encoding attribute in the http connector as well. Computer voodoo is a powerful thing :)