I get the following error when running my code:
try {
log.info("try");
String sprintLocation = "http://user:pass@jira/rest/agile/1.0/board/"+j+"/sprint?startAt="+start;
URL url = new URL(sprintLocation);
URLConnection urlConnection = url.openConnection();
if (url.getUserInfo() != null) {
log.error("if statement");
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(url.getUserInfo().getBytes()));
urlConnection.setRequestProperty("Authorization", basicAuth);
}
if ( urlConnection instanceof HttpURLConnection)
{
HttpURLConnection httpConnection = (HttpURLConnection) urlConnection;
log.warn(httpConnection.getResponseCode()+"");
}
StringBuilder temp = new StringBuilder();
log.info("stringbuilder");
String s = null;
InputStream inputStream = urlConnection.getInputStream();
log.info("inputstream");
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
log.info("reader");
while ((s = reader.readLine()) != null) {
temp.append(s);
s = "";
}
error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>302 Found</title></head><body><h1>Found</h1><p>The document has moved <a href="https://jira/rest/agile/1.0/board/1/sprint?startAt=0">here</a>.</p><hr><address>Apache Server at jira Port 80</address></body></html>
There is no exception when running the code.
"The HTTP response status code 302 Found is a common way of performing URL redirection. The HTTP/1.0 specification (RFC 1945) initially defined this code, and gave it the description phrase "Moved Temporarily" rather than "Found"." wikipedia
I can't seem to find my error or any relation with other 302-posts.
Thank you for your time
Hi @jacob delddd , I am not sure if you are still looking for answer, but it might help others.
Try using https in the URL.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.