私がここで間違っているかもしれないことを誰かが知っていますか?ユーザー名とパスワードをtomcat-user.xmlに追加しましたが、それでも「401Unauthorized」エラーが発生します。
String url = "http://localhost:9080/manager/list";
HttpPost httppost = new HttpPost(url);
httppost.setHeader("Authorization", "Basic " + userPass);
log.debug("executing request {}", httppost.getRequestLine());
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
BufferedReader rd = new BufferedReader(new InputStreamReader(entity.getContent()));
String line;
StringBuffer buffer = new StringBuffer();
while ((line = rd.readLine()) != null) {
buffer.append(line);
buffer.append('\n');
}
rd.close();