Hi Davide, The description property of the Status is supposed to contain a single line of text instead of a full document. This may be the root of your problems.
Could you create a bug report and attach a reproducible example (or your snippet) to it? http://restlet.tigris.org/issues/enter_bug.cgi It would also be useful it seems to also pass the exception as a parameter of the getRepresentation(...) method so you wouldn't have to use the Status object for this purpose. Best regards, Jerome > -----Message d'origine----- > De : Davide Angelocola [mailto:[EMAIL PROTECTED] > Envoyé : mercredi 14 novembre 2007 14:30 > À : [email protected] > Objet : StatusService issue > > 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.ht ml#sec10.5.1<br/>java.lang.RuntimeException: message > [ stacktrace follows ] > > It is a genuine bug? I'm using restlet 1.0.5. > > -- > -- Davide Angelocola

