tags:

views:

270

answers:

2

I writing a JSP program that needs to react on an existing program. It gets several variables that the JSP program needs to process and generate a response.

The existing program has his custom headers like:

Content-Type: application/x-server-response

But the JSP program returns its content with the wrong headers. Like this:

Content-Type: application/x-server-response;charset=UTF-8

The part thats killing the existing program is the charset. The program requires to get the repsonse with no charset set at all.

I've search the internet for this question and find more people with the same problem but the given results doesn't resolve the problem.

Is it possible to let the JSP program return its content with no charset at all?

A: 

Did you try setContentType("application/x-server-response"). I haven't tested but that's what the method seems to do.

Matthew Flaschen
It still adds the charset part in the header. Already tried it...
h3rj4n
What container are you using? I can't reproduce this with Tomcat.
kgiannakakis
A: 

A JSP creates text output, so the charset has to be added. The JSP behaviour ist correct! It seems to be a wrong implementation of the client using the JSP implemented server! The charset may be ignored, but the implementation seems to have content-type == "application/x-server-response" (may be PHP?) instead of parsing the header in a more correct way (see HTTP 1.1 for more information about header formats).

I think you wont get the JSP engine to suppress the charset parameter of the content-type header.

Arne Burmeister
Is it possible for Java to generate the response of a HTML call without the charset part? Or do I need to change to other language like PHP?
h3rj4n
To implement a server for a non-standard conform client, you need a non-standard conform server implementation. Maybe you find an old servlet container (Tomcat 4.0.4 or older?).
Arne Burmeister