JERSEY-2537 Fixes the issues with replaceMatrix described in this issue: replaceMatrix(null) removes semicolon if there are no matrix parameters, trailing slash is now kept intact, and it only operates on the final path segment instead of the first.