$server

Global object that stores information about the server environment.

Summary
$serverGlobal object that stores information about the server environment.
Properties
dataSourcesA structure of DS information
isThreadtrue if this is an independent thread with no access to session or servlet
threadFunctionSourcethe source of the function that the current subthread is executing, or null if this is not a subthread
instanceIdan identifier for this server instance
purposeA short name that describes the purpose of this instance.
responseA reference to servlet response object
requestA reference the servlet request object.
requestScriptNameThe name of the originally requested script.
serverUrlThe the server name and protocol of the request
remoteAddrThe IP address of the requestor
requestServerUrlDEPRECATED see $server.serverUrl
requestDirMynaPath representing the directory of the originally requested script.
requestUrlURL Path representing the directory of the originally requested script.
resolveUrltakes a url path relative to the request directory and returns an absolute URL, including the server part.
rootDirMynaPath representing the Myna root directory.
rootUrlURL Path representing the Myna root directory.
currentDirMynaPath representing the directory of the currently executing script.
currentUrlURL Path representing the directory of the currently executing script
globalScopeA reference to the Top Level Javascript scope in the current script
servletReference to the servlet object.
versionString representing the running version of Myna.
scriptNameThe name of the currently running script.
tempDirMynaPath of the JVM temp directory
hostNamethe hostname of the server running myna
ipAdressesAn array of the non-loopback ipv4 IP addresses on this machine
osNameString representing the host operating system type.
osArchString representing the host cpu architecture.
osVersionString representing the host operating system version.
propertiesThe general properties set in the gerneal Settings section of the Administrator
memCurrentThe current heap size in bytes.
memMaxThe maximum heap size
memFreeThe current number of free bytes on the heap.
memAvailableThe number of free bytes on the heap + unallocaed heap space.
memUsedThe number of used bytes on the heap
getretrieves a server variable
setSets a variable that is available across all requests.

Properties

dataSources

A structure of DS information

isThread

true if this is an independent thread with no access to session or servlet

threadFunctionSource

the source of the function that the current subthread is executing, or null if this is not a subthread

instanceId

an identifier for this server instance

purpose

A short name that describes the purpose of this instance.  Set in General Settings of Myna Administrator

response

A reference to servlet response object

request

A reference the servlet request object.

requestScriptName

The name of the originally requested script.

Example

index.sjs

serverUrl

The the server name and protocol of the request

Example

http://localhost:8080

Note

If Myna is behind a proxy you will want to make sure that the X-Forwarded-Host and optionally X-Forwarded-Proto request headers are set by the proxy so that a valid result is generated

See

remoteAddr

The IP address of the requestor

Example

123.345.678.910

Detail

This is normally the IP address of the request.  If the X-Forwarded-For header is set, then that IP address is returned instead

requestServerUrl

DEPRECATED see $server.serverUrl

requestDir

MynaPath representing the directory of the originally requested script.

Example

file:/usr/share/tomcat/webapps/myna/myna/administrator/

requestUrl

URL Path representing the directory of the originally requested script.

Example

/myna/myna/administrator/

resolveUrl

takes a url path relative to the request directory and returns an absolute URL, including the server part.

Parameters

patha url path relative to the request directory

Example

//return full URL to this page
var linkUrl = $server.resolveUrl($server.requestScriptName);

rootDir

MynaPath representing the Myna root directory.

Example

file:/usr/share/tomcat/webapps/myna/

rootUrl

URL Path representing the Myna root directory.

Example

/myna/

currentDir

MynaPath representing the directory of the currently executing script.

Example

file:/usr/share/tomcat/webapps/myna/myna/administrator/views/

currentUrl

URL Path representing the directory of the currently executing script

Example

/<context root>/myna/administrator/views/

globalScope

A reference to the Top Level Javascript scope in the current script

Detail

A reference to the Top Level Javascript scope in the current script.  This analogous to “window” in a browser environment.

servlet

Reference to the servlet object.

version

String representing the running version of Myna.

Example

1.0_alpha_9

scriptName

The name of the currently running script.

Example

index.sjs

tempDir

MynaPath of the JVM temp directory

Example

file:/usr/share/tomcat/temp

hostName

the hostname of the server running myna

ipAdresses

An array of the non-loopback ipv4 IP addresses on this machine

osName

String representing the host operating system type.

Example

Linux

osArch

String representing the host cpu architecture.

Example

i386

osVersion

String representing the host operating system version.

Example

2.6.20-16-386

properties

The general properties set in the gerneal Settings section of the Administrator

Example

var purpose = $server.properties.instance_purpose

See Also

memCurrent

The current heap size in bytes.

for the maximum memory that could be allocated

See

$server.memMax, $server.memAvailable, $server.memFree, $server.memUsed, Myna.freeMemory()

memMax

memFree

The current number of free bytes on the heap.

For the total memory available for new objects, see memAvailable

See

$server.memMax, $server.memCurrent, $server.memAvailable, $server.memUsed, Myna.freeMemory()

memAvailable

The number of free bytes on the heap + unallocaed heap space.

See

$server.memMax, $server.memCurrent, $server.memFree, $server.memUsed, Myna.freeMemory()

memUsed

get

retrieves a server variable

Parameters

keya variable name

See

$server.set,

set

Sets a variable that is available across all requests.  Server varaiables are not preserved across Myna restarts

Parameters

keya variable name
valueThe value to set

Returns

value

See

$server.get,

The the server name and protocol of the request
A MynaPath is a file URI String with certain automatic translations.
URL Path representing the Myna root directory.
URL Path representing the directory of the currently executing script
The name of the currently running script.
The name of the originally requested script.
Myna.getGeneralProperties=function Myna_getGeneralProperties()
Returns the Java Properties object loaded from /WEB-INF/classes/general.properties
The maximum heap size
The number of free bytes on the heap + unallocaed heap space.
The current number of free bytes on the heap.
The number of used bytes on the heap
Myna.freeMemory=function Myna_freeMemory(size,
timeout)
attempts to free the specified amount of memory within the timeout, returning true if successful.
The current heap size in bytes.
Sets a variable that is available across all requests.
retrieves a server variable