我尝试访问某些网址以从Grails应用程序中获取JSON文件,但无法找到传递身份验证凭据的方法。
我尝试使用此代码来获取通过身份验证
String url = 'http://urlThatIwantToGoTo.com'
String ID = 'my_ID'
String PW = 'my_PW'
String website = 'http://my_ID:my_PW@urlThatIwantToGoTo.com'
String jsonFile = new JsonSlurper().parseText(new URL(website).text)
但我仍然得到401错误。