jersey
  1. jersey
  2. JERSEY-1892

Document behavior of throwing MappableContainerException from ExceptionMapper

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 1.17, 2.0-rc2
    • Fix Version/s: None
    • Component/s: docs
    • Labels:
      None

      Description

      ExceptionMappers need to be able to re-throw exceptions (in case they decide they didn't want to intercept the exception after all). In Jersey 1.x this is accomplished by throwing MappableContainerException. It's not clear how to accomplish the same in Jersey 2.x.

      Either way, ExceptionMapper's Javadoc should document this behavior. The current Javadoc says that throwing any RuntimeException will result in a Response.Status.INTERNAL_SERVER_ERROR response but this isn't true for MappableContainerException.

        Activity

        Hide
        Michal Gajdos added a comment -

        In Jersey 2.x you can implement ExtendedExceptionMapper (see [1]) instead of ExceptionMapper to decide whether you want to map an Exception or not. ExceptionMapper is part of JAX-RS and MappableContainerException (1.x) is Jersey specific so because of this the JavaDoc of ExceptionMapper cannot be modified.

        [1] https://jersey.java.net/apidocs/latest/jersey/org/glassfish/jersey/spi/ExtendedExceptionMapper.html

        Show
        Michal Gajdos added a comment - In Jersey 2.x you can implement ExtendedExceptionMapper (see [1] ) instead of ExceptionMapper to decide whether you want to map an Exception or not. ExceptionMapper is part of JAX-RS and MappableContainerException (1.x) is Jersey specific so because of this the JavaDoc of ExceptionMapper cannot be modified. [1] https://jersey.java.net/apidocs/latest/jersey/org/glassfish/jersey/spi/ExtendedExceptionMapper.html
        Hide
        cowwoc added a comment -

        Does it make sense to discuss this in the Jersey user guide?

        Show
        cowwoc added a comment - Does it make sense to discuss this in the Jersey user guide?

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            cowwoc
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: