Hi,
I've an Application that sets it's StatusService. Here the code (imports
omitted):
public class MyStatusService extends StatusService {
public MyStatusService() {
super(true);
}
@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(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);
}
}
The status service is then connected to the Application via setStatusService()
instance method.
my intent is to return the complete exception as html page. I'm expecting
getStatus()
to be called before getRerpresentation() but actually is never called.
It's a bug?
--
Best Regards,
Davide Angelocola