1 ClamClient

Class Ax.net.ClamClient


Linux Clam Anti Virus client to test for viruses on specific host and port.

Constructor Summary

Method
Description
JSClamClient(Ax.text.String host, int port)
Creates a new ClamAV client

Method Summary

Modifier and Type
Method
Description
boolean 
isClean(Object input)
Scans the given input for malware.

Constructor Detail

Ax.net.ClamClient.JSClamClient

Ax.net.ClamClient.JSClamClient(
	string host,
	smallint port
						)
Info:
Creates a new ClamAV client
Parameters:
host - host ip
port - connection port

Example
Copy
var clam = new Ax.net.ClamClient("192.168.10.1", 9090);

Method Detail

Ax.net.ClamClient.isClean

boolean Ax.net.ClamClient.isClean(
	object input
)
Info:
Scans the given input for malware.
Parameters:
input - object to scan for malware
Returns:
boolean

2 CupsClient

Class Ax.net.CupsClient


This class provides a CUPS (Common UNIX Printing System) client interface to connect CUPS printers.

Constructor Summary

Method
Description
JSCupsClient(Ax.text.String host)
Creates a new CUPS client for the specified host.
JSCupsClient(Ax.text.String host, int port)
Creates a new CUPS client hor the specified host and port.
JSCupsClient(Ax.text.String host, int port, Ax.text.String user)
Creates a new CUPS client hor the specified host, port and user.

Method Summary

Modifier and Type
Method
Description
boolean 
cancelJob(int jobID)
Cancels the job identified by jobID.
List 
getJobs(Ax.text.String printerName)
Gets the jobs queue of a printer.
getPrinter(Ax.text.String printerName)
Gets the CupsPrinter object by its name.
List 
Gets the list of CUPS printers.
boolean 
holdJob(int jobID)
Holds the job identified by jobID.
print(Ax.text.String printerName,Ax.text.String data)
Prints the data on the specified printer.
print(Ax.text.String printerName, Object data)
Prints the data on the specified printer.
print(Ax.text.String printerName,Ax.text.String data,Consumer<PrintJob> configurator)
Prints the data on the specified printer.
print(Ax.text.String printerName, Object data, Consumer<PrintJob> configurator)
Prints the data on the specified printer.
boolean 
releaseJob(int jobID)
Releases the job identified by jobID.
Ax.text.String 

Constructor Detail

Ax.net.CupsClient.JSCupsClient

Ax.net.CupsClient.JSCupsClient(
	string host
						)
Info:
Creates a new CUPS client for the specified host.
Parameters:
host - host ip

Ax.net.CupsClient.JSCupsClient

Ax.net.CupsClient.JSCupsClient(
	string host,
	smallint port
						)
Info:
Creates a new CUPS client hor the specified host and port.
Parameters:
host - host ip
port - connection port

Example
Copy
var cups = new Ax.net.CupsClient('192.168.10.10', 631);

Ax.net.CupsClient.JSCupsClient

Ax.net.CupsClient.JSCupsClient(
	string host,
	smallint port,
	string user
						)
Info:
Creates a new CUPS client hor the specified host, port and user.
Parameters:
host - host ip
port - connection port
user - connection user

Method Detail

Ax.net.CupsClient.cancelJob

boolean Ax.net.CupsClient.cancelJob(
	smallint jobID
)
Info:
Cancels the job identified by jobID.
Parameters:
jobID - the id of the job o hold
Returns:
boolean

Ax.net.CupsClient.getJobs

array Ax.net.CupsClient.getJobs(
	string printerName
)
Info:
Gets the jobs queue of a printer. Job id can be obtained with getJobID().
Parameters:
printerName - printer name
Returns:
array

Ax.net.CupsClient.getPrinter

object Ax.net.CupsClient.getPrinter(
	string printerName
)
Info:
Gets the CupsPrinter object by its name.
Parameters:
printerName - the printer name
Returns:
object

Ax.net.CupsClient.getPrinters

array Ax.net.CupsClient.getPrinters()
Info:
Gets the list of CUPS printers. Printer name can be obtained with getName().
Returns:
array

Ax.net.CupsClient.holdJob

boolean Ax.net.CupsClient.holdJob(
	smallint jobID
)
Info:
Holds the job identified by jobID.
Parameters:
jobID - the id of the job o hold
Returns:
boolean

Ax.net.CupsClient.print

object Ax.net.CupsClient.print(
	string printerName,
	string data
)
Info:
Prints the data on the specified printer.
Parameters:
printerName - printer name
data - string to print
Returns:
object

Ax.net.CupsClient.print

object Ax.net.CupsClient.print(
	string printerName,
	object data
)
Info:
Prints the data on the specified printer.
Parameters:
printerName - printer name
data - object to print
Returns:
object

Ax.net.CupsClient.print

object Ax.net.CupsClient.print(
	string printerName,
	string data,
	object configurator
)
Info:
Prints the data on the specified printer.
Parameters:
printerName - printer name
data - string to print
configurator - print job configuration function
Returns:
object

Ax.net.CupsClient.print

object Ax.net.CupsClient.print(
	string printerName,
	object data,
	object configurator
)
Info:
Prints the data on the specified printer.
Parameters:
printerName - printer name
data - object to print
configurator - print job configuration function
Returns:
object

Ax.net.CupsClient.releaseJob

boolean Ax.net.CupsClient.releaseJob(
	smallint jobID
)
Info:
Releases the job identified by jobID.
Parameters:
jobID - the id of the job o hold
Returns:
boolean

Ax.net.CupsClient.toString

string Ax.net.CupsClient.toString()
Returns:
string

3 LPRClient

Class Ax.net.LPRClient


Line Printer Daemon protocol/Line Printer Remote protocol client. LPR/LPD is a network printing protocol for submitting print jobs to a remote printer.

Constructor Summary

Method
Description
JSLPRClient(Ax.text.String host)
Creates a new LPR client with the specified host.
JSLPRClient(Ax.text.String host, int port)
Creates a new LPR client with the specified host.
JSLPRClient(Ax.text.String host, int port, Ax.text.String queue)
Creates a new LPR client with the specified host.

Method Summary

Modifier and Type
Method
Description
Ax.text.String 
Gets a string explaining queue state, like: "Printer Status: Online".
Ax.text.String 
print(Ax.text.String dfAText)
Sends a string to print and returns the job id as a String.
Ax.text.String 
print(byte[] dfAdata)
Sends a byte array to print and returns the job is as a String.
void 
setTimeout(int tout)
Sets the connection timeout in milliseconds.

Constructor Detail

Ax.net.LPRClient.JSLPRClient

Ax.net.LPRClient.JSLPRClient(
	string host
						)
Info:
Creates a new LPR client with the specified host.
Parameters:
host - host ip

Example
Copy
var lpr = new Ax.net.LPRClient("192.168.11.146");

Ax.net.LPRClient.JSLPRClient

Ax.net.LPRClient.JSLPRClient(
	string host,
	smallint port
						)
Info:
Creates a new LPR client with the specified host.
Parameters:
host - host ip
port - connection port

Ax.net.LPRClient.JSLPRClient

Ax.net.LPRClient.JSLPRClient(
	string host,
	smallint port,
	string queue
						)
Info:
Creates a new LPR client with the specified host.
Parameters:
host - host ip
port - connection port
queue - the name of the remote queue on the print server

Method Detail

Ax.net.LPRClient.getQueueState

string Ax.net.LPRClient.getQueueState()
Info:
Gets a string explaining queue state, like: "Printer Status: Online".
Returns:
string

Ax.net.LPRClient.print

string Ax.net.LPRClient.print(
	string dfAText
)
Info:
Sends a string to print and returns the job id as a String.
Parameters:
dfAText - the text to print
Returns:
string

Ax.net.LPRClient.print

string Ax.net.LPRClient.print(
	byte[] dfAdata
)
Info:
Sends a byte array to print and returns the job is as a String.
Parameters:
dfAdata - the data to print
Returns:
string

Ax.net.LPRClient.setTimeout

null Ax.net.LPRClient.setTimeout(
	smallint tout
)
Info:
Sets the connection timeout in milliseconds. Default is 10 seconds.
Parameters:
tout - timeout in milliseconds
Returns:
null

4 HttpClient

Class Ax.net.HttpClient


Lightweight Java HTTP-Client for calling JSON REST-Services

Constructor Summary

Method
Description
Creates a new http client.

Method Summary

Modifier and Type
Method
Description
delete(Ax.text.String pathOrUri)
Creates a
execute(Request request,Class<T> clazz)
get(Ax.text.String pathOrUri)
Creates a
Static function returning an Array of TrustManagers (TrustManager[]) that allows to disable server certificate verification in SSL/TLS Connections.
Static function returning an Array of TrustManagers (TrustManager[]) that allows to disable server certificate verification in SSL/TLS Connections.
boolean 
Checks if the client has follow redirects option enabled.
Map 
mergeHeaders(Map<StringObject> requestHeaders)
post(Ax.text.String pathOrUri)
Creates a
put(Ax.text.String pathOrUri)
Creates a
setAccept(Ax.text.String accept)
setAuthorization(Ax.text.String username, Ax.text.String password)
Set the authorization header.
setAuthorization(AuthMethod authMethod,Ax.text.String user,Ax.text.String password)
Set the authorization header with the defined authentication method.
setBasicAuthorization(Ax.text.String username, Ax.text.String password)
Set the authorization header.
setBearerAuthorization(Ax.text.String token)
Set the authorization header with a berarer token.
setDefaultHeader(Ax.text.String name, Object value)
Set the value for a named header which is valid for all requests created by this instance.
setDigestAuthorization(Ax.text.String username,Ax.text.String password)
Set the authorization header with digest method.
void 
setFollowRedirects(boolean auto)
See
void 
setGlobalHeader(Ax.text.String name,Object value)
Sets the value for a named header which is valid for all requests in the running JVM.
Sets a custom
void 
setJsonIndentFactor(int indentFactor)
Sets the number of characters to indent child properties,
void 
setProxy(Proxy proxy)
Sets a proxy object to be used for opening the connection.
void 
setReadTimeout(int globalReadTimeout)
Sets the timeout in milliseconds for getting response from the server.
setRetryManager(RetryManager retryManager)
Registers an alternative
setSSLSocketFactory(Ax.text.String protocol,Ax.ks.KeyStore ksClient,Ax.text.String ksClientPassword,Ax.ks.KeyStore ksCACert)
Sets SSLSocket parameters.
setSSLSocketFactory(Ax.text.String protocol, Ax.ks.KeyStore ksClient, Ax.crypt.Password ksClientManagedPassword, Ax.ks.KeyStore ksCACert)
Sets SSLSocket parameters.
setSSLSocketFactory(Ax.text.String protocol,Ax.ks.KeyStore ksClient,Ax.text.String ksClientPassword)
Sets SSLSocket parameters.
setSSLSocketFactory(Ax.text.String protocol, Ax.ks.KeyStore ksClient, Ax.crypt.Password ksClientManagedPassword)
Sets SSLSocket parameters.
setSSLSocketFactory(Ax.text.String protocol,Ax.ks.KeyStore ksClient,Ax.text.String ksClientPassword,TrustManager[] trustManagers)
Sets SSLSocket parameters.
setSSLSocketFactory(Ax.text.String protocol, Ax.ks.KeyStore ksClient, Ax.crypt.Password ksClientManagedPassword, TrustManager[] trustManagers)
Sets SSLSocket parameters.
Sets a custom
setSSLSocketFactory(Ax.text.String protocol, KeyStore ksClient, Ax.text.String ksClientPassword, KeyStore ksCACert)
Wrapper for Javascript using JSKeyStore
setSSLSocketFactory(Ax.text.String protocol,KeyStore ksClient,Ax.text.String ksClientPassword,TrustManager[] trustManagers)
Sets SSLSocket parameters.
Relaxes SSL factory to trust all.

Constructor Detail

Ax.net.HttpClient.JSHttpClient

Ax.net.HttpClient.JSHttpClient()
Info:
Creates a new http client.

Example
Copy
var http = new Ax.net.HttpClient();

Method Detail

Ax.net.HttpClient.delete

object Ax.net.HttpClient.delete(
	string pathOrUri
)
Info:
Creates a
Parameters:
pathOrUri - the URI (will be concatenated with global URI or default URI without further checking) If it starts already with http:// or https:// this URI is taken and all base URIs are ignored.
Returns:
object

Example
Copy
DELETE

Ax.net.HttpClient.execute

object Ax.net.HttpClient.execute(
	object request,
	object clazz
)
Parameters:
request - 
clazz - 
Returns:
object

Ax.net.HttpClient.get

object Ax.net.HttpClient.get(
	string pathOrUri
)
Info:
Creates a
Parameters:
pathOrUri - the URI (will be concatenated with global URI or default URI without further checking). If it starts already with http:// or https:// this URI is taken and all base URIs are ignored.
Returns:
object

Example
Copy
GET HTTP

Ax.net.HttpClient.getTrustAllCerts

object Ax.net.HttpClient.getTrustAllCerts()
Info:
Static function returning an Array of TrustManagers (TrustManager[]) that allows to disable server certificate verification in SSL/TLS Connections. Keep a copy cause the function in HttpClient with same signature is not visible to Nashorn
Returns:
object

Example
Copy
var kst = Ax.net.HttpClient.getTrustAllCerts();

Ax.net.HttpClient.getTrustAllCerts

object Ax.net.HttpClient.getTrustAllCerts()
Info:
Static function returning an Array of TrustManagers (TrustManager[]) that allows to disable server certificate verification in SSL/TLS Connections. Keep a copy cause the function in HttpClient with same signature is not visible to Nashorn
Returns:
object

Example
Copy
var kst = Ax.net.HttpClient.getTrustAllCerts();

Ax.net.HttpClient.hasFollowRedirects

boolean Ax.net.HttpClient.hasFollowRedirects()
Info:
Checks if the client has follow redirects option enabled.
Returns:
boolean

Ax.net.HttpClient.mergeHeaders

object Ax.net.HttpClient.mergeHeaders(
	object requestHeaders
)
Parameters:
requestHeaders - 
Returns:
object

Ax.net.HttpClient.post

object Ax.net.HttpClient.post(
	string pathOrUri
)
Info:
Creates a
Parameters:
pathOrUri - the URI (will be concatenated with global URI or default URI without further checking) If it starts already with http:// or https:// this URI is taken and all base URIs are ignored.
Returns:
object

