Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

后端 未结 3 1757
生来不讨喜
生来不讨喜 2021-01-04 07:09

I believe the definition and implementation of Java\'s URI.resolve method is incompatible with RFC 3986 section 5.2.2. I understand that the Java API defines how that method

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 07:50

    for me there is no discrepancy. With the Java behaviour.

    in RFC2396 5.2.6a

    All but the last segment of the base URI's path component is copied to the buffer. In other words, any characters after the last (right-most) slash character, if any, are excluded.

    in RFC3986 5.2.3

    return a string consisting of the reference's path component appended to all but the last segment of the base URI's path (i.e., excluding any characters after the right-most /" in the base URI path, or excluding the entire base URI path if it does not contain any "/" characters).

提交回复
热议问题