All pastes #971151 Raw Edit

Something

public text v1 · immutable
·published 2008-04-04 15:23 UTC
rendered paste body
+        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;
     }