Jsoup API를 사용하여 JIRA에 로그인하려했지만 어떤 이유로 작동하지 않습니다.Jsoup를 사용하여 JIRA 로그인을 수행하는 방법은 무엇입니까?
나는 사용자 이름과 암호 태그를 식별하려고했지만 여전히 좋지 않습니다.
누군가 내가 잘못하고있는 것을 알아낼 수 있습니까?
public class test
{
public static void main(String[] args) throws IOException{
final String USER_AGENT = "\"Mozilla/5.0 (Windows NT\" +\n" +
" \" 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36\"";
String loginFormUrl = "https://jira.aciworldwide.com/login.jsp";
String loginActionUrl = "https://jira.aciworldwide.com/login.jsp";
String username = "[email protected]";
String password = "XXXXXX";
HashMap<String, String> cookies = new HashMap<>();
HashMap<String, String> formData = new HashMap<>();
Connection.Response loginForm = Jsoup.connect(loginFormUrl).method(Connection.Method.GET).userAgent(USER_AGENT).execute();
Document loginDoc = loginForm.parse(); // this is the document that contains response html
cookies.putAll(loginForm.cookies()); // save the cookies, this will be passed on to next request
formData.put("login", "Log In");
formData.put("os_username", username);
formData.put("os_password", password);
Connection.Response homePage = Jsoup.connect(loginActionUrl)
.cookies(cookies)
.data(formData)
.method(Connection.Method.POST)
.userAgent(USER_AGENT)
.execute();
System.out.println(homePage.parse().html());
}
}
JSoup이 아닌 경우 동일한 API를 사용할 수 있습니까?
도움이 될 것입니다.
는 "하지만 여전히 좋은"와 관련된 몇 가지 스택 트레이스 또는 출력을 추가 할 수 있습니까? 결과/오류가 발생 했습니까? – exoddus
jira 's rest api를 사용하지 않는 이유는 무엇입니까? – slowy
Java 용으로 만 사용하도록 요청 받았습니다. –