Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Setting Content-Type in a custom response (mp2)

Steve Hay

2010-03-11

Replies: Find Java Web Hosting

Author LoginPost Reply
I have a mod_perl-2 handler that uses custom_response() to display error
messages if something goes wrong:

$r->custom_response(Apache2::Const::SERVER_ERROR, $error);
return Apache2::Const::SERVER_ERROR;

That almost works fine, but the trouble is that the Content-Type header
is always set to "text/html; charset=iso-8859-1", in which the charset,
at least, is potentially wrong: all the pages in my software produce
UTF-8 and are normally output with Content-Type "application/xhtml+xml;
charset=utf-8".

How do I set the Content-Type when issuing a custom_reponse()? The usual
thing of calling

$r->content_type("application/xhtml+xml; charset=utf-8");

doesn't seem to work in this case.
©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.