HTTP Plugin Timeout

Questions and answers on developing, deploying and using plugins and JavaBeans

HTTP Plugin Timeout

Postby kwpsd » Sun Mar 05, 2017 1:04 am

Servoy 7.4.9

We are using the http plugin to interface to a RFID system. For http post requests, what is the best way to handle timeouts? That is, how do we detect that the RFID system has not responded in a given amount of time. Also, we discovered that the .setTimeout() function for the http plugin has been deprecated, so how is the timeout value set? There is very limited information in the wiki for the http plugin. Help, please!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 566
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: HTTP Plugin Timeout

Postby kwpsd » Wed Mar 08, 2017 11:50 pm

Doing some emprical testing with the http plugin, we discovered that the timeout default is approximately 20 seconds. How do we change the default timeout setting? Can it be changed, or is it fixed at 20 seconds? Anyone know?


To help others...

When the far end server does not respond to a plugin http post request and a timeout condition occurs, the http plugin response object returns a http status code of zero.

Code: Select all
e.g. httpResponse.getStatusCode()


Although a http status code of zero is not defined in the IETF/IANA registry/specification, it can be used to detect when the far end server is 'unreachable'.

https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

@Servoy: Please consider putting this information in the wiki.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 566
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: HTTP Plugin Timeout

Postby goldcougar » Thu Mar 09, 2017 4:07 am

Looks like the setTimeout is in the HttpClient object you get from createNewHttpClient

https://wiki.servoy.com/display/Serv7/H ... setTimeout
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Free Training Videos
Servoy Guy- Free Plugins, Tips & Resources
ServoyForge- Open Source Servoy Components
User avatar
goldcougar
Servoy Expert
 
Posts: 657
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: HTTP Plugin Timeout

Postby kwpsd » Thu Mar 09, 2017 7:20 pm

Thanks, Scott. I tried setting the http timeout again today, and, now I am not getting the deprecated method message and the .setTimeout() does not have the strike-through. I should have taken a screen shot when it happened.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 566
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: HTTP Plugin Timeout

Postby goldcougar » Thu Mar 09, 2017 9:40 pm

I think at one point, it used to be under plugins.http.setTimeout, and that was deprecated, so now its in the HttpClient object that you get back from plugins.http.createNewHttpClient. so they probably just moved it.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Free Training Videos
Servoy Guy- Free Plugins, Tips & Resources
ServoyForge- Open Source Servoy Components
User avatar
goldcougar
Servoy Expert
 
Posts: 657
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: HTTP Plugin Timeout

Postby kwpsd » Thu Mar 09, 2017 11:45 pm

Thank you, Scott, for the explanation. You are correct...I was using the old style of code. And, the move makes sense as you can set the timeout for individual clients, not just the for plugin.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 566
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 1 guest