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

Clarify what HttpHeaders.getRequestHeader should return when the header is not available

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1
    • Fix Version/s: ice box
    • Component/s: model api
    • Labels:
      None

      Description

      It is not clear what HttpHeaders.getRequestHeader should return when no given header is available.

      getRequestHeader(String) returns List. If we look at getAcceptableMediaTypes/getAcceptableLanguages, they return singleton lists with default values in case of missing Accept Accept-Language headers - so one may assume that getRequestHeader(String) should return an empty List if no header is available.

      On the other hand, getHeaderString returns 'null' when the header is not available. Also, the docs for getRequestHeader(String) say that it is a shortcut for getRequestHeaders().get(name), which also implies 'null'.

      Thus I'm nearly sure that getRequestHeader(String) needs to return 'null' if no header is available but I'd appreciate the clarifications at the API level.

        Activity

        Hide
        beryozkin_sergey added a comment -

        Marek, can you give me a favor and may be just answer it here if updating the docs is tricky at this stage ? I may need to do some more work depending on the answer

        Show
        beryozkin_sergey added a comment - Marek, can you give me a favor and may be just answer it here if updating the docs is tricky at this stage ? I may need to do some more work depending on the answer
        Hide
        Santiago Pericas-Geertsen added a comment -

        The fact that getRequestHeader(name) is equivalent to getRequestHeaders().get(name) implies that it must return null by definition Map.get(). I don't think the priority of this clarification is worth a re-spin of the release.

        Show
        Santiago Pericas-Geertsen added a comment - The fact that getRequestHeader(name) is equivalent to getRequestHeaders().get(name) implies that it must return null by definition Map.get(). I don't think the priority of this clarification is worth a re-spin of the release.
        Hide
        beryozkin_sergey added a comment -

        Sounds good. Hope you appreciate that there is some scope for the alternative reading. For example, one might've assumed that the Map has been prepared to have empty lists.

        Anyway, major thanks for the clarifications.

        Show
        beryozkin_sergey added a comment - Sounds good. Hope you appreciate that there is some scope for the alternative reading. For example, one might've assumed that the Map has been prepared to have empty lists. Anyway, major thanks for the clarifications.
        Hide
        Santiago Pericas-Geertsen added a comment -

        I agree that this is worth clarifying, but I just don't think it's worth the effort at this point. Moving to ice box.

        Show
        Santiago Pericas-Geertsen added a comment - I agree that this is worth clarifying, but I just don't think it's worth the effort at this point. Moving to ice box.
        Hide
        beryozkin_sergey added a comment -

        Sure - I should've said earlier I'm perfectly OK with this move

        Show
        beryozkin_sergey added a comment - Sure - I should've said earlier I'm perfectly OK with this move

          People

          • Assignee:
            Unassigned
            Reporter:
            beryozkin_sergey
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: