Child pages
  • HttpClient

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rev: 1381948887907

...

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
DeleteRequest
Table Cell (td)
#createDeleteRequestcreateDeleteRequest(url)
Creates a new delete request (a request to delete a resource on server).
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
GetRequest
Table Cell (td)
#createGetRequestcreateGetRequest(url)
Creates a new get request (retrieves whatever information is stored on specified url).
Table Row (tr)
Table Cell (td)
HeadRequest
Table Cell (td)
#createHeadRequestcreateHeadRequest(url)
Creates a new head request (similar to get request, must not contain body content).
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
OptionsRequest
Table Cell (td)
#createOptionsRequestcreateOptionsRequest(url)
Creates a new options request (a request for information about communication options).
Table Row (tr)
Table Cell (td)
PostRequest
Table Cell (td)
#createPostRequestcreatePostRequest(url)
Create a new post request ( Origin server should accept/process the submitted data.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
PutRequest
Table Cell (td)
#createPutRequestcreatePutRequest(url)
Creates a new put request (similar to post request, contains information to be submitted).
tbody
Table Row (tr)
Table Cell (td)
TraceRequest
Table Cell (td)
#createTraceRequestcreateTraceRequest(url)
Creates a new trace request (debug request, server will just echo back).
tbody
Table Row (tr)
Table Cell (td)
Cookie
Table Cell (td)
#getCookiegetCookie(cookieName)
Get a cookie by name.
Table Row (tr)
Table Cell (td)
Cookie[]
Table Cell (td)
#getCookiesgetCookies()
Get all cookies from this client.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setClientProxyCredentialssetClientProxyCredentials(userName, password)
Set proxy credentials.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setCookiesetCookie(cookieName, cookieValue)
Add cookie to the this client.
Table Body (tbody)
tbody
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setCookiesetCookie(cookieName, cookieValue, domain)
Add cookie to the this client.
tbody
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setCookiesetCookie(cookieName, cookieValue, domain, path)
Add cookie to the this client.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setCookiesetCookie(cookieName, cookieValue, domain, path, maxAge)
Add cookie to the this client.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setCookiesetCookie(cookieName, cookieValue, domain, path, maxAge, secure)
Add cookie to the this client.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setTimeoutsetTimeout(msTimeout)
Sets a timeout in milliseconds for retrieving of data (when 0 there is no timeout).

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
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();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
GetRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
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();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
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
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} url
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
PostRequest
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
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

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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)

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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()

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetCookie-String_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, path)
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
{String} path

...

- the path
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
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetCookie-String_String_String_String_Number
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, path, maxAge)
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
{String} path

...

- the path
{Number} maxAge

...

- maximum age of 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
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetCookie-String_String_String_String_Number_Boolean
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, path, maxAge, secure)
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
{String} path

...

- the path
{Number} maxAge

...

- maximum age of cookie
{Boolean} secure

...

- true if it is a secure cookie, false otherwise
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
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
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)

...

Table Row (tr)
classlastDetailRow
Table Cell (td)