Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
{hidden} DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden} {sub-section:description|text=}{sub-section}\\ {table:id=|class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{span:class=sWordList}[Cookie]{span}{span:class=sWordList}[DeleteRequest]{span}{span:class=sWordList}[GetRequest]{span}{span:class=sWordList}[HTTP_STATUS]{span}{span:class=sWordList}[HeadRequest]{span}{span:class=sWordList}[HttpClient]{span}{span:class=sWordList}[OptionsRequest]{span}{span:class=sWordList}[PostRequest]{span}{span:class=sWordList}[PutRequest]{span}{span:class=sWordList}[Response]{span}{span:class=sWordList}[TraceRequest]{span}{td}{tr}{table}\\ {table:id=|class=servoy sSummary}{colgroup}{column:padding=0px|width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[HttpClient]{td}{td}[#createNewHttpClient]\()
Wiki Markup
Cache
indextrue
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryCreate an http client (like a web browser with session binding) usable todo multiple request/posts in same server session .Create an http client (like a web browser with session binding) usable todo multiple request/posts in same server session.Create a http client configGet media (binary data) such as images in a variable.Get all page html in a variable, if this url is an https url that uses certificates unknown to Java then you have to use the HttpClient so that smart client users will get the unknown certificate dialog that they then can accept or you must make sure that those server certificates are stored in the cacerts of the java vm that is used (this is required for a web or headless client)

functionservoy sDetail2100%height:30px2Methods DetailscreateNewHttpClientname

createNewHttpClient()

dessIndent
Create an http client (like a web browser with session binding) usable todo multiple request/posts in same server session
.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#getMediaData]\(url, \[http_clientname\]) Get media (binary data) such as images in a variable.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getPageData]\(url) Get all page html in a variable.{td}{tr}{tbody}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:padding=0px|width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=createNewHttpClient|class=node}{tr:id=name}{td}h6.createNewHttpClient{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[HttpClient]{span}{span:id=iets|style=float: left; font-weight: bold;}createNewHttpClient{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:createNewHttpClient_des|text=|trigger=button}{sub-section}{sub-section:createNewHttpClient_des|trigger=none|class=sIndent}

.
WARNING: Make sure you call client.close() on it after you used this client object to clean up resources.
Starting a HTTPClient is the same as starting an actual browser without UI!
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createNewHttpClientname

createNewHttpClient(config)

dessIndent
Create an http client (like a web browser with session binding) usable todo multiple request/posts in same server session.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:createNewHttpClient_snc|text=|trigger=button}{sub-section}{sub-section:createNewHttpClient_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:createNewHttpClient_prs|text=|trigger=button}{sub-section}{sub-section:createNewHttpClient_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:createNewHttpClient_ret|text=|trigger=button}{sub-section}{sub-section:createNewHttpClient_ret|trigger=none|class=sIndent}[HttpClient]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:createNewHttpClient_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:createNewHttpClient_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:createNewHttpClient_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:createNewHttpClient_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:createNewHttpClient_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:createNewHttpClient_sam|trigger=none}{code:language=javascript} var client = plugins.http.createNewHttpClient(); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMediaData|class=node}{tr:id=name}{td}h6.getMediaData{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}byte[]{span}{span:id=iets|style=float: left; font-weight: bold;}getMediaData{span}{span:id=iets|style=float: left;}\(url, \[http_clientname\]){span}{td}{tr}{tr:id=des}{td}{sub-section:getMediaData_des|text=|trigger=button}{sub-section}{sub-section:getMediaData_des|trigger=none|class=sIndent}


WARNING: Make sure you call client.close() on it after you used this client object to clean up resources.
Starting a HTTPClient is the same as starting an actual browser without UI!
prs

Parameters

sIndentconfighttpclient config
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createNewHttpClientConfigname

createNewHttpClientConfig()

dessIndent
Create a http client config
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getMediaDataname

getMediaData(url)

dessIndent
Get media (binary data) such as images in a variable. It also supports gzip
\
-ed content.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getMediaData_snc|text=|trigger=button}{sub-section}{sub-section:getMediaData_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:getMediaData_prs|text=|trigger=button}{sub-section}{sub-section:getMediaData_prs|trigger=none|class=sIndent}url \[http\_clientname\] {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getMediaData_ret|text=|trigger=button}{sub-section}{sub-section:getMediaData_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getMediaData_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getMediaData_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getMediaData_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getMediaData_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getMediaData_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getMediaData_sam|trigger=none}{code:language=javascript} var image_byte_array = plugins.http.getMediaData('http://www.cnn.com/cnn.gif'); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getPageData|class=node}{tr:id=name}{td}h6.getPageData{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getPageData{span}{span:id=iets|style=float: left;}\(url){span}{td}{tr}{tr:id=des}{td}{sub-section:getPageData_des|text=|trigger=button}{sub-section}{sub-section:getPageData_des|trigger=none|class=sIndent}

If this url is an https url that uses certificates unknown to Java
then you have to use the HttpClient so that smart client users will get the unknown certificate dialog that they then can accept
or you must make sure that those server certificates are stored in the cacerts of the java vm that is used (this is required for a web or headless client)
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getPageDataname

getPageData(url)

dessIndent
Get all page html in a variable
.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getPageData_snc|text=|trigger=button}{sub-section}{sub-section:getPageData_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:getPageData_prs|text=|trigger=button}{sub-section}{sub-section:getPageData_prs|trigger=none|class=sIndent}url {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getPageData_ret|text=|trigger=button}{sub-section}{sub-section:getPageData_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getPageData_see|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPageData_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getPageData_link|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPageData_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getPageData_sam|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:getPageData_sam|trigger=none}{code:language=javascript} // get data using a default connection var pageData = plugins.http.getPageData('http://www.cnn.com'); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
, if this url is an https url that uses certificates unknown to Java
then you have to use the HttpClient so that smart client users will get the unknown certificate dialog that they then can accept
or you must make sure that those server certificates are stored in the cacerts of the java vm that is used (this is required for a web or headless client)
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow