jax-rs-spec
  1. jax-rs-spec
  2. JAX_RS_SPEC-442

Client-side response status code comparison is too verbose

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: runtime
    • Labels:
      None

      Description

      In order to safely compare Response status code with a built-in enum, you need to write the condition as:

        Response.Status.CREATED.getStatusCode() == response.getStatus();
      

      This is too verbose we should expose an API extension that will make this comparison less verbose and more convenient to use.

        Activity

        Hide
        cowwoc added a comment -

        JAX-RS 1.0 code was also more readable. We used to be able to use a switch statement and case INTERNAL_SERVER_ERROR. Now we're forced to case 500.

        Case statements become much harder to read once you stray away from the common response codes.

        Show
        cowwoc added a comment - JAX-RS 1.0 code was also more readable. We used to be able to use a switch statement and case INTERNAL_SERVER_ERROR . Now we're forced to case 500 . Case statements become much harder to read once you stray away from the common response codes.

          People

          • Assignee:
            Unassigned
            Reporter:
            Marek Potociar
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: