The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Java Jira Rest Client Socket Timeout Issue - 5.2.4

Udhayakumar Uthamarajan
November 30, 2022

Hi,

While integrating with JIRA using the Java Rest client, I got a socket timeout issue. Based on the discussion on this forum, I tried to create my own Authentication Handler. But I am not sure, what attributes to set in Builder Object. Can you please help us with this?

 

import org.apache.commons.codec.binary.Base64;
import com.atlassian.httpclient.api.Request.Builder;
import com.atlassian.jira.rest.client.api.AuthenticationHandler;

public class JiraCustomHandler implements AuthenticationHandler {

private final String username;
private final String password;

public JiraCustomHandler(String username, String password) {
this.username = username;
this.password = password;
}

@Override

public void configure(Builder builder) {
builder.setAttribute("PROPERTY_CONNECT_TIMEOUT", "22000");
builder.setHeader("Authorization", "Basic " + encodeCredentials());
}

private String encodeCredentials() {
byte[] credentials = (this.username + ':' + this.password).getBytes();
return new String(Base64.encodeBase64(credentials));
}

}

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.