Example
Copy
POST

Ax.net.HttpClient.put

object Ax.net.HttpClient.put(
	string pathOrUri
)
Info:
Creates a
Parameters:
pathOrUri - the URI (will be concatenated with global URI or default URI without further checking) If it starts already with http:// or https:// this URI is taken and all base URIs are ignored.
Returns:
object

Example
Copy
PUT

Ax.net.HttpClient.setAccept

object Ax.net.HttpClient.setAccept(
	string accept
)
Parameters:
accept - 
Returns:
object

Ax.net.HttpClient.setAuthorization

object Ax.net.HttpClient.setAuthorization(
	string username,
	string password
)
Info:
Set the authorization header.
Parameters:
username - the authentication username
password - the authentication password
Returns:
object

Ax.net.HttpClient.setAuthorization

object Ax.net.HttpClient.setAuthorization(
	object authMethod,
	string user,
	string password
)
Info:
Set the authorization header with the defined authentication method.
Parameters:
authMethod - authenticaion method
user - 
password - the authentication password
Returns:
object

Ax.net.HttpClient.setBasicAuthorization

object Ax.net.HttpClient.setBasicAuthorization(
	string username,
	string password
)
Info:
Set the authorization header.
Parameters:
username - the authentication username
password - the authentication password
Returns:
object

Ax.net.HttpClient.setBearerAuthorization

object Ax.net.HttpClient.setBearerAuthorization(
	string token
)
Info:
Set the authorization header with a berarer token.
Parameters:
token - the bearer token
Returns:
object

Ax.net.HttpClient.setDefaultHeader

object Ax.net.HttpClient.setDefaultHeader(
	string name,
	object value
)
Info:
Set the value for a named header which is valid for all requests created by this instance.
Parameters:
name - name of the header (regarding HTTP it is not case-sensitive, but here case is important).
value - value of the header. If <code> null </code> the header value is cleared (effectively not set). When setting the value to null, a value from global headers can shine through.
Returns:
object

Example
Copy
The value takes precedence over  but can be overwritten by
 .
 
 For the supported types for values see .name of the header (regarding HTTP it is not case-sensitive, but here case is important).value of the header. If null

Ax.net.HttpClient.setDigestAuthorization

object Ax.net.HttpClient.setDigestAuthorization(
	string username,
	string password
)
Info:
Set the authorization header with digest method.
Parameters:
username - the authentication username
password - the authentication password
Returns:
object

Ax.net.HttpClient.setFollowRedirects

null Ax.net.HttpClient.setFollowRedirects(
	boolean auto
)
Info:
See
Parameters:
auto - true to automatically follow redirects (HTTP status code 3xx). Default value comes from HttpURLConnection and should be <code> true </code> .
Returns:
null

Example
Copy
http://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html#setInstanceFollowRedirects(boolean)
Example
Copy
Sets the behaviour for all requests created by this instance when receiving redirect responses.
 The setting for a single request can be overwritten by calling .true to automatically follow redirects (HTTP status code 3xx).
              Default value comes from HttpURLConnection and should be true

Ax.net.HttpClient.setGlobalHeader

null Ax.net.HttpClient.setGlobalHeader(
	string name,
	object value
)
Info:
Sets the value for a named header which is valid for all requests in the running JVM.
Parameters:
name - name of the header (regarding HTTP it is not case-sensitive, but here case is important).
value - value of the header. If <code> null </code> the header value is cleared (effectively not set).
Returns:
null

Example
Copy
The value can be overwritten by calling  and/or
 .
 
 For the supported types for values see .name of the header (regarding HTTP it is not case-sensitive, but here case is important).value of the header. If null

Ax.net.HttpClient.setHostnameVerifier

object Ax.net.HttpClient.setHostnameVerifier(
	object hostnameVerifier
)
Info:
Sets a custom
Parameters:
hostnameVerifier - the verifier (see test cases for an example).
Returns:
object

Ax.net.HttpClient.setJsonIndentFactor

null Ax.net.HttpClient.setJsonIndentFactor(
	smallint indentFactor
)
Info:
Sets the number of characters to indent child properties,
Parameters:
indentFactor - the number of spaces to indent
Returns:
null

Example
Copy
-1

Ax.net.HttpClient.setProxy

null Ax.net.HttpClient.setProxy(
	object proxy
)
Info:
Sets a proxy object to be used for opening the connection. See
Parameters:
proxy - the proxy to be used or <tt> null </tt> for no proxy.
Returns:
null

Example
Copy
null

Ax.net.HttpClient.setReadTimeout

null Ax.net.HttpClient.setReadTimeout(
	smallint globalReadTimeout
)
Info:
Sets the timeout in milliseconds for getting response from the server.
Parameters:
globalReadTimeout - the new timeout or <code> &lt; = 0 </code> to use HttpURLConnection default timeout.
Returns:
null

Example
Copy
In contrast to , we use a default timeout of 3 minutes, since no
 timeout is odd.
 Can be overwritten for each Request with .the new timeout or = 0

Ax.net.HttpClient.setRetryManager

object Ax.net.HttpClient.setRetryManager(
	object retryManager
)
Info:
Registers an alternative
Parameters:
retryManager - the new manager for deciding whether it makes sense to retry a request.
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	string ksClientPassword,
	object ksCACert
)
Info:
Sets SSLSocket parameters.
Parameters:
protocol - SSL or TSL
ksClient - javaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientPassword - password to open client keystore
ksCACert - KeyStore with x509 Certificate to validate server certificate (only first cert in keystore is used)
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	object ksClientManagedPassword,
	object ksCACert
)
Info:
Sets SSLSocket parameters. Using a managed password (JSPassword) !!!
Parameters:
protocol - SSL or TSL
ksClient - javaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientManagedPassword - password to open client keystore
ksCACert - KeyStore with x509 Certificate to validate server certificate (only first cert in keystore is used)
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	string ksClientPassword
)
Info:
Sets SSLSocket parameters. Trusts all server certificates.
Parameters:
protocol - SSL or TSL
ksClient - avaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientPassword - password to open client keystore
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	object ksClientManagedPassword
)
Info:
Sets SSLSocket parameters. Trusts all server certificates. Using a managed password (JSPassword) !!!
Parameters:
protocol - SSL or TSL
ksClient - avaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientManagedPassword - password to open client keystore
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	string ksClientPassword,
	object trustManagers
)
Info:
Sets SSLSocket parameters. Allows to pass result from getTrustAllCerts() as a server certificate validator.
Parameters:
protocol - SSL or TSL
ksClient - JavaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientPassword - password to open client keystore
trustManagers - the TrustManager[] obtained from getTrustAllCerts()
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	object ksClientManagedPassword,
	object trustManagers
)
Info:
Sets SSLSocket parameters. Allows to pass result from getTrustAllCerts() as a server certificate validator. Using a managed password (JSPassword) !!!
Parameters:
protocol - SSL or TSL
ksClient - JavaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientManagedPassword - password to open client keystore
trustManagers - the TrustManager[] obtained from getTrustAllCerts()
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	object sslSocketFactory
)
Info:
Sets a custom
Parameters:
sslSocketFactory - the factory to use (see test cases for an example).
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	string ksClientPassword,
	object ksCACert
)
Info:
Wrapper for Javascript using JSKeyStore
Parameters:
protocol - SSL or TSL
ksClient - avaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientPassword - password to open client keystore
ksCACert - KeyStore with x509 Certificate to validate server certificate (only first cert in keystore is used)
Returns:
object

Ax.net.HttpClient.setSSLSocketFactory

object Ax.net.HttpClient.setSSLSocketFactory(
	string protocol,
	object ksClient,
	string ksClientPassword,
	object trustManagers
)
Info:
Sets SSLSocket parameters. Allows to pass result from getTrustAllCerts() as a server certificate validator.
Parameters:
protocol - SSL or TSL
ksClient - avaScript Keystore: Ax.ks.KeyStore() to obtain Client Certificate for authentication (Only first cert in keystore is used)
ksClientPassword - password to open client keystore
trustManagers - the TrustManager[] obtained from getTrustAllCerts()
Returns:
object

Ax.net.HttpClient.setSSLTrustAllFactory

object Ax.net.HttpClient.setSSLTrustAllFactory()
Info:
Relaxes SSL factory to trust all.
Returns:
object

5 HttpRequest

Class Ax.net.HttpRequest


This class wraps a HttpServletRequest to expose some methods like implements HttpServletRequest but with differences. 1. Some methods that return enum, will return arrays to simplify nashhorn iteration. 2. Some methods are not exposed like logout, etc. The class HttpRequest is automatically declared as Ax.request and it's available from script context providing information about current HttpServletRequest that has stated the script execution.

Method Summary

Modifier and Type
Method
Description
dump()
Returns a string containing information about the HTTP servlet request.
Gets the value of the named attribute as an Object, or null if no attribute of the given name exists.
Gets a list with the attribute names.
Returns the name of the authentication scheme used to protect the servlet.
Returns the name of the character encoding used in the body of this request.
int 
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.
long 
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
Returns the MIME type of the body of the request, or null if the type is not known.
Returns the portion of the request URI that indicates the context of the request.
Returns an array containing all of the Cookie objects the client sent with this request.
long 
Gets the value of the specified request header as a long value that represents a Date object.
getHeader(String name)
Gets the value of the specified request header as a String.
Gets a list with the names of all the request headers, or a nempty list if there is no header.
Gets the value of all the request headers with the given name, or an empty list if there is not a header with that name.
int 
Gets the value of the specified request header, as an int.
Returns the Internet Protocol (IP) address of the interface on which the request was received.
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
int 
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
Returns an list of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
Gets the value of a request parameter as a String.
Map 
Returns a map (JSON) with the parameters of the request, where the key is the parameter name, and the value is array of the parameter values/s.
Gets a list with all the request parameter names.
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
Part 
getPart(String name)
Gets the Part with the defined name
Gets all the Part components of this request, provided that it is of type multipart/form-data.
Returns any extra path information associated with the URL the client sent when it made this request.
Returns any extra path information after the servlet name but before the query string, and translates it to a realpath.
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.
Returns the query string that is contained in the requestURL after the path.
Gets the real path corresponding to the given virtual path.
Returns the Internet Protocol (IP) address of the client, or last proxy that sent the request.
Returns the fully qualified name of the client or the last proxy that sent the request.
int 
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
Reconstructs the URL the client used to make the request.
Returns the session ID specified by the client.
Returns the name of the scheme used to make this request, for example, http, https, or ftp.
Returns the host name of the server to which the request was sent.
int 
Returns the port number to which the request was sent.
Gets the servlet context to which this ServletRequest was last dispatched.
Returns the part of this request's URL that calls the servlet.
Returns the current session associated with this request, or if the request does not have a session, creates one.
boolean 
hasHeader(String name)
Checks if request has the header with the given name.
boolean 
isGET()
Checks if the HTTP method is GET.
boolean 
isPOST()
Checks if the HTTP method is POST.
boolean 
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
boolean 
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
void 
Removes an attribute from this request.
void 
Stores an attribute in this request.

Method Detail

Ax.net.HttpRequest.dump

string Ax.net.HttpRequest.dump()
Info:
Returns a string containing information about the HTTP servlet request.
Returns:
string

Ax.net.HttpRequest.getAttribute

object Ax.net.HttpRequest.getAttribute(
	string name
)
Info:
Gets the value of the named attribute as an Object, or null if no attribute of the given name exists.
Parameters:
name - the attribute name
Returns:
object

Ax.net.HttpRequest.getAttributeNames

array Ax.net.HttpRequest.getAttributeNames()
Info:
Gets a list with the attribute names. If there is no named attribute, it returns an empty list.
Returns:
array

Ax.net.HttpRequest.getAuthType

string Ax.net.HttpRequest.getAuthType()
Info:
Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic, form and client certificate authentication, and may additionally support digest authentication. If the servlet is not authenticated null is returned.
Returns:
string

Ax.net.HttpRequest.getCharacterEncoding

string Ax.net.HttpRequest.getCharacterEncoding()
Info:
Returns the name of the character encoding used in the body of this request. This method returns null if the request does not specify a character encoding@return
Returns:
string

Ax.net.HttpRequest.getContentLength

smallint Ax.net.HttpRequest.getContentLength()
Info:
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE.
Returns:
smallint

Ax.net.HttpRequest.getContentLengthLong

long Ax.net.HttpRequest.getContentLengthLong()
Info:
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
Returns:
long

Ax.net.HttpRequest.getContentType

string Ax.net.HttpRequest.getContentType()
Info:
Returns the MIME type of the body of the request, or null if the type is not known.
Returns:
string

Ax.net.HttpRequest.getContextPath

string Ax.net.HttpRequest.getContextPath()
Info:
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character.
Returns:
string

Ax.net.HttpRequest.getCookies

object Ax.net.HttpRequest.getCookies()
Info:
Returns an array containing all of the Cookie objects the client sent with this request. This method returns
Returns:
object

Example
Copy
null

Ax.net.HttpRequest.getDateHeader

long Ax.net.HttpRequest.getDateHeader(
	string name
)
Info:
Gets the value of the specified request header as a long value that represents a Date object. Use this method with headers that contain dates, such a If-Modified-Since. The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive. If the request did not have a header of the specified name, this method returns -1.
Parameters:
name - the header name
Returns:
long

Ax.net.HttpRequest.getHeader

string Ax.net.HttpRequest.getHeader(
	string name
)
Info:
Gets the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first head in the request.
Parameters:
name - the header name
Returns:
string

Ax.net.HttpRequest.getHeaderNames

array Ax.net.HttpRequest.getHeaderNames()
Info:
Gets a list with the names of all the request headers, or a nempty list if there is no header.
Returns:
array

Ax.net.HttpRequest.getHeaders

array Ax.net.HttpRequest.getHeaders(
	string name
)
Info:
Gets the value of all the request headers with the given name, or an empty list if there is not a header with that name.
Parameters:
name - the header name
Returns:
array

Ax.net.HttpRequest.getIntHeader

smallint Ax.net.HttpRequest.getIntHeader(
	string name
)
Info:
Gets the value of the specified request header, as an int. If the request does not have a header of the specified name, this method returns -1.
Parameters:
name - the header name
Returns:
smallint

Ax.net.HttpRequest.getLocalAddr

string Ax.net.HttpRequest.getLocalAddr()
Info:
Returns the Internet Protocol (IP) address of the interface on which the request was received.
Returns:
string

Ax.net.HttpRequest.getLocalName

string Ax.net.HttpRequest.getLocalName()
Info:
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
Returns:
string

Ax.net.HttpRequest.getLocalPort

smallint Ax.net.HttpRequest.getLocalPort()
Info:
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
Returns:
smallint

Ax.net.HttpRequest.getLocale

object Ax.net.HttpRequest.getLocale()
Info:
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
Returns:
object

Ax.net.HttpRequest.getLocales

array Ax.net.HttpRequest.getLocales()
Info:
Returns an list of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an Enumeration containing one Locale, the default locale for the server.
Returns:
array

Ax.net.HttpRequest.getMethod

string Ax.net.HttpRequest.getMethod()
Info:
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
Returns:
string

Ax.net.HttpRequest.getParameter

string Ax.net.HttpRequest.getParameter(
	string name
)
Info:
Gets the value of a request parameter as a String. If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.
Parameters:
name - the parameter name
Returns:
string

Ax.net.HttpRequest.getParameterMap

object Ax.net.HttpRequest.getParameterMap()
Info:
Returns a map (JSON) with the parameters of the request, where the key is the parameter name, and the value is array of the parameter values/s.
Returns:
object

Ax.net.HttpRequest.getParameterNames

array Ax.net.HttpRequest.getParameterNames()
Info:
Gets a list with all the request parameter names. If there is no parameter, returns an empty list.
Returns:
array

Ax.net.HttpRequest.getParameterValues

string[] Ax.net.HttpRequest.getParameterValues(
	string name
)
Info:
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
Parameters:
name - the parameter name
Returns:
string[]

Ax.net.HttpRequest.getPart

object Ax.net.HttpRequest.getPart(
	string name
)
Info:
Gets the Part with the defined name
Parameters:
name - the name of the Part
Returns:
object

Ax.net.HttpRequest.getParts

object Ax.net.HttpRequest.getParts()
Info:
Gets all the Part components of this request, provided that it is of type multipart/form-data. If it does not contain any
Returns:
object

Example
Copy
Part

Ax.net.HttpRequest.getPathInfo

string Ax.net.HttpRequest.getPathInfo()
Info:
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character. This method returns null if there was no extra path information.
Returns:
string

Ax.net.HttpRequest.getPathTranslated

string Ax.net.HttpRequest.getPathTranslated()
Info:
Returns any extra path information after the servlet name but before the query string, and translates it to a realpath. Same as the value of the CGI variable PATH_TRANSLATED. If the URL does not have any extra path information, this method returns null or the servlet container cannot translate the virtual path to a real path for any reason (such as when the web application is executed from an archive).
Returns:
string

Ax.net.HttpRequest.getProtocol

string Ax.net.HttpRequest.getProtocol()
Info:
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
Returns:
string

Ax.net.HttpRequest.getQueryString

string Ax.net.HttpRequest.getQueryString()
Info:
Returns the query string that is contained in the requestURL after the path. This method returns
Returns:
string

Example
Copy
null

Ax.net.HttpRequest.getRealPath

string Ax.net.HttpRequest.getRealPath(
	string path
)
Info:
Gets the real path corresponding to the given virtual path.
Parameters:
path - the virtual path
Returns:
string

Ax.net.HttpRequest.getRemoteAddr

string Ax.net.HttpRequest.getRemoteAddr()
Info:
Returns the Internet Protocol (IP) address of the client, or last proxy that sent the request.
Returns:
string

Ax.net.HttpRequest.getRemoteHost

string Ax.net.HttpRequest.getRemoteHost()
Info:
Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.
Returns:
string

Ax.net.HttpRequest.getRemotePort

smallint Ax.net.HttpRequest.getRemotePort()
Info:
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
Returns:
smallint

Ax.net.HttpRequest.getRemoteUser

string Ax.net.HttpRequest.getRemoteUser()
Info:
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
Returns:
string

Ax.net.HttpRequest.getRequestURI

string Ax.net.HttpRequest.getRequestURI()
Info:
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
Returns:
string

Ax.net.HttpRequest.getRequestURL

object Ax.net.HttpRequest.getRequestURL()
Info:
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
Returns:
object

Ax.net.HttpRequest.getRequestedSessionId

string Ax.net.HttpRequest.getRequestedSessionId()
Info:
Returns the session ID specified by the client. This may not be the same as the ID of the current valid session for this request. If the client did not specify a session ID, this method returns null.
Returns:
string

Ax.net.HttpRequest.getScheme

string Ax.net.HttpRequest.getScheme()
Info:
Returns the name of the scheme used to make this request, for example, http, https, or ftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738.
Returns:
string

Ax.net.HttpRequest.getServerName

string Ax.net.HttpRequest.getServerName()
Info:
Returns the host name of the server to which the request was sent.
Returns:
string

Ax.net.HttpRequest.getServerPort

smallint Ax.net.HttpRequest.getServerPort()
Info:
Returns the port number to which the request was sent.
Returns:
smallint

Ax.net.HttpRequest.getServletContext

object Ax.net.HttpRequest.getServletContext()
Info:
Gets the servlet context to which this ServletRequest was last dispatched. Used from POS/Kanban
Returns:
object

Ax.net.HttpRequest.getServletPath

string Ax.net.HttpRequest.getServletPath()
Info:
Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string.
Returns:
string

Ax.net.HttpRequest.getSession

object Ax.net.HttpRequest.getSession()
Info:
Returns the current session associated with this request, or if the request does not have a session, creates one.
Returns:
object

Ax.net.HttpRequest.hasHeader

boolean Ax.net.HttpRequest.hasHeader(
	string name
)
Info:
Checks if request has the header with the given name.
Parameters:
name - the header name
Returns:
boolean

Ax.net.HttpRequest.isGET

boolean Ax.net.HttpRequest.isGET()
Info:
Checks if the HTTP method is GET.
Returns:
boolean

Ax.net.HttpRequest.isPOST

boolean Ax.net.HttpRequest.isPOST()
Info:
Checks if the HTTP method is POST.
Returns:
boolean

Ax.net.HttpRequest.isSecure

boolean Ax.net.HttpRequest.isSecure()
Info:
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
Returns:
boolean

Ax.net.HttpRequest.isUserInRole

boolean Ax.net.HttpRequest.isUserInRole(
	string role
)
Info:
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.
Parameters:
role - the role to check
Returns:
boolean

Ax.net.HttpRequest.removeAttribute

null Ax.net.HttpRequest.removeAttribute(
	string name
)
Info:
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the requestis being handled.
Parameters:
name - the name of the attribute to remove
Returns:
null

Ax.net.HttpRequest.setAttribute

null Ax.net.HttpRequest.setAttribute(
	string name,
	object o
)
Info:
Stores an attribute in this request. Attributes are reset between requests. If the object passed in is null, the effect is the same as calling removeAttribute.
Parameters:
name - the new attribute name
o - the new attribute value
Returns:
null

6 HttpResponseBuilder

Class Ax.net.HttpResponseBuilder


This class represents a HTTP response builder. Used to build Response instances that contain metadata instead of or in addition to an entity.

Constructor Summary

Method
Description
Creates a new HTTP Response builder

Method Summary

Modifier and Type
Method
Description
build()
Builds the Response object.
Ax.net.HttpResponseBuilder 
cacheControl(Ax.text.String cacheabilitySection,long maxAge)
Set the cache control data of the message.
Ax.net.HttpResponseBuilder 
Sets the response message entity.
Ax.net.HttpResponseBuilder 
header(Ax.text.String name,Object value)
Adds an arbitrary http header.
Ax.net.HttpResponseBuilder 
seeOther(Ax.text.String uri)
Sets the 303 'See Other' status.
Ax.net.HttpResponseBuilder 
status(int status)
Sets the HTTP status
Ax.net.HttpResponseBuilder 
type(Ax.text.String type)
Set the message entity media type.

Constructor Detail

Ax.net.HttpResponseBuilder.JSHttpResponseBuilder

Ax.net.HttpResponseBuilder.JSHttpResponseBuilder()
Info:
Creates a new HTTP Response builder

Method Detail

Ax.net.HttpResponseBuilder.build

object Ax.net.HttpResponseBuilder.build()
Info:
Builds the Response object.
Returns:
object

Ax.net.HttpResponseBuilder.cacheControl

object Ax.net.HttpResponseBuilder.cacheControl(
	string cacheabilitySection,
	long maxAge
)
Info:
Set the cache control data of the message. The cache control directives (CacheControl class) are created from the parameters. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
Parameters:
cacheabilitySection - the cacheabilty section
maxAge - max cache age
Returns:
object

Ax.net.HttpResponseBuilder.entity

object Ax.net.HttpResponseBuilder.entity(
	object o
)
Info:
Sets the response message entity.
Parameters:
o - response
Returns:
object

Ax.net.HttpResponseBuilder.header

object Ax.net.HttpResponseBuilder.header(
	string name,
	object value
)
Info:
Adds an arbitrary http header.
Parameters:
name - the name of the header
value - the value of the header
Returns:
object

Ax.net.HttpResponseBuilder.seeOther

object Ax.net.HttpResponseBuilder.seeOther(
	string uri
)
Info:
Sets the 303 'See Other' status.
Parameters:
uri - the alternative uri
Returns:
object

Ax.net.HttpResponseBuilder.status

object Ax.net.HttpResponseBuilder.status(
	smallint status
)
Info:
Sets the HTTP status
Parameters:
status - HTTP stauts code
Returns:
object

Ax.net.HttpResponseBuilder.type

object Ax.net.HttpResponseBuilder.type(
	string type
)
Info:
Set the message entity media type.
Parameters:
type - the media type
Returns:
object

7 SftpClient

Class Ax.net.SftpClient


SFTP (SSH File Transfer Protocol) Client

Constructor Summary

Method
Description
JSSftpClient(Ax.text.String hostname, int port, Ax.text.String username, Ax.text.String password)
Creates a new sftp client instance.

Method Summary

Modifier and Type
Method
Description
void 
cd(Ax.text.String name)
Goes to the specified path, same as 'cd' teminal command.
void 
close()
Disconnects from server.
void 
Disconnects from server.
boolean 
exists(Ax.text.String name)
Checks whether a file exists.
getBlob(Ax.text.String name)
Returns the specified file as a BLOB.
byte[] 
getBytes(Ax.text.String name)
Returns the specified file as a byte array.
list()
Returns a list with the file names on a specified path/pattern, same as 'ls' terminal command.
list(Ax.text.String pattern)
Returns a list with the file names on a specified path/pattern, same as 'ls' terminal command.
listFiles(Ax.text.String pattern)
Returns a list with the files on a specified path/pattern, same as 'ls' terminal command.
void 
mkdir(Ax.text.String name)
Makes a new directory on the specified path.
void 
put(Ax.text.String name, Object data)
Puts the file on data to the defined path
Ax.text.String 
pwd()
Returns the current path.
void 
rename(Ax.text.String src, Ax.text.String dst)
renames the src file to the dst name
void 
rm(Ax.text.String name)
Removes the specified file, same as 'rm' terminal command.
void 
rmdir(Ax.text.String name)
Removes the specified directory, same as 'rmdir' terminal command.
Ax.text.String 
Returns a string with host, port and username info

Constructor Detail

Ax.net.SftpClient.JSSftpClient

Ax.net.SftpClient.JSSftpClient(
	string hostname,
	smallint port,
	string username,
	string password
						)
Info:
Creates a new sftp client instance.
Parameters:
hostname - host ip
port - connection port
username - connection username
password - connection password

Example
Copy
var sftpconn = new Ax.net.SftpClient(192.168.10.11, 22, 'informix','******');

Method Detail

Ax.net.SftpClient.cd

null Ax.net.SftpClient.cd(
	string name
)
Info:
Goes to the specified path, same as 'cd' teminal command.
Parameters:
name - the path/name
Returns:
null

Ax.net.SftpClient.close

null Ax.net.SftpClient.close()
Info:
Disconnects from server. https://stackoverflow.com/questions/15768516/why-does-an-sftp-connection-still-exist-after-the-jsch-channel-has-been-closed Why does an SFTP connection still exist after the JSCH Channel has been closed? When the code below has finished running, netstat -a|grep sftp shows an open SFTP connection. RESPONSE: you need to exit your channel and disconnect your session. I wanted to add that the session exists even when the channel has been closed. Since you create your session within a try block inside a method, it seems you have lost your session, but you can get it back using 'getSession' on your sftpChannel channel. You can change your finally block to this:
Returns:
null

Example
Copy
finally {
   if (channel != null) {
       Session session = channel.getSession();
       channel.disconnect();
       session.disconnect();
       System.out.println(channel.isConnected());
   }

Ax.net.SftpClient.disconnect

null Ax.net.SftpClient.disconnect()
Info:
Disconnects from server.
Returns:
null

Ax.net.SftpClient.exists

boolean Ax.net.SftpClient.exists(
	string name
)
Info:
Checks whether a file exists.
Parameters:
name - the file path/name
Returns:
boolean

Ax.net.SftpClient.getBlob

object Ax.net.SftpClient.getBlob(
	string name
)
Info:
Returns the specified file as a BLOB.
Parameters:
name - the file path/name
Returns:
object

Ax.net.SftpClient.getBytes

byte[] Ax.net.SftpClient.getBytes(
	string name
)
Info:
Returns the specified file as a byte array.
Parameters:
name - the file path/name
Returns:
byte[]

Ax.net.SftpClient.list

array Ax.net.SftpClient.list()
Info:
Returns a list with the file names on a specified path/pattern, same as 'ls' terminal command.
Returns:
array

Ax.net.SftpClient.list

array Ax.net.SftpClient.list(
	string pattern
)
Info:
Returns a list with the file names on a specified path/pattern, same as 'ls' terminal command.
Parameters:
pattern - the file path/name or name pattern (with *)
Returns:
array

Ax.net.SftpClient.listFiles

array Ax.net.SftpClient.listFiles(
	string pattern
)
Info:
Returns a list with the files on a specified path/pattern, same as 'ls' terminal command.
Parameters:
pattern - the file path/name or name pattern (with *)
Returns:
array

Ax.net.SftpClient.mkdir

null Ax.net.SftpClient.mkdir(
	string name
)
Info:
Makes a new directory on the specified path.
Parameters:
name - the directory path/name to create the new directory on
Returns:
null

Ax.net.SftpClient.put

null Ax.net.SftpClient.put(
	string name,
	object data
)
Info:
Puts the file on data to the defined path
Parameters:
name - the destination directory path/name
data - the file data to put
Returns:
null

Ax.net.SftpClient.pwd

string Ax.net.SftpClient.pwd()
Info:
Returns the current path.
Returns:
string

Ax.net.SftpClient.rename

null Ax.net.SftpClient.rename(
	string src,
	string dst
)
Info:
renames the src file to the dst name
Parameters:
src - the old file path/name
dst - the new file path/name
Returns:
null

Ax.net.SftpClient.rm

null Ax.net.SftpClient.rm(
	string name
)
Info:
Removes the specified file, same as 'rm' terminal command.
Parameters:
name - the file path/name
Returns:
null

Ax.net.SftpClient.rmdir

null Ax.net.SftpClient.rmdir(
	string name
)
Info:
Removes the specified directory, same as 'rmdir' terminal command.
Parameters:
name - the directory path/name
Returns:
null

Ax.net.SftpClient.toString

string Ax.net.SftpClient.toString()
Info:
Returns a string with host, port and username info
Returns:
string

8 SOAPClient

Class Ax.net.SOAPClient


A SOAP (Simple Object Access Protocol) client interface for javascript. Uses SOAPClientConfig and SOAPCallConfig to perform calls to SOAP services.

Constructor Summary

Method
Description
JSSOAPClient(Ax.text.String url, Consumer<JSSOAPClientConfig> options)
Create an instance of SOAPClient configured with options.

Method Summary

Modifier and Type
Method
Description
Ax.net.SOAPClient 
addMapping(Ax.text.String serviceName, Class bean)
Adds a SOAP mapping on the specified service with the given beans.
call(Consumer<org.apache.soap.api.client.SOAPCallConfig> configurator)
Calls a remote endpoint with the specified configuration.
call(Ax.text.String service, Ax.text.String method, Object[] args)
Calls a remote service and executes the defined method.
Returns a memory ResultSet with client statistics (should not be static to be accessible form Nashorn).
Ax.text.String 
Gets the request SOAP XML message if setRequestCopy() has been called during configuration or null.
Ax.text.String 
Returns the response SOAP XML message if setRequestCopy() has been called during configuration or null.
Returns a memory ResultSet with server statistics (should not be static to be accessible from Nashorn).
stats()
Returns the statistics for this client.

Constructor Detail

Ax.net.SOAPClient.JSSOAPClient

Ax.net.SOAPClient.JSSOAPClient(
	string url,
	object options
						)
Info:
Create an instance of SOAPClient configured with options.
Parameters:
url - 
options - configuration function

Method Detail

Ax.net.SOAPClient.addMapping

object Ax.net.SOAPClient.addMapping(
	string serviceName,
	object bean
)
Info:
Adds a SOAP mapping on the specified service with the given beans.
Parameters:
serviceName - the service name
bean - the beans
Returns:
object

Ax.net.SOAPClient.call

object Ax.net.SOAPClient.call(
	object configurator
)
Info:
Calls a remote endpoint with the specified configuration.
Parameters:
configurator - the configuration function
Returns:
object

Example
Copy
soap.call(c - {
 		c.setHeader("xxxx");
  });

Ax.net.SOAPClient.call

object Ax.net.SOAPClient.call(
	string service,
	string method,
	object[] args
)
Info:
Calls a remote service and executes the defined method.
Parameters:
service - the remote service
method - the method to execute
args - the method arguments
Returns:
object

Ax.net.SOAPClient.getClientStatistics

resultset Ax.net.SOAPClient.getClientStatistics()
Info:
Returns a memory ResultSet with client statistics (should not be static to be accessible form Nashorn).
Returns:
resultset

Ax.net.SOAPClient.getRequestCopy

string Ax.net.SOAPClient.getRequestCopy()
Info:
Gets the request SOAP XML message if setRequestCopy() has been called during configuration or null.
Returns:
string

Ax.net.SOAPClient.getResponseCopy

string Ax.net.SOAPClient.getResponseCopy()
Info:
Returns the response SOAP XML message if setRequestCopy() has been called during configuration or null.
Returns:
string

Ax.net.SOAPClient.getServerStatistics

resultset Ax.net.SOAPClient.getServerStatistics()
Info:
Returns a memory ResultSet with server statistics (should not be static to be accessible from Nashorn).
Returns:
resultset

Ax.net.SOAPClient.stats

object Ax.net.SOAPClient.stats()
Info:
Returns the statistics for this client.
Returns:
object

9 SocketClient

Class Ax.net.SocketClient


This class implements client sockets. A socket is an endpoint for communication between two machines. Specifically, this class represents a socket client.

Constructor Summary

Method
Description
JSSocketClient(Ax.text.String host, int port)
Creates a new socket client with the specified host.

Method Summary

Modifier and Type
Method
Description
Ax.net.SocketClient 
Sets a function to be executed when the connection is established.
Ax.net.SocketClient 
Sets a function to be executed when the connection is ended.
Ax.net.SocketClient 
Sets a function to be executed when a packet is received.
Ax.net.SocketClient 
Sets a function to be executed when a packet is sent.
void 
await()
Wait for response.
void 
close()
Disconects from server.
void 
Connects to the server.
byte[] 
read()
Reads data from the server through the socket connection.
Ax.net.SocketClient 
setKeepAlive(boolean keepalive)
Sets whether the connection will be kept alive.
Ax.net.SocketClient 
setTimeout(int timeout)
Sets a connection timeout.
void 
write(Ax.text.String msg)
Sends the message to the server through the socket connection.
void 
write(byte[] msg)
Sends the message to the server through the socket connection.

Constructor Detail

Ax.net.SocketClient.JSSocketClient

Ax.net.SocketClient.JSSocketClient(
	string host,
	smallint port
						)
Info:
Creates a new socket client with the specified host.
Parameters:
host - connection host
port - connection port

Example
Copy
var socket = new Ax.net.SocketClient("pedidos.myediserver.com", 6969);

Method Detail

Ax.net.SocketClient.addConnectEvent

object Ax.net.SocketClient.addConnectEvent(
	object function
)
Info:
Sets a function to be executed when the connection is established.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketClient.addDisconnectEvent

object Ax.net.SocketClient.addDisconnectEvent(
	object function
)
Info:
Sets a function to be executed when the connection is ended.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketClient.addPacketReceivedEvent

object Ax.net.SocketClient.addPacketReceivedEvent(
	object function
)
Info:
Sets a function to be executed when a packet is received.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketClient.addPacketSentEvent

object Ax.net.SocketClient.addPacketSentEvent(
	object function
)
Info:
Sets a function to be executed when a packet is sent.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketClient.await

null Ax.net.SocketClient.await()
Info:
Wait for response.
Returns:
null

Ax.net.SocketClient.close

null Ax.net.SocketClient.close()
Info:
Disconects from server.
Returns:
null

Ax.net.SocketClient.connect

null Ax.net.SocketClient.connect()
Info:
Connects to the server.
Returns:
null

Ax.net.SocketClient.read

byte[] Ax.net.SocketClient.read()
Info:
Reads data from the server through the socket connection.
Returns:
byte[]

Ax.net.SocketClient.setKeepAlive

object Ax.net.SocketClient.setKeepAlive(
	boolean keepalive
)
Info:
Sets whether the connection will be kept alive.
Parameters:
keepalive - whether the connection will be kept alive
Returns:
object

Ax.net.SocketClient.setTimeout

object Ax.net.SocketClient.setTimeout(
	smallint timeout
)
Info:
Sets a connection timeout.
Parameters:
timeout - the timeout in milliseconds
Returns:
object

Ax.net.SocketClient.write

null Ax.net.SocketClient.write(
	string msg
)
Info:
Sends the message to the server through the socket connection.
Parameters:
msg - the message to send
Returns:
null

Ax.net.SocketClient.write

null Ax.net.SocketClient.write(
	byte[] msg
)
Info:
Sends the message to the server through the socket connection.
Parameters:
msg - the message to send
Returns:
null

10 SocketServer

Class Ax.net.SocketServer


This class implments server sockets. A socket is an endpoint for communication between two machines. Specifically, this class represents a socket server.

Constructor Summary

Method
Description
JSSocketServer(int port)
Creates a new socket server with the defined port.

Method Summary

Modifier and Type
Method
Description
Ax.net.SocketServer 
Sets a function to be executed when the connection is established.
Ax.net.SocketServer 
Sets a function to be executed when the connection is ended.
Ax.net.SocketServer 
Sets a function to be executed when a packet is received.
Ax.net.SocketServer 
Sets a function to be executed when a packet is sent.
Ax.net.SocketServer 
Sets a function to be executed when server is ready.
Returns a server controller.
boolean 
Checkes whether the server is running.
Ax.net.SocketServer 
setMaxConnections(int maxConnections)
Sets a maximum limit of client connections.
void 
start()
Starts the server listener.
void 
stop()
Stops the server.

Constructor Detail

Ax.net.SocketServer.JSSocketServer

Ax.net.SocketServer.JSSocketServer(
	smallint port
						)
Info:
Creates a new socket server with the defined port.
Parameters:
port - connection port

Method Detail

Ax.net.SocketServer.addConnectEvent

object Ax.net.SocketServer.addConnectEvent(
	object function
)
Info:
Sets a function to be executed when the connection is established.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketServer.addDisconnectEvent

object Ax.net.SocketServer.addDisconnectEvent(
	object function
)
Info:
Sets a function to be executed when the connection is ended.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketServer.addPacketReceivedEvent

object Ax.net.SocketServer.addPacketReceivedEvent(
	object function
)
Info:
Sets a function to be executed when a packet is received.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketServer.addPacketSentEvent

object Ax.net.SocketServer.addPacketSentEvent(
	object function
)
Info:
Sets a function to be executed when a packet is sent.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketServer.addReadyEvent

object Ax.net.SocketServer.addReadyEvent(
	object function
)
Info:
Sets a function to be executed when server is ready.
Parameters:
function - the function to execute
Returns:
object

Ax.net.SocketServer.getController

object Ax.net.SocketServer.getController()
Info:
Returns a server controller. The controller can be used to kick all clients, kick a specific client, get a client by its IP, send packets to all connected clients, ...
Returns:
object

Ax.net.SocketServer.isRunning

boolean Ax.net.SocketServer.isRunning()
Info:
Checkes whether the server is running.
Returns:
boolean

Ax.net.SocketServer.setMaxConnections

object Ax.net.SocketServer.setMaxConnections(
	smallint maxConnections
)
Info:
Sets a maximum limit of client connections.
Parameters:
maxConnections - 
Returns:
object

Ax.net.SocketServer.start

null Ax.net.SocketServer.start()
Info:
Starts the server listener.
Returns:
null

Ax.net.SocketServer.stop

null Ax.net.SocketServer.stop()
Info:
Stops the server.
Returns:
null

11 URL

Class Ax.net.URL


This class is a URL (Uniform Resource Locator) wrapper.

Constructor Summary

Method
Description
JSURL(Ax.text.String url)
Creates a new URL object from a source url.

Method Summary

Modifier and Type
Method
Description
Ax.sql.Blob 
Opens a connection to this URL and returns a BLOB with the contents of this URL.
byte[] 
Opens a connection to this URL and returns the contents of this URL using a default timeout.
byte[] 
getBytes(int timeout)
Opens a connection to this URL and returns the contents of this URL using a timeout to ensure it's not blocking.
Ax.text.String 
Ax.text.String 
Opens a connection to this URL and returns an InputStream for reading from that connection.
Ax.text.String 
int 
Ax.text.String 
Ax.text.String 
Ax.text.String 
getRef()
Ax.text.String 
Opens a connection to this URL and returns the text contents of this URL.
Ax.text.String 
getText(Ax.text.String encoding)
Opens a connection to this URL and returns the text contents of this URL, using the specified encoding.
Ax.text.String 

Constructor Detail

Ax.net.URL.JSURL

Ax.net.URL.JSURL(
	string url
						)
Info:
Creates a new URL object from a source url.
Parameters:
url - source url

Method Detail

Ax.net.URL.getBlob

object Ax.net.URL.getBlob()
Info:
Opens a connection to this URL and returns a BLOB with the contents of this URL.
Returns:
object

Ax.net.URL.getBytes

byte[] Ax.net.URL.getBytes()
Info:
Opens a connection to this URL and returns the contents of this URL using a default timeout.
Returns:
byte[]

Ax.net.URL.getBytes

byte[] Ax.net.URL.getBytes(
	smallint timeout
)
Info:
Opens a connection to this URL and returns the contents of this URL using a timeout to ensure it's not blocking.
Parameters:
timeout - The connection timeout in milliseconds
Returns:
byte[]

Ax.net.URL.getFile

string Ax.net.URL.getFile()
Returns:
string

Ax.net.URL.getHost

string Ax.net.URL.getHost()
Returns:
string

Ax.net.URL.getInputStream

object Ax.net.URL.getInputStream()
Info:
Opens a connection to this URL and returns an InputStream for reading from that connection.
Returns:
object

Ax.net.URL.getPath

string Ax.net.URL.getPath()
Returns:
string

Ax.net.URL.getPort

smallint Ax.net.URL.getPort()
Returns:
smallint

Ax.net.URL.getProtocol

string Ax.net.URL.getProtocol()
Returns:
string

Ax.net.URL.getQuery

string Ax.net.URL.getQuery()
Returns:
string

Ax.net.URL.getRef

string Ax.net.URL.getRef()
Returns:
string

Ax.net.URL.getText

string Ax.net.URL.getText()
Info:
Opens a connection to this URL and returns the text contents of this URL.
Returns:
string

Ax.net.URL.getText

string Ax.net.URL.getText(
	string encoding
)
Info:
Opens a connection to this URL and returns the text contents of this URL, using the specified encoding.
Parameters:
encoding - the text encoding to use
Returns:
string

Ax.net.URL.getUserInfo

string Ax.net.URL.getUserInfo()
Returns:
string