I know this isn't the right mailing list but there's a lot
of knowledgeable people here so I'd give it a shot.

When I was hosting on Google App Engine the java servlet
HttpServletResponse.sendError would return the 2nd parameter text in plain
text.

Now that I'm hosting on Tomcat it's putting the text inside an <HTML> body.
I'd like to to return the text in plain text instead.

This is my code:
String resultStr = "Request " +  req.getRequestURI() + ": __developerId " +
__developerId + " in use.";
resp.getWriter().println(resultStr);
resp.sendError(HttpServletResponse.SC_CONFLICT, resultStr);

I tried this, but it still returned the text inside an HTML body.

resp.setContentType("text/plain");
String resultStr = "Request " +  req.getRequestURI() + ": __developerId " +
__developerId + " in use.";
resp.getWriter().println(resultStr);
resp.sendError(HttpServletResponse.SC_CONFLICT);

Anyone know how to do this?

Reply via email to