1 ClamClient

Class Ax.net.ClamClient


Linux clamd Anti Virus client

Constructor Summary

MethodDescription
JSClamClient(String host, int port)

Method Summary

Modifier and TypeMethodDescription
void close()
boolean isClean(Object input)

Method Detail

JSClamClient

 JSClamClient(String host, int port)
Parameters:
host - 
port - 

close

void close()

isClean

boolean isClean(Object input)
Parameters:
input - 
Returns:

2 CupsClient

Class Ax.net.CupsClient


Constructor Summary

MethodDescription
JSCupsClient(String host)
JSCupsClient(String host, int port)
JSCupsClient(String host, int port, String user)

Method Summary

Modifier and TypeMethodDescription
boolean cancelJob(int jobID)
List getJobs(String printerName)
CupsPrinter getPrinter(String printerName)
List getPrinters()
boolean holdJob(int jobID)
PrintRequestResult print(String printerName, String data)
PrintRequestResult print(String printerName, Object data)
PrintRequestResult print(String printerName, String data, Consumer<PrintJob> configurator)
PrintRequestResult print(String printerName, Object data, Consumer<PrintJob> configurator)
boolean releaseJob(int jobID)
String toString()

Method Detail

JSCupsClient

 JSCupsClient(String host)
Parameters:
host - 

JSCupsClient

 JSCupsClient(String host, int port)
Parameters:
host - 
port - 

JSCupsClient

 JSCupsClient(String host, int port, String user)
Parameters:
host - 
port - 
user - 

cancelJob

boolean cancelJob(int jobID)
Parameters:
jobID - 
Returns:

getJobs

                        List getJobs(String printerName)
Parameters:
printerName - 
Returns:

getPrinter

                        CupsPrinter getPrinter(String printerName)
Parameters:
printerName - 
Returns:

getPrinters

                        List getPrinters()
Returns:

holdJob

boolean holdJob(int jobID)
Parameters:
jobID - 
Returns:

print

                        PrintRequestResult print(String printerName, String data)
Parameters:
printerName - 
data - 
Returns:

print

                        PrintRequestResult print(String printerName, Object data)
Parameters:
printerName - 
data - 
Returns:

print

                        PrintRequestResult print(String printerName, String data, Consumer<PrintJob> configurator)
Parameters:
printerName - 
data - 
configurator - 
Returns:

print

                        PrintRequestResult print(String printerName, Object data, Consumer<PrintJob> configurator)
Parameters:
printerName - 
data - 
configurator - 
Returns:

releaseJob

boolean releaseJob(int jobID)
Parameters:
jobID - 
Returns:

toString

                        String toString()
Returns:

3 LPRClient

Class Ax.net.LPRClient


Constructor Summary

MethodDescription
JSLPRClient(String host)
JSLPRClient(String host, int port)
JSLPRClient(String host, int port, String queue)

Method Summary

Modifier and TypeMethodDescription
String getQueueState()
String print(String dfAText)
String print(byte[] dfAdata)
void setTimeout(int tout)

Method Detail

JSLPRClient

 JSLPRClient(String host)
Parameters:
host - 

JSLPRClient

 JSLPRClient(String host, int port)
Parameters:
host - 
port - 

JSLPRClient

 JSLPRClient(String host, int port, String queue)
Parameters:
host - 
port - 
queue - 

getQueueState

                        String getQueueState()
Returns:

print

                        String print(String dfAText)
Parameters:
dfAText - 
Returns:

print

                        String print(byte[] dfAdata)
Parameters:
dfAdata - 
Returns:

setTimeout

void setTimeout(int tout)
Parameters:
tout - 

4 HttpClient

Class Ax.net.HttpClient


Lightweight Java HTTP-Client for calling JSON REST-Services

Constructor Summary

MethodDescription
JSHttpClient()

Method Summary

Modifier and TypeMethodDescription
Request delete(String arg0)
Response execute(Request arg0, Class<T> arg1)
Request get(String arg0)
TrustManager[] getTrustAllCerts()Keep a copy cause the function in HttpClient with same signature is not visible to Nashorn var kst = Ax.
TrustManager[] getTrustAllCerts()
boolean hasFollowRedirects()
Map mergeHeaders(Map<StringObject> arg0)
Request post(String arg0)
Request put(String arg0)
HTTPClient setAuthorization(String arg0, String arg1)
HTTPClient setAuthorization(AuthMethod arg0, String arg1, String arg2)
HTTPClient setBasicAuthorization(String arg0, String arg1)
HTTPClient setBearerAuthorization(String arg0)
HTTPClient setDefaultHeader(String arg0, Object arg1)
HTTPClient setDigestAuthorization(String arg0, String arg1)
void setFollowRedirects(boolean arg0)
void setGlobalHeader(String arg0, Object arg1)
HTTPClient setHostnameVerifier(HostnameVerifier arg0)
void setJsonIndentFactor(int arg0)
void setProxy(Proxy arg0)
void setReadTimeout(int arg0)
HTTPClient setRetryManager(RetryManager arg0)
HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword, JSKeyStore ksCACert)
HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword)
HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword, TrustManager[] trustManagers)
HTTPClient setSSLSocketFactory(SSLSocketFactory arg0)
HTTPClient setSSLSocketFactory(String arg0, KeyStore arg1, String arg2, KeyStore arg3)
HTTPClient setSSLSocketFactory(String arg0, KeyStore arg1, String arg2, TrustManager[] arg3)
HTTPClient setSSLTrustAllFactory()

Method Detail

JSHttpClient

 JSHttpClient()

delete

                        Request delete(String arg0)
Parameters:
arg0 - 
Returns:

execute

                        Response execute(Request arg0, Class<T> arg1)
Parameters:
arg0 - 
arg1 - 
Returns:

get

                        Request get(String arg0)
Parameters:
arg0 - 
Returns:

getTrustAllCerts

                        TrustManager[] getTrustAllCerts()
Info:
Keep a copy cause the function in HttpClient with same signature is not visible to Nashorn var kst = Ax.net.HttpClient.getTrustAllCerts();
Returns:
a TrustManager to trust all

getTrustAllCerts

                        TrustManager[] getTrustAllCerts()
Returns:

hasFollowRedirects

boolean hasFollowRedirects()
Returns:

mergeHeaders

                        Map mergeHeaders(Map<StringObject> arg0)
Parameters:
arg0 - 
Returns:

post

                        Request post(String arg0)
Parameters:
arg0 - 
Returns:

put

                        Request put(String arg0)
Parameters:
arg0 - 
Returns:

setAuthorization

                        HTTPClient setAuthorization(String arg0, String arg1)
Parameters:
arg0 - 
arg1 - 
Returns:

setAuthorization

                        HTTPClient setAuthorization(AuthMethod arg0, String arg1, String arg2)
Parameters:
arg0 - 
arg1 - 
arg2 - 
Returns:

setBasicAuthorization

                        HTTPClient setBasicAuthorization(String arg0, String arg1)
Parameters:
arg0 - 
arg1 - 
Returns:

setBearerAuthorization

                        HTTPClient setBearerAuthorization(String arg0)
Parameters:
arg0 - 
Returns:

setDefaultHeader

                        HTTPClient setDefaultHeader(String arg0, Object arg1)
Parameters:
arg0 - 
arg1 - 
Returns:

setDigestAuthorization

                        HTTPClient setDigestAuthorization(String arg0, String arg1)
Parameters:
arg0 - 
arg1 - 
Returns:

setFollowRedirects

void setFollowRedirects(boolean arg0)
Parameters:
arg0 - 

setGlobalHeader

void setGlobalHeader(String arg0, Object arg1)
Parameters:
arg0 - 
arg1 - 

setHostnameVerifier

                        HTTPClient setHostnameVerifier(HostnameVerifier arg0)
Parameters:
arg0 - 
Returns:

setJsonIndentFactor

void setJsonIndentFactor(int arg0)
Parameters:
arg0 - 

setProxy

void setProxy(Proxy arg0)
Parameters:
arg0 - 

setReadTimeout

void setReadTimeout(int arg0)
Parameters:
arg0 - 

setRetryManager

                        HTTPClient setRetryManager(RetryManager arg0)
Parameters:
arg0 - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword, JSKeyStore ksCACert)
Parameters:
protocol - 
ksClient - 
ksClientPassword - 
ksCACert - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword)
Parameters:
protocol - 
ksClient - 
ksClientPassword - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(String protocol, JSKeyStore ksClient, String ksClientPassword, TrustManager[] trustManagers)
Parameters:
protocol - 
ksClient - 
ksClientPassword - 
trustManagers - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(SSLSocketFactory arg0)
Parameters:
arg0 - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(String arg0, KeyStore arg1, String arg2, KeyStore arg3)
Parameters:
arg0 - 
arg1 - 
arg2 - 
arg3 - 
Returns:

setSSLSocketFactory

                        HTTPClient setSSLSocketFactory(String arg0, KeyStore arg1, String arg2, TrustManager[] arg3)
Parameters:
arg0 - 
arg1 - 
arg2 - 
arg3 - 
Returns:

setSSLTrustAllFactory

                        HTTPClient setSSLTrustAllFactory()
Returns:

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.

Constructor Summary

MethodDescription
JSHttpServletRequest(HttpServletRequest req)

Method Detail

JSHttpServletRequest

 JSHttpServletRequest(HttpServletRequest req)
Parameters:
req - 

dump

                        String dump()
Returns:

getAttribute

                        Object getAttribute(String name)
Parameters:
name - 
Returns:

getAttributeNames

                        ArrayList getAttributeNames()
Returns:

getAuthType

                        String getAuthType()
Returns:

getCharacterEncoding

                        String getCharacterEncoding()
Returns:

getContentLength

int getContentLength()
Returns:

getContentLengthLong

long getContentLengthLong()
Returns:

getContentType

                        String getContentType()
Returns:

getContextPath

                        String getContextPath()
Returns:

getCookies

                        Cookie[] getCookies()
Returns:

getDateHeader

long getDateHeader(String name)
Parameters:
name - 
Returns:

getHeader

                        String getHeader(String name)
Parameters:
name - 
Returns:

getHeaderNames

                        ArrayList getHeaderNames()
Returns:

getHeaders

                        ArrayList getHeaders(String name)
Parameters:
name - 
Returns:

getIntHeader

int getIntHeader(String name)
Parameters:
name - 
Returns:

getLocalAddr

                        String getLocalAddr()
Returns:

getLocalName

                        String getLocalName()
Returns:

getLocalPort

int getLocalPort()
Returns:

getLocale

                        Locale getLocale()
Returns:

getLocales

                        ArrayList getLocales()
Returns:

getMethod

                        String getMethod()
Returns:

getParameter

                        String getParameter(String name)
Parameters:
name - 
Returns:

getParameterMap

                        Map getParameterMap()
Returns:

getParameterNames

                        ArrayList getParameterNames()
Returns:

getParameterValues

                        String[] getParameterValues(String name)
Parameters:
name - 
Returns:

getPart

                        Part getPart(String name)
Parameters:
name - 
Returns:

getParts

                        Collection getParts()
Returns:

getPathInfo

                        String getPathInfo()
Returns:

getPathTranslated

                        String getPathTranslated()
Returns:

getProtocol

                        String getProtocol()
Returns:

getQueryString

                        String getQueryString()
Returns:

getRealPath

                        String getRealPath(String path)
Parameters:
path - 
Returns:

getRemoteAddr

                        String getRemoteAddr()
Returns:

getRemoteHost

                        String getRemoteHost()
Returns:

getRemotePort

int getRemotePort()
Returns:

getRemoteUser

                        String getRemoteUser()
Returns:

getRequestURI

                        String getRequestURI()
Returns:

getRequestURL

                        StringBuffer getRequestURL()
Returns:

getRequestedSessionId

                        String getRequestedSessionId()
Returns:

getScheme

                        String getScheme()
Returns:

getServerName

                        String getServerName()
Returns:

getServerPort

int getServerPort()
Returns:

getServletContext

                        ServletContext getServletContext()
Info:
Used from POS/Kanban
Returns:

getServletPath

                        String getServletPath()
Returns:

getSession

                        HttpSession getSession()
Returns:

hasHeader

boolean hasHeader(String name)
Parameters:
name - 
Returns:

isGET

boolean isGET()
Returns:

isPOST

boolean isPOST()
Returns:

isSecure

boolean isSecure()
Returns:

isUserInRole

boolean isUserInRole(String role)
Parameters:
role - 
Returns:

removeAttribute

void removeAttribute(String name)
Parameters:
name - 

setAttribute

void setAttribute(String name, Object o)
Parameters:
name - 
o - 

6 HttpResponseBuilder

Class Ax.net.HttpResponseBuilder


r eturn Ax.ext.response.builder() .status(201) .entity(\"HELLO WORLD\") .header(\"X-test\", \"1234\") .type('application/xxx') .cacheControl(\"public\", 3600);

Constructor Summary

MethodDescription
JSHttpResponseBuilder()

Method Summary

Modifier and TypeMethodDescription
Response build()Build the Response object
JSHttpResponseBuilder cacheControl(String cacheabilitySection, long maxAge)https://developer.
JSHttpResponseBuilder entity(Object o)
JSHttpResponseBuilder header(String name, Object value)
JSHttpResponseBuilder seeOther(String uri)
JSHttpResponseBuilder status(int status)
JSHttpResponseBuilder type(String type)

Method Detail

JSHttpResponseBuilder

 JSHttpResponseBuilder()

build

                        Response build()
Info:
Build the Response object
Returns:

cacheControl

                        JSHttpResponseBuilder cacheControl(String cacheabilitySection, long maxAge)
Info:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
Parameters:
cacheabilitySection - 
maxAge - 
Returns:

entity

                        JSHttpResponseBuilder entity(Object o)
Parameters:
o - 
Returns:

header

                        JSHttpResponseBuilder header(String name, Object value)
Parameters:
name - 
value - 
Returns:

seeOther

                        JSHttpResponseBuilder seeOther(String uri)
Parameters:
uri - 
Returns:

status

                        JSHttpResponseBuilder status(int status)
Parameters:
status - 
Returns:

type

                        JSHttpResponseBuilder type(String type)
Parameters:
type - 
Returns:

7 SftpClient

Class Ax.net.SftpClient


SFTP Client

Constructor Summary

MethodDescription
JSSftpClient(String hostname, int port, String username, String password)

Method Summary

Modifier and TypeMethodDescription
void cd(String name)
void close()
void connect()
void disconnect()
boolean exists(String name)
JDBCBlob getBlob(String name)
byte[] getBytes(String name)
ArrayList list(String pattern)
ArrayList listFiles(String pattern)
void mkdir(String name)
void put(String name, Object data)
String pwd()
void rename(String src, String dst)
void rm(String name)
void rmdir(String name)
String toString()

Method Detail

JSSftpClient

 JSSftpClient(String hostname, int port, String username, String password)
Parameters:
hostname - 
port - 
username - 
password - 

cd

void cd(String name)
Parameters:
name - 

close

void close()

connect

void connect()

disconnect

void disconnect()

exists

boolean exists(String name)
Parameters:
name - 
Returns:

getBlob

                        JDBCBlob getBlob(String name)
Parameters:
name - 
Returns:

getBytes

byte[] getBytes(String name)
Parameters:
name - 
Returns:

list

                        ArrayList list(String pattern)
Parameters:
pattern - 
Returns:

listFiles

                        ArrayList listFiles(String pattern)
Parameters:
pattern - 
Returns:

mkdir

void mkdir(String name)
Parameters:
name - 

put

void put(String name, Object data)
Parameters:
name - 
data - 

pwd

                        String pwd()
Returns:

rename

void rename(String src, String dst)
Parameters:
src - 
dst - 

rm

void rm(String name)
Parameters:
name - 

rmdir

void rmdir(String name)
Parameters:
name - 

toString

                        String toString()
Returns:

8 SOAPClient

Class Ax.net.SOAPClient


A SOAP client interface for javascript Uses SOAPClientConfig and SOAPCallConfig to perform calls to SOAP services

Constructor Summary

MethodDescription
JSSOAPClient(String url, Consumer<JSSOAPClientConfig> options)Create an instance of SOAPClient configured with options

Method Summary

Modifier and TypeMethodDescription
JSSOAPClient addMapping(String serviceName, Class bean)
Object call(Consumer<org.apache.soap.api.client.SOAPCallConfig> configurator)
JSSOAPResponse call(String service, String method, Object[] args)
SQLResultSetArray getClientStatistics()
String getRequestCopy()
String getResponseCopy()
SQLResultSetArray getServerStatistics()
CallStatistics stats()

Method Detail

JSSOAPClient

 JSSOAPClient(String url, Consumer<JSSOAPClientConfig> options)
Info:
Create an instance of SOAPClient configured with options
Parameters:
url - 
options - 

addMapping

                        JSSOAPClient addMapping(String serviceName, Class bean)
Parameters:
serviceName - 
bean - 
Returns:

call

                        Object call(Consumer<org.apache.soap.api.client.SOAPCallConfig> configurator)
Parameters:
configurator - 
Returns:

call

                        JSSOAPResponse call(String service, String method, Object[] args)
Parameters:
service - 
method - 
args - 
Returns:

getClientStatistics

                        SQLResultSetArray getClientStatistics()
Returns:
the client statistics for this client (should not be static to be accessible form Nashorn)

getRequestCopy

                        String getRequestCopy()
Returns:
the request SOAP XML message. Must be called after call.

getResponseCopy

                        String getResponseCopy()
Returns:
the response SOAP XML message. Must be called after call.

getServerStatistics

                        SQLResultSetArray getServerStatistics()
Returns:
the server statistics for this client (should not be static to be accessible form Nashorn)

stats

                        CallStatistics stats()
Returns:
the statistics for this client

9 SocketClient

Class Ax.net.SocketClient


<pre>

Constructor Summary

MethodDescription
JSSocketClient(String host, int port)

Method Summary

Modifier and TypeMethodDescription
JSSocketClient addConnectEvent(Consumer<Socket> function)
JSSocketClient addDisconnectEvent(Consumer<Socket> function)
JSSocketClient addPacketReceivedEvent(BiFunction<SocketClientVoid> function)
JSSocketClient addPacketSentEvent(BiFunction<SocketClientVoid> function)
void await()wait for response up to
void close()
void connect()
byte[] read()
JSSocketClient setKeepAlive(boolean keepalive)
JSSocketClient setTimeout(int timeout)
void write(String msg)
void write(byte[] msg)

Method Detail

JSSocketClient

 JSSocketClient(String host, int port)
Parameters:
host - 
port - 

addConnectEvent

                        JSSocketClient addConnectEvent(Consumer<Socket> function)
Parameters:
function - 
Returns:

addDisconnectEvent

                        JSSocketClient addDisconnectEvent(Consumer<Socket> function)
Parameters:
function - 
Returns:

addPacketReceivedEvent

                        JSSocketClient addPacketReceivedEvent(BiFunction<SocketClientVoid> function)
Parameters:
function - 
Returns:

addPacketSentEvent

                        JSSocketClient addPacketSentEvent(BiFunction<SocketClientVoid> function)
Parameters:
function - 
Returns:

await

void await()
Info:
wait for response up to

close

void close()

connect

void connect()

read

byte[] read()
Returns:

setKeepAlive

                        JSSocketClient setKeepAlive(boolean keepalive)
Parameters:
keepalive - 
Returns:

setTimeout

                        JSSocketClient setTimeout(int timeout)
Parameters:
timeout - 
Returns:

write

void write(String msg)
Parameters:
msg - 

write

void write(byte[] msg)
Parameters:
msg - 

10 SocketServer

Class Ax.net.SocketServer


<pre>

Constructor Summary

MethodDescription
JSSocketServer(int port)

Method Summary

Modifier and TypeMethodDescription
JSSocketServer addConnectEvent(Consumer<Socket> function)
JSSocketServer addDisconnectEvent(Consumer<Socket> function)
JSSocketServer addPacketReceivedEvent(BiFunction<SocketHandlerVoid> function)
JSSocketServer addPacketSentEvent(BiFunction<SocketHandlerVoid> function)
JSSocketServer addReadyEvent(Consumer<SocketServer> function)
Controller getController()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, .
boolean isRunning()
JSSocketServer setMaxConnections(int maxConnections)
void start()

Method Detail

JSSocketServer

 JSSocketServer(int port)
Parameters:
port - 

addConnectEvent

                        JSSocketServer addConnectEvent(Consumer<Socket> function)
Parameters:
function - 
Returns:

addDisconnectEvent

                        JSSocketServer addDisconnectEvent(Consumer<Socket> function)
Parameters:
function - 
Returns:

addPacketReceivedEvent

                        JSSocketServer addPacketReceivedEvent(BiFunction<SocketHandlerVoid> function)
Parameters:
function - 
Returns:

addPacketSentEvent

                        JSSocketServer addPacketSentEvent(BiFunction<SocketHandlerVoid> function)
Parameters:
function - 
Returns:

addReadyEvent

                        JSSocketServer addReadyEvent(Consumer<SocketServer> function)
Parameters:
function - 
Returns:

getController

                        Controller getController()
Info:
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:

isRunning

boolean isRunning()
Returns:

setMaxConnections

                        JSSocketServer setMaxConnections(int maxConnections)
Parameters:
maxConnections - 
Returns:

start

void start()

11 URL

Class Ax.net.URL


A URL wrapper

Constructor Summary

MethodDescription
JSURL(String url)

Method Summary

Modifier and TypeMethodDescription
JSBlob getBlob()
byte[] getBytes()
InputStream getInputStream()
String getText()
String getText(String encoding)

Method Detail

JSURL

 JSURL(String url)
Parameters:
url - 

getBlob

                        JSBlob getBlob()
Returns:

getBytes

byte[] getBytes()
Returns:

getInputStream

                        InputStream getInputStream()
Returns:

getText

                        String getText()
Returns:

getText

                        String getText(String encoding)
Parameters:
encoding - 
Returns: