java.net.MalformedURLException: no protocol on URL based on a string modified with URLEncoder

后端 未结 5 936
终归单人心
终归单人心 2020-12-08 19:20

So I was attempting to use this String in a URL :-

http://site-test.com/Meetings/IC/DownloadDocument?meetingId=c21c905c-8359-4bd6-b864-844709e05754&item         


        
5条回答
  •  醉梦人生
    2020-12-08 20:16

    Thanks to Erhun's answer I finally realised that my JSON mapper was returning the quotation marks around my data too! I needed to use "asText()" instead of "toString()"

    It's not an uncommon issue - one's brain doesn't see anything wrong with the correct data, surrounded by quotes!

    discoveryJson.path("some_endpoint").toString();
    "https://what.the.com/heck"
    
    discoveryJson.path("some_endpoint").asText();
    https://what.the.com/heck
    

提交回复
热议问题