CXF
  1. CXF
  2. CXF-4800

Exception mapper on the client in case of method Response retun value

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.2
    • Fix Version/s: 3.0.0-milestone1
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      TestCase:
      JAX-RS annotated business method returns Response.
      ExceptionMapper is registered on the client side.

      Current behavior: If method throws RuntimeException, exception mapper is invoked for all methods except returning Response ones.

      Desired behavior: Invoke exception mapper for methods returning Response as well, however only for "bad responses" status is >= 300. If exception mapper returns null instead exception, business method should be invoked with "bad response".

      The reason: as far as user registers exception mapper on the client side (it is not mandatory), it makes sense to handle all errors in consistent way via exception mapper. In some special cases, when user would like to process "bad" HTTP Response in the business method, he can return null instead exception in exception mapper.

        Activity

        Hide
        Sergey Beryozkin added a comment -

        Hi,

        > If exception mapper returns null instead exception, business method should be invoked with "bad response".

        Can you clarify this point please ? I think if the mapper does not map then Response needs to be returned as is

        thanks, Sergey

        Show
        Sergey Beryozkin added a comment - Hi, > If exception mapper returns null instead exception, business method should be invoked with "bad response". Can you clarify this point please ? I think if the mapper does not map then Response needs to be returned as is thanks, Sergey
        Hide
        Andrei Shakirin added a comment -

        Hi Sergey,

        >> If exception mapper returns null instead exception, business method should be invoked with "bad response".

        > Can you clarify this point please ? I think if the mapper does not map then Response needs to be returned as is

        I mean the following case:
        Client receives "bad response", mapper is registered and invoked, but it doesn't map Response to exception (method fromResponse(Response response) returns null).
        I propose that runtime will call business method with received response (as it is) and user still has the possibility to react on error in business code.
        WDYT?

        Regards,
        Andrei.

        Show
        Andrei Shakirin added a comment - Hi Sergey, >> If exception mapper returns null instead exception, business method should be invoked with "bad response". > Can you clarify this point please ? I think if the mapper does not map then Response needs to be returned as is I mean the following case: Client receives "bad response", mapper is registered and invoked, but it doesn't map Response to exception (method fromResponse(Response response) returns null). I propose that runtime will call business method with received response (as it is) and user still has the possibility to react on error in business code. WDYT? Regards, Andrei.
        Hide
        Sergey Beryozkin added a comment -

        Hi Andrei,

        yes, +1, we are on the same line here, thanks

        Show
        Sergey Beryozkin added a comment - Hi Andrei, yes, +1, we are on the same line here, thanks

          People

          • Assignee:
            Andrei Shakirin
            Reporter:
            Andrei Shakirin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development