Child pages
  • Response

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 sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[String]{td}{td}[#getCharset]\() Get the charset of the response body.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#getMediaData]\() Get the content of response as binary data.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getResponseBody]\() Get the content of the response as String.{td}{tr}{tbody}{tbody}{tr}{td}[Object]{td}{td}[#getResponseHeaders]\() Gets the headers of the response as name/value arrays.{td}{tr}{tbody}{tbody}{tr}{td}[Object]{td}{td}[#getResponseHeaders]\(headerName) Gets the headers of the response as name/value arrays.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getStatusCode]\() Gets the status code of the response, the list of the possible values is in HTTP\_STATUS constants.{td}{tr}{tbody}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=getCharset|class=node}{tr:id=name}{td}h6.getCharset{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getCharset{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:getCharset_des|trigger=button|text=}{sub-section}{sub-section:getCharset_des|trigger=none|class=sIndent}
Wiki Markup
Cache
indextrue
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryNeeds to be called when not reading content via getResponseBody or getMediaData to be able to reuse the client.Get the charset of the response body.Getter for the exception message.Get the content of response as binary data.Get the content of the response as String.Gets the headers of the response as name/value arrays.Gets the headers of the response as name/value arrays.Gets the status code of the response, the list of the possible values is in HTTP_STATUS constants.Gets the status code's reason phrase.

functionservoy sDetail2100%height:30px2Methods Detailsclosename

close()

dessIndent
Needs to be called when not reading content via getResponseBody or getMediaData
to be able to reuse the client.
ret

Returns

sIndent true if the entity content is consumed and content stream (if exists) is closed
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetCharsetname

getCharset()

dessIndent
Get the charset of the response body.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getCharset_snc|trigger=button|text=}{sub-section}{sub-section:getCharset_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:getCharset_prs|trigger=button|text=}{sub-section}{sub-section:getCharset_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getCharset_ret|trigger=button|text=}{sub-section}{sub-section:getCharset_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getCharset_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCharset_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getCharset_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCharset_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getCharset_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCharset_sam|trigger=none}{code:language=javascript} var charset = response.getCharset(); {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;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:getMediaData_des|trigger=button|text=}{sub-section}{sub-section:getMediaData_des|trigger=none|class=sIndent}
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetExceptionname

getException()

dessIndent
Getter for the exception message.
ret

Returns

sIndent the exception message
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getMediaDataname

getMediaData()

dessIndent
Get the content of response as binary data. It also supports gzip
\
-ed content.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getMediaData_snc|trigger=button|text=}{sub-section}{sub-section:getMediaData_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:getMediaData_prs|trigger=button|text=}{sub-section}{sub-section:getMediaData_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getMediaData_ret|trigger=button|text=}{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|trigger=button|text=}{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|trigger=button|text=}{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|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMediaData_sam|trigger=none}{code:language=javascript} var mediaData = response.getMediaData(); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getResponseBody|class=node}{tr:id=name}{td}h6.getResponseBody{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getResponseBody{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:getResponseBody_des|trigger=button|text=}{sub-section}{sub-section:getResponseBody_des|trigger=none|class=sIndent}
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetResponseBodyname

getResponseBody()

dessIndent
Get the content of the response as String.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getResponseBody_snc|trigger=button|text=}{sub-section}{sub-section:getResponseBody_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:getResponseBody_prs|trigger=button|text=}{sub-section}{sub-section:getResponseBody_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getResponseBody_ret|trigger=button|text=}{sub-section}{sub-section:getResponseBody_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getResponseBody_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseBody_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getResponseBody_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseBody_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getResponseBody_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseBody_sam|trigger=none}{code:language=javascript} var pageData = response.getResponseBody(); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getResponseHeaders|class=node}{tr:id=name}{td}h6.getResponseHeaders{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]{span}{span:id=iets|style=float: left; font-weight: bold;}getResponseHeaders{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:getResponseHeaders_des|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders_des|trigger=none|class=sIndent}
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetResponseHeadersname

getResponseHeaders()

dessIndent
Gets the headers of the response as name/value arrays.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getResponseHeaders_snc|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders_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:getResponseHeaders_prs|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getResponseHeaders_ret|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders_ret|trigger=none|class=sIndent}[Object]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getResponseHeaders_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getResponseHeaders_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getResponseHeaders_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders_sam|trigger=none}{code:language=javascript} var allHeaders = response.getResponseHeaders(); var header; for (header in allHeaders) application.output(header + ': ' + allHeaders[header]); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getResponseHeaders-String|class=node}{tr:id=name}{td}h6.getResponseHeaders{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]{span}{span:id=iets|style=float: left; font-weight: bold;}getResponseHeaders{span}{span:id=iets|style=float: left;}\(headerName){span}{td}{tr}{tr:id=des}{td}{sub-section:getResponseHeaders-String_des|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders-String_des|trigger=none|class=sIndent}
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetResponseHeadersname

getResponseHeaders(headerName)

dessIndent
Gets the headers of the response as name/value arrays.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getResponseHeaders-String_snc|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:getResponseHeaders-String_prs|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders-String_prs|trigger=none|class=sIndent}\{[String]} headerName {sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getResponseHeaders-String_ret|trigger=button|text=}{sub-section}{sub-section:getResponseHeaders-String_ret|trigger=none|class=sIndent}[Object]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getResponseHeaders-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getResponseHeaders-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getResponseHeaders-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getResponseHeaders-String_sam|trigger=none}{code:language=javascript} var contentLength = response.getResponseHeaders("Content-Length"); {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getStatusCode|class=node}{tr:id=name}{td}h6.getStatusCode{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getStatusCode{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:getStatusCode_des|trigger=button|text=}{sub-section}{sub-section:getStatusCode_des|trigger=none|class=sIndent}
prs

Parameters

sIndentheaderName ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowgetStatusCodename

getStatusCode()

dessIndent
Gets the status code of the response, the list of the possible values is in HTTP
\
_STATUS constants.
{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getStatusCode_snc|trigger=button|text=}{sub-section}{sub-section:getStatusCode_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:getStatusCode_prs|trigger=button|text=}{sub-section}{sub-section:getStatusCode_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getStatusCode_ret|trigger=button|text=}{sub-section}{sub-section:getStatusCode_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getStatusCode_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getStatusCode_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getStatusCode_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getStatusCode_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getStatusCode_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getStatusCode_sam|trigger=none}{code:language=javascript} var status = response.getStatusCode();// compare with HTTP_STATUS constants {code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}


In case there was an exception executing the request, please ignore/do not use this value (it will be 0).
You can check that situation using response.getException().
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getStatusReasonPhrasename

getStatusReasonPhrase()

dessIndent
Gets the status code's reason phrase. For example if a response contains status code 403 (Forbidden) it might be useful to know why.

For example a Jenkins API req. could answer with "403 No valid crumb was included in the request" which will let you know
that you simply have to reques a crumb and then put that in the request headers as "Jenkins-Crumb". But you could not know that from 403 status alone...
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow