Categories
Articles

Something about Oracle Application Server

Just recently, I came across a weird issue while running application on Oracle Application Server. The problem was faced by one of the projects in our department and was quite irritating one.

To tell you more about it, one of our application which quite huge and consists of many forms (entire application developed using Servlets, yes I said entire application) has given us worst nightmare. One of the form in the application has a provision to enter big text data in TextArea. The business user’s tried to copy text from a word document and pasted into the TextArea. This text was having one special character (copyright) which was copied as it is. When user submits data of the form and tries to retrieve it again, the copyright symbol was not displayed properly in TextArea. It was actually showing two weird characters instead of copyright symbol.

The problem turned out to be even worst, when we found that in some other pages the copyright character was displayed properly and had no issues. (We aren’t using html entities.)

After detailed scan of entire code, we couldn’t able to determine as whether it is a problem with Oracle Server or the program. Finally a thought came in my mind to check all the communication and data exchanged between Browser and Application server (Checking headers, posted data etc). Thanks to “HttpFox” plugin available in FireFox due to which I could able to get all the data I needed. After carefully analysing the headers, I found that there was only one difference in the problem page. The content type for the page was shown as “text/html”, while for other pages it was shown as “text/html; charset=ISO-8859-1”.

Hence we tried to set Character encoding using multiple options like calling setContentType on HttpServletResponse, adding meta tag to HTML and calling setCharacterEncoding. First two options couldn’t help us to get what we needed while last option simply failed to execute in Oracle Application Server.

The situation became even worst when we found that the same application was running well with Apache Tomcat. After again revisiting the code, we found one small difference and that is the problem page was using output stream to write data and others were using writer object. We changed the code to make use of writer object and Voila!!!, it worked. “HttpFox” displayed correct headers for the page and the copyright symbol was rendered perfectly.

I thought to share this experience, which might save others’ time.

By Carbon Rider

Hi this is Yogesh, welcome to my world. Being passionate about learning new technologies and building frameworks, I end up spending most of my time in front of computer. But over last few months, I realised apart from being good coder and designer (Yes I am) I have something hidden in me. And thats called ART.

Leave a Reply