This topic contains 1 reply, has 2 voices, and was last updated by  Duo_Liang 2 months, 3 weeks ago.

  • Author
    Posts
  • Participant
    clara
    Member since: 07.02.2019
    Number of posts: 1

    Using the Java SDK, is there a way to retrieve the HttpClient to add a connection request timeout (ie. for instances where OneSpan may possibly be down)?

    Thanks!

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 828

    Score

    0

    Hi Clara,

    Unfortunately, there’s no function in the Java SDK allowing retrieving HttpClient object because all HttpClient object are built by buildHttpClient() function in RestClient class, and it’s a private function.

    There’s already an Enhancement Request for adding this feature to the SDK and it’s currently a candidate, whereas there’s no detailed ETA for this update. I would definitely help you fill in another ER ticket for this feature as more people request the feature, the feature would get higher priority.

    Or potentially, even if it’s very unrecommended to modify the SDK yourself, you can create a RestClient class in com.silanis.esl.sdk.internal package in your own project path. Copy paste all the existing code and modify the buildHttpClient() function, add connect timeout and socket timeout like something below:

        	SocketConfig socketConfig = SocketConfig.custom() 
        	        .setSoTimeout(10*1000)
        	        .build();                                                                                                //added config
        	
            final HttpClientBuilder httpClientBuilder = HttpClients.custom()
            		.setDefaultSocketConfig(socketConfig)                                 //added line
            		;

    But still, it’s not suggested to overwrite classes from SDK as in that case, we can’t confirm that the SDK would still work properly.

    Hope this could help!
    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist
    • This reply was modified 2 months, 3 weeks ago by  Duo_Liang.

You must be logged in to reply to this topic.