Child pages
  • HttpClient

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

padding0px
width80px

...

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary

...

Table Cell (td)
DeleteRequest

...

Table Cell (td)
GetRequest

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods Summaryvoidreleases all resources that this client has, should be called after usage.Creates a new delete request (a request to delete a resource on server).

...

Creates a new get request (retrieves whatever information is stored on specified url).

...

Table Cell (td)
HeadRequest

...

Table Cell (td)
OptionsRequest

...

Creates a new head request (similar to get request, must not contain body content).

...

Creates a new options request (a request for information about communication options).

...

Table Cell (td)
PostRequest

...

Table Cell (td)
PutRequest

...

Creates a new patch request (used for granular updates).Create a new post request ( Origin server should accept/process the submitted data.

...

...

Table Cell (td)
TraceRequest

...

Creates a new put request (similar to post request, contains information to be submitted).

...

...

Table Cell (td)
Cookie

...

Creates a new trace request (debug request, server will just echo back).

...

...

Table Cell (td)
Cookie[]

...

Get a cookie by name.

...

...

Get all cookies from this client.

...

void

...

Set proxy credentials

...

Table Cell (td)
Boolean

...

.voidSet proxy server.Add cookie to the this client.

...

Table Cell (td)
Boolean

...

Add cookie to the this client.

...

Table Cell (td)
Boolean

...

...

Add cookie to the this client.

...

Table Cell (td)
Boolean

...

Add cookie to the this client.

...

Table Cell (td)
Boolean

...

...

Add cookie to the this client.

...

void

...

Sets a timeout in milliseconds for retrieving of data (when 0 there is no timeout).

...

function

...

servoy sDetail

...

padding0px
width100%

...

2100%height:30px

...

Table Head (th)
colspan1
Method Details

...

idcreateDeleteRequest-String
Table Row (tr)
idname
Table Cell (td)
createDeleteRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
DeleteRequest
Span
stylefont-weight: bold;
createDeleteRequest
Span
(url)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new delete request (a request to delete a resource on server).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
DeleteRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var request = client.createDeleteRequest('http://www.servoy.com/delete.me');
var response = request.executeRequest();
var httpCode = response.getStatusCode(); // httpCode 200 is ok"
var content = response.getResponseBody();

...

classlastDetailRow

...

idcreateGetRequest-String
Table Row (tr)
idname
Table Cell (td)
createGetRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
GetRequest
Span
stylefont-weight: bold;
createGetRequest
Span
(url)

...

iddes

...

classsIndent

...

2Methods Detailsclosename

close()

dessIndent
releases all resources that this client has, should be called after usage.
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createDeleteRequestname

createDeleteRequest(url)

dessIndent
Creates a new delete request (a request to delete a resource on server).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createGetRequestname

createGetRequest(url)

dessIndent
Creates a new get request (retrieves whatever information is stored on specified url).
If this url is a https ssl encrypted url which certificates are not in the java certificate store.
(Like a self signed certificate or a none existing root certificate)
Then for a smart client a dialog will be given, to give the user the ability to accept this certificate for the next time.
For a Web or Headless client the system administrator does have to add that certificate (chain) to the java install on the server.
See http://wiki.servoy.com/display/tutorials/Import+a+%28Root%29+certificate+in+the+java+cacerts+file

...

prs

...

Parameters

...

sIndent

...

idret
url ;ret

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

SmartClient,WebClient,NGClientsam

...

Sample

...

classsIndent

...

Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var request = client.createGetRequest('http://www.servoy.com');
var response = request.executeRequest();
var httpCode = response.getStatusCode(); // httpCode 200 is ok"
var content = response.getResponseBody();

...

classlastDetailRow

...

idcreateHeadRequest-String
Table Row (tr)
idname
Table Cell (td)
createHeadRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
HeadRequest
Span
stylefont-weight: bold;
createHeadRequest
Span
(url)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new head request (similar to get request, must not contain body content).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
HeadRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var request = client.createHeadRequest('http://www.servoy.com');
var response = request.executeRequest();
var httpCode = response.getStatusCode(); // httpCode 200 is ok
var header = response.getResponseHeaders('last-modified');

...

classlastDetailRow

...

idcreateOptionsRequest-String
Table Row (tr)
idname
Table Cell (td)
createOptionsRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
OptionsRequest
Span
stylefont-weight: bold;
createOptionsRequest
Span
(url)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new options request (a request for information about communication options).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
OptionsRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var request = client.createOptionsRequest('http://www.servoy.com');
var methods = request.getAllowedMethods(request.executeRequest());

...

classlastDetailRow

...

idcreatePostRequest-String
Table Row (tr)
idname
Table Cell (td)
createPostRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
PostRequest
Span
stylefont-weight: bold;
createPostRequest
Span
(url)

...

iddes

...

classsIndent

...

sIdentjavascriptlastDetailRowcreateHeadRequestname

createHeadRequest(url)

dessIndent
Creates a new head request (similar to get request, must not contain body content).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createOptionsRequestname

createOptionsRequest(url)

dessIndent
Creates a new options request (a request for information about communication options).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createPatchRequestname

createPatchRequest(url)

dessIndent
Creates a new patch request (used for granular updates).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createPostRequestname

createPostRequest(url)

dessIndent
Create a new post request ( Origin server should accept/process the submitted data.)
If this url is a https ssl encrypted url which certificates are not in the java certificate store.
(Like a self signed certificate or a none existing root certificate)
Then for a smart client a dialog will be given, to give the user the ability to accept this certificate for the next time.
For a Web or Headless client the system administrator does have to add that certificate (chain) to the java install on the server.
See http://wiki.servoy.com/display/tutorials/Import+a+%28Root%29+certificate+in+the+java+cacerts+file

...

prs

...

Parameters

...

sIndent

...

idret
url ;ret

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

idsam

...

classlastDetailRow

...

idcreatePutRequest-String
Table Row (tr)
idname
Table Cell (td)
createPutRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
PutRequest
Span
stylefont-weight: bold;
createPutRequest
Span
(url)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new put request (similar to post request, contains information to be submitted).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
PutRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var request = client.createPutRequest('http://jakarta.apache.org');
request.setFile('UploadMe.gif');
var httpCode = putRequest.executeRequest().getStatusCode() // httpCode 200 is ok

...

classlastDetailRow

...

idcreateTraceRequest-String
Table Row (tr)
idname
Table Cell (td)
createTraceRequest
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
TraceRequest
Span
stylefont-weight: bold;
createTraceRequest
Span
(url)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new trace request (debug request, server will just echo back).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
TraceRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var response = request.executeRequest();
var httpCode = response.getStatusCode(); // httpCode 200 is ok"
var content = response.getResponseBody();

...

classlastDetailRow

...

idgetCookie-String
Table Row (tr)
idname
Table Cell (td)
getCookie
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Cookie
Span
stylefont-weight: bold;
getCookie
Span
(cookieName)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get a cookie by name.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} cookieName
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Cookie
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var cookie = client.getCookie('JSESSIONID');
if (cookie != null)
{
	// do something
}
else
	client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)

...

classlastDetailRow

...

idgetCookies
Table Row (tr)
idname
Table Cell (td)
getCookies
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Cookie[]
Span
stylefont-weight: bold;
getCookies
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get all cookies from this client.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Cookie[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var cookies = client.getHttpClientCookies()

...

classlastDetailRow

...

idsetClientProxyCredentials-String_String
Table Row (tr)
idname
Table Cell (td)
setClientProxyCredentials
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
setClientProxyCredentials
Span
(userName, password)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set proxy credentials.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} userName
{String} password
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
client.setClientProxyCredentials('my_proxy_username','my_proxy_password');

...

classlastDetailRow

...

idsetCookie-String_String
Table Row (tr)
idname
Table Cell (td)
setCookie
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setCookie
Span
(cookieName, cookieValue)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Add cookie to the this client.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} cookieName - the name of the cookie
{String} cookieValue - the value of the cookie
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var cookieSet = client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)
if (cookieSet)
{
	//do something
}

...

classlastDetailRow

...

idsetCookie-String_String_String
Table Row (tr)
idname
Table Cell (td)
setCookie
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setCookie
Span
(cookieName, cookieValue, domain)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Add cookie to the this client.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} cookieName - the name of the cookie
{String} cookieValue - the value of the cookie
{String} domain - the domain
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var cookieSet = client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)
if (cookieSet)
{
	//do something
}

...

classlastDetailRow

...

idsetCookie-String_String_String_String
Table Row (tr)
idname
Table Cell (td)
setCookie

...

idsig

...

Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setCookie

...

SmartClient,WebClient,NGClientsam

Sample

...

classsIndent

...

Code Block
languagejavascript
var client = plugins.http.createNewHttpClient();
var poster = client.createPostRequest('https://twitter.com/statuses/update.json');
poster.addParameter('status',globals.textToPost);
poster.addParameter('source','Test Source');
poster.setCharset('UTF-8');
var httpCode = poster.executeRequest(globals.twitterUserName, globals.twitterPassword).getStatusCode(); // httpCode 200 is ok
sIdentjavascriptlastDetailRowcreatePutRequestname

createPutRequest(url)

dessIndent
Creates a new put request (similar to post request, contains information to be submitted).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
createTraceRequestname

createTraceRequest(url)

dessIndent
Creates a new trace request (debug request, server will just echo back).
prs

Parameters

sIndenturl ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getCookiename

getCookie(cookieName)

dessIndent
Get a cookie by name.
prs

Parameters

sIndentcookieName ;
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getCookiesname

getCookies()

dessIndent
Get all cookies from this client.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setClientProxyCredentialsname

setClientProxyCredentials(userName, password)

dessIndent
Set proxy credentials.
prs

Parameters

sIndentuserName ;password ;
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setClientProxyServername

setClientProxyServer(hostname, port)

dessIndent
Set proxy server.
prs

Parameters

sIndenthostname- proxy host // null value will clear proxyHost settings;port- proxy port //null value will clear proxyHost settings;
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setCookiename

setCookie(cookieName, cookieValue)

dessIndent
Add cookie to the this client.
prs

Parameters

sIndentcookieNamethe name of the cookiecookieValuethe value of the cookie
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setCookiename

setCookie(cookieName, cookieValue, domain)

dessIndent
Add cookie to the this client.
prs

Parameters

sIndentcookieNamethe name of the cookiecookieValuethe value of the cookiedomainthe domain
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
setCookiename

setCookie(cookieName, cookieValue, domain, path)

...

des

...

sIndent
Add cookie to the this client.

...

prs

...

Parameters

...

...

sIndent

...

cookieName

...

the name of the cookie

...

cookieValue

...

the value of the cookie

...

domain

...

the domain

...

path

...

the path

...

ret

...

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

SmartClient,WebClient,NGClientsam

...

Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setCookie

...

Sample

...

classsIndent

...

Code Block
languagejavascript
var cookieSet = client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)
if (cookieSet)
{
	//do something
}

...

classlastDetailRow

...

idsetCookie-String_String_String_String_Number
Table Row (tr)
idname
Table Cell (td)
setCookie

...

idsig

...

sIdentjavascriptlastDetailRowsetCookiename

setCookie(cookieName, cookieValue, domain, path, maxAge)

...

...

des

...

sIndent
Add cookie to the this client.

...

...

prs

...

Parameters

...

sIndent

...

cookieName

...

the name of the cookie

...

cookieValue

...

the value of the cookie

...

domain

...

the domain

...

path

...

the path

...

maxAge

...

maximum age of cookie

...

ret

...

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

idsam
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setCookie

...

SmartClient,WebClient,NGClientsam

Sample

...

classsIndent

...

Code Block
languagejavascript
var cookieSet = client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)
if (cookieSet)
{
	//do something
}

...

classlastDetailRow

...

idsetCookie-String_String_String_String_Number_Boolean
Table Row (tr)
idname
Table Cell (td)
setCookie

...

idsig

...

sIdentjavascriptlastDetailRowsetCookiename

setCookie(cookieName, cookieValue, domain, path, maxAge, secure)

...

des

...

sIndent
Add cookie to the this client.

...

prs

...

Parameters

...

sIndent

...

cookieName

...

the name of the cookie

...

cookieValue

...

the value of the cookie

...

domain

...

the domain

...

path

...

the path

...

maxAge

...

maximum age of cookie

...

secure

...

true if it is a secure cookie, false otherwise

...

ret

...

Returns

...

sIndentclients

...

Supported Clients

sIndent

...

SmartClient,WebClient,NGClientsam

...

classlastDetailRow

...

idsetTimeout-
Table Row (tr)
idname
Table Cell (td)
setTimeout
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
setTimeout
Span
(msTimeout)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets a timeout in milliseconds for retrieving of data (when 0 there is no timeout).
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
msTimeout
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
client.setTimeout(1000)

...

classlastDetailRow

...

Sample

...

classsIndent

...

Code Block
languagejavascript
var cookieSet = client.setCookie('JSESSIONID', 'abc', 'localhost', '/', -1, false)
if (cookieSet)
{
	//do something
}
sIdentjavascriptlastDetailRowsetTimeoutname

setTimeout(msTimeout)

dessIndent
Sets a timeout in milliseconds for retrieving of data (when 0 there is no timeout).
prs

Parameters

sIndentmsTimeout ;
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow