Re: JSR311: Exception Handling

From: Stephan Koops <>
Date: Sat, 05 Apr 2008 00:50:14 +0200

Hi Marc,

    * AFAIK it is not possible to get the generic class of the
      implementation of a generic interface. So how to get the exception
      type of a concrete ExcpetionMapper? Sorry, that this comes late.
      If I miss something, please let me know. (Java 5.0, not only 6.0)
    * Should the ExceptionMapper also be used, if a @*Param conversion
      throws an Exception and no Default is available? IMO not, because:
          o For problems while converting to @PathParam and @MatrixParam
            I think status 404 (not found) is the best: If the an URI
            part could not be converted (e.g. int as id required, but a
            unconvertable String was given), the resource does not
            exist. Because the ExceptionMapper doesn't really know the
            source of the exception, it could not react differentiated.
          o For problems while converting to @CookieParam, @HeaderParam
            and @QueryParam I prefer 400 (bad request).
          o IMO a special handling is only useful for
            WebApplciationExceptions (to be mapped as every
            WebApplicationException), but theoretical this is not
            allowed, but may occur.
    * IMO it is useful to add also explicit to the javadoc
      ExceptionMapper.toResponse(.), that this method should not throw
      an WebApplicationException, because it is allowed at nearly all
      code point.

best regards