+ try { myConverter.service(req, resp); - - return null; + } + catch( Exception e ) { + RestletException re = null; + if ( e instanceof RestletException ) { + re = (RestletException) e; + } + if ( re == null && e.getCause() instanceof RestletException ) { + re = (RestletException) e.getCause(); + } + + if ( re != null ) { + resp.setStatus( re.getStatus().getCode() ); + re.getRepresentation().write(resp.getOutputStream()); + resp.getOutputStream().flush(); + } + else { + resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + } + } + + return null; }