이 동작은 고의적입니까?Java URI 클래스 : 생성자는 쿼리가 인코딩되는지 여부를 결정합니다.
//create the same URI using two different constructors
URI foo = null, bar = null;
try {
//constructor: URI(uri string)
foo = new URI("http://localhost/index.php?token=4%2F4EzdsSBg_4vX6D5pzvdsMLDoyItB");
} catch (URISyntaxException e) {}
try {
//constructor: URI(scheme, authority, path, query, fragment)
bar = new URI("http", "localhost", "/index.php", "token=4%2F4EzdsSBg_4vX6D5pzvdsMLDoyItB", null);
} catch (URISyntaxException e) {}
//the output:
//foo.getQuery() = token=4/4EzdsSBg_4vX6D5pzvdsMLDoyItB
//bar.getQuery() = token=4%2F4EzdsSBg_4vX6D5pzvdsMLDoyItB
URI (string uri) 생성자가 URI의 쿼리 부분을 디코딩하는 것으로 보입니다. 쿼리 부분을 인코딩해야한다고 생각 했나요? 왜 다른 생성자가 쿼리 부분을 디코딩하지 않습니까? URI JavaDoc에서
당신은 당신의 형식 게시물 읽기 쉽도록 수정하시기 바랍니다 수 있을까요? – Thomas