我正在尝试从401
使用本地 Java 返回但无法成功的连接中读取数据。下面是代码-
public String doGet(URL url)
{
try
{
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream stream = connection.getInputStream();
StringBuilder data = new StringBuilder();
int readByte;
while ( (readByte = stream.read()) != -1 )
{
data.append((char) readByte);
}
stream.close();
return data.toString();
}
catch ( IOException e )
{
System.err.println(e.getMessage());
}
return null;
}
使用SOAP UI
工具时,我可以轻松读取相同的 URL。请参阅下面的屏幕截图 -
什么不见了?有什么建议请...