Hi,
I've this simple StatusService:
@Override
public Status getStatus(Throwable throwable, Request request, Response
response) {
final Writer result = new StringWriter();
final PrintWriter printWriter = new PrintWriter(result);
throwable.printStackTrace(printWriter);
return new Status(Status.SERVER_ERROR_INTERNAL, result.toString());
}
@Override
public Representation getRepresentation(Status status, Request request,
Response response) {
StringBuilder buffer = new StringBuilder();
buffer.append("<html><head><title>").append(status.getName()).append("</title></head><body>");
buffer.append(status.getCode()).append("<br/>");
buffer.append(status.getName()).append("<br/>");
buffer.append(status.getUri()).append("<br/>");
buffer.append(status.getDescription()).append("<br/>");
return new StringRepresentation(buffer.toString(),
MediaType.TEXT_HTML);
}
If an exception is thrown within my application I obtain a "strange" response.
The response headers are:
500 java.lang.RuntimeException: message
whereas the content is the HTTP header + the buffer.toString() content:
Date: Wed, 14 Nov 2007 13:25:19 GMT
Server: Noelios-Restlet-Engine/1.0.5
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 2236
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
<html><head><title>Internal Server Error</title></head><body>500<br/>Internal
Server
Error<br/>http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1<br/>java.lang.RuntimeException:
message
[ stacktrace follows ]
It is a genuine bug? I'm using restlet 1.0.5.
--
-- Davide Angelocola