Java で非常に単純な URL 操作をいくつか行う必要があります。クエリでパラメーターの値を取得したり、更新したりします... commons-lang パッケージでそれを行う単純なユーティリティ クラスを見つけることを期待していましたが、違います。単純な問題であることはわかっていますが、すでに書かれていることがあるのに、なぜもう一度それをするのでしょうか? 知っていますか?
少なくとも次の機能が必要です。
String myUrl = "http://www.example.com/test.html?toto=1&titi=2";
// get the value of a parameter
String parameterValue = UrlUtils.getParameterValue(myUrl, "toto");
Assert.equals(parameterValue, "1");
// update a parameter
String newUrl = UrlUtils.updateParameter(myUrl, "toto", 3);
parameterValue = UrlUtils.getParameterValue(myUrl, "toto");
Assert.equals(parameterValue, "3");
理想的には、エンコーディングに関連するすべての問題を処理し、java.net.Url と Strings を処理します。
ご協力いただきありがとうございます !