The Jaxer server framework contains functions and code that run only on the server.
A collection of Jaxer extensions for the JavaScript Function object
Use the proxy property to specify if this function should be callable from the client. If a function is not marked for proxy, it will not be callable on the server. Valid values are "true" or "false". Use the runat property inside of a "script" tag to specify whether to run the JavaScript on the server-side, client-side, or both. Use this property to inject proxies into the client. Valid values are "client", "server," "both", "server-proxy", "server-nocache", "both-proxy", and "both-nocache".
The Jaxer namespace.
The value of the runat attribute of the last script block encountered.<br><br>(Advanced) This is the global execution context for JavaScript code you define in (or load into) a page on the server. It's aliased as window in the page, so it behaves just like the window global object on the client (browser).<br><br>(Advanced) A persistent session-like container that can store and persist name-value pairs in the context of an entire application. Whether a given page belongs to a given application is determined by configApps.js, usually from the page's URL. All pages belonging to an application, and their callbacks, have read/write access to this application container, regardless of user session, and to no other application-level container. This property exposes the current build number of the Jaxer engine A JavaScript Object that can be used to communicate data from the server at the end of server-side page processing to the client. When Jaxer starts to process a page server-side, Jaxer.clientData is an empty object: { } . If you set any properties on this object, the entire object will be JSON-serialized at the end of server-side processing, and will be automatically de-serialized when it gets to the client, so you can access your data as Jaxer.clientData in the browser. Note that if there is no data, Jaxer.clientData will not be created at all on the client. This gives read-only access to the Jaxer Core's preferences, each of which become a property on this object. If Jaxer.Config.EMBEDDED_CLIENT_FRAMEWORK_SRC has been set, it's assumed to be the path to the embeddable (and usually compressed) version of the Jaxer client-side framework. This file is read once at server startup and kept in memory, to be embedded in pages that may require it. You can change this behavior using Jaxer.Response.prototype.setClientFramework. True when Jaxer is processing a callback request, false otherwise. True on the server side, false on the client (browser). A persistent session-like container that can store and persist name-value pairs in the context of one page. What constitutes a page is defined by configApps.js, usually from the page's URL (i.e. it determines which URLs constitute unique pages). A page and its callbacks have read/write access to this page container regardless of user session, and to no other page-level container. Adding functions (or their names) to this array is equivalent to setting their proxy property to true. To enforce no proxies, overriding any proxy property or runat="server-proxy", set Jaxer.proxies = null. Contains information and methods about the current request Contains information and methods about how to respond to the current request If Jaxer.Config.RESPONSE_ERROR_PAGE has been set, it's assumed to be the path to a file containing the error page to return when an error has occurred during the response. This file is read once at server startup and kept in memory, to be returned as required. If Config.RESPONSE_ERROR_PAGE is not set, a default HTML string is used. You can change the behavior of the framework when it encounters errors serving requests using Jaxer.Config.DISPLAY_ERRORS. A persistent session container that can store and persist name-value pairs in the context of a user/browser session across all pages of an application. What constitutes an application is defined by configApps.js, usually from the request's URL. A page and its callbacks have read/write access to this page container regardless of user session, and to no other page-level container. A persistent session-like container that can store and persist name-value pairs in the context of a user/browser session on a given page. What constitutes a page is defined by configApps.js, usually from the request's URL. A page and its callbacks have read/write access to this sessionPage container as long as the session continues, and to no other sessionPage containers.
Loads and evaluates JavaScript from the given location against the given global execution context. This is a low-level wrapper around "@mozilla.org/moz/jssubscript-loader;1" and mozIJSSubScriptLoader.loadSubScript. It's best to use the higher-level Jaxer.Includer.load(src, global, runat) which is also conveniently available as Jaxer.load(src, global, runat) inside any Jaxer server-side page (where global is defaulted to window).<br><br>(Advanced)
The url of the file to include, either as an absolute URL in the form "file:///..." or relative to the current executable's folder (with or without the "resource:///" prefix.
An optional global context in which to evaluate the script.
Notifies the framework that a fatal error has occurred, one which will require fixing and restarting Jaxer. How this is handled is then determined by the Jaxer.Config settings.<br><br>(Advanced)
The error describing what happened. If the framework has already been notified of an error, this error is not used.
Loads a JavaScript file and evaluates it.
The URL from which the JavaScript file should be retrieved. If the src is an absolute file://... URL then it is retrieved directly from the file system, otherwise it is retrieved via a web request.
The global (usually a window object) on which to evaluate it. By default, it is the current window object of the page.
The value of the effective runat "attribute" to use when evaluating this code. By default, it uses the same runat attribute as the last evaluated script block.
Loads all extensions from the folder defined in Config.EXTENSIONS_DIR.
Loads a framework extension (already defined in memory). If the namespaceObject defines an onLoad method, it will be called (without arguments)
The (unique) name to use for this extension
The object holding all the members of this extension
Holds the proxy functions for calling server functions that were designated with runat="both-proxy" (or equivalent), to prevent function name collisions. So e.g. if a function getName() is defined with runat="both-proxy", in the browser you can call getName() to use the client-side function or Jaxer.Server.getName() to use the server-side function. Jaxer.Server holds both the synchronous and asynchronous versions of the proxies (e.g. Jaxer.Server.getName() and Jaxer.Server.getName.async()).
Used to set events on DOM elements such that they "do the right thing" both client-side and server-side. On the client, this acts as expected, setting a property with the name eventName (e.g. onclick) on the DOM element. On the server, the eventName attribute is set on the DOM element so it can be serialized with the DOM before sending to the client. If the handler is a (server side) function with a name, the attribute's value is handler.name + "()" On the server,
The element on which to set the event
The name of the event to set
The handler function, or the body (as a string)
Sets the title of the document and works on either the server or the client.
The text of the title
Unloads a previously-loaded framework extension. If its namespaceObject defines an onUnload method, it will be called (without arguments)
The name used to load this extension
Whether to warn if the extension was not loaded when this was called, or its namespaceObject was not there.
Class for the current app's metadata
The constructor of an object that describes the current app's metadata
The properties to use for initializing this application: urlTest, name, db, path, etc.
Returns an instance of App
The fully-evaluated key to use when persisting or restoring values in the scope of the current application, using Jaxer.application. If this app's "appKey" property was a function, it will have been evaluated to a string using the current request. The key to use when persisting or restoring values in the scope of the current application, using Jaxer.application. This can be a string or a function: the function takes the request's parsedUrl as its sole parameter, and returns the key. The key should be unique across all applications. The database connection parameters to use by default for the current application. This can be an object or a function: the function takes the request's parsedUrl as its sole parameter, and returns the database connection parameters to use. The fully-evaluated database parameters to use by default for the current application. If this app's "db" property was a function, it will have been evaluated to a string using the current request. The name to use for the current application. This can be a string or a function: the function takes the request's parsedUrl as its sole parameter, and returns the name. The name should be unique across all applications (this is checked at server start). The fully-evaluated name to use for the current application. If this app's "name" property was a function, it will have been evaluated to a string using the current request. The fully-evaluated key to use when persisting or restoring values in the scope of the current page, using Jaxer.page or Jaxer.sessionPage. If this app's "pageKey" property was a function, it will have been evaluated to a string using the current request. The key to use when persisting or restoring values in the scope of the current page, using Jaxer.page or Jaxer.sessionPage. This can be a string or a function: the function takes the request's parsedUrl as its sole parameter, and returns the key. The key should be unique across all pages for any application. The filesystem path to use by default for the current application. This can be a string or a function: the function takes the request's parsedUrl as its sole parameter, and returns the parameters to use. The fully-evaluated filesystem path to use by default for the current application. If this app's "path" property was a function, it will have been evaluated to a string using the current request. The object that determines whether this app should be used for the current request. If a function, it takes the request's parsedUrl as its sole parameter, and returns true if this app should be used. If a regular expression, it should match against the request's parsedUrl's pathAndFile if this app should be used. If a string that contains a ".", it should equal the request's parsedUrl's pathAndFile if this app should be used. If a string that does not contain a ".", it should equal the request's parsedUrl's first pathPart if this app should be used.
Initializes (creates if necessary) the path for this app, if any
Network socket utility object for simple binary socket access.
The constructor of a network socket object used for binary data operations
Returns an instance of BinarySocket.
How many bytes are currently available on the stream?
the number of bytes available
Close the socket
Flush the socket's output stream
Open the socket for communication
The host to connect to
The port on which to connect
Read binary data from the socket into an array of bytes (integers)
How many bytes to read
The bytes read in, as an array of integers
Read binary data from the socket into a string
How many bytes to read
The bytes read in, as a string
Write a binary (byte) data array of integers to the socket
The binary data array to write
Write a binary (byte) data string to the socket
The binary data string to write
Callback namespace for remote functions.
The default polling interval used to see whether the XMLHttpRequest for an async callback function call has returned. Initially set to 11.<br><br>(Advanced) The default HTTP method to use for callback function requests. Initially set to "POST". The default number of milliseconds to wait before timing out an async callback function request. Initially set to 10 * 1000 (10 seconds).
Returns the URL for use in callbacks, without any parameters<br><br>(Advanced)
The URL to GET or POST to
The default method used to handle errors when calling remote functions asynchronously. It alerts the error message if Jaxer.ALERT_CALLBACK_ERRORS is true, and in any case throws an error<br><br>(Advanced)
If an error was thrown during the request, it would be here.
Any extra information passed in during the call to Jaxer.XHR.send() to help identify the request. Currently, there is one String-valued property on this object: functionName.
The XMLHttpRequest object that encountered the error. This might be null, if an error was encountered in creating the XMLHttpRequest.
The default method used to handle timeouts when calling remote functions asynchronously. It alerts the error message if Jaxer.ALERT_CALLBACK_ERRORS is true, and in any case throws an error<br><br>(Advanced)
The timeout error object encountered, having a "timeout" property with its value indicating the timeout (in milliseconds) used in this request.
Any extra information passed in during the call to Jaxer.XHR.send() to help identify the request. Currently, there is one String-valued property on this object: functionName.
The XMLHttpRequest object that encountered the error.
Transforms the raw result data from the XHR call into the expected data format.<br><br>(Advanced)
The name of the function that was called
The raw (text) data returned from the XHR call
The returned data in the format the remote function returned it
Creates a query string for calling a remote function with the given arguments
The name of the remote function
The arguments of the remote function. This can be a single (primitive) object or an array of (primitive) objects
Optionally, how many of the arguments (counting from the beginning) to not pass to the remote function
The query string
URL Encode a query string.
Query string to be converted.
A URL-encoding string
Returns a hash of the "form-like" name-value pairs needed to call a JavaScript function on the server. These can be submitted to the server as a GET request (but see Callback.getUrl which wraps this in a Url for you) or as a POST request, and usually via an XMLHttpRequest mechanism. <br><br> The server listens for two special name-value pairs: "resultAs" and "paramsAs". <br><br> If present, resultAs specifies how the result of functionToCall is to be returned to the client. Valid values for resultAs are "text", "object", and "wrappedObject" (default), which return the result of the callback as a single string, a JSON object literal, or a JSON object literal with metadata, respectively. <br><br> If present, "paramsAs" specifies how the request is to be translated into arguments for the functionToCall. Valid values for "paramsAs" are "text", "object", and "default", which hands the GET or POST data to functionToCall as a single string, a single hash (object literal) of name-value pairs, or as regular JavaScript arguments with values extracted from paramsToPass, respectively.
Name of the function (or the function itself) to be called server-side
An array of parameters (or the single parameter) to pass to the function
Optional parameter(s) to append to the end of the URL as part of the query string. String arguments should be "name=value" pairs joined by "&" characters. If arguments are a hash, their properties are added to the hash.
The hash of the information needed to invoke the function
Returns the URL that can be used as a GET request to call a JavaScript function on the server. <br><br> The server listens for two special properties: "resultAs" and "paramsAs". <br><br> If present, resultAs specifies how the result of functionToCall is to be returned to the client. Valid values for resultAs are "text", "object", and "wrappedObject" (default), which return the result of the callback as a single string, JSON object literal, or JSON object literal with metadata, respectively. <br><br> If present, "paramsAs" specifies how the request is to be translated into arguments for the functionToCall. Valid values for "paramsAs" are "text", "object", and "default", which hands the GET or POST data to functionToCall as a single string, a single hash (object literal) of name-value pairs, or as regular JavaScript arguments with values extracted from paramsToPass, respectively.
Name of the function (or the function itself) to call server-side
An array of parameters (or the single parameter) to pass to the function
Optional parameter(s) to append to the end of the URL as part of the query string. Strings will be appended to the end of the URL separated by a "&". Hashes will be appended as &name1=value&name2=value2...
The URL that can be called (via a GET) to invoke the function
Converts a javascript object (hash) into a http query string.
Hash of name value pairs to be converted.
The query string
This method invokes a synchronous call to a proxied JavaScript function on the server from the client side javascript.
The name of the remote function to call on the server
A single argument, or an array of arguments, to be passed to the remote function on the server
The value returned by the remote function on the server
This method invokes an asynchronous call to a proxied javascript function on the server from the client side javascript. A callback function needs to be provided and is called once the XHR request completes or times out.
If this is a function, this is the function to call upon a successful return from the remote invocation. Its arguments are what the remote function on the server returned. <br><br> If this is an array, its elements are as follows (each may be null): <ol> <li> the callback function; </li> <li> a function to call on an error, with arguments being the error, the "extra" information object that has the functionName as its one property, and the XMLHttpRequest object used for the call if the call itself encountered an error; </li> <li> the timeout to use, in milliseconds (defaults to Jaxer.Callback.TIMEOUT). Use 0 to wait indefinitely.</li> </ol> <br><br> If this is an object, its "callback", "errorHandler", and timeout properties will be used, if any.
The name of the remote function
A single argument, or an array of arguments, to be passed to the remote function on the server
A short convenience function to call a remote function, synchronously or asynchronously based on whether or not you specify a callback function as the third argument.
The name of the remote function to call
A single argument, or an array of arguments, to pass to the remote function
If this is not specified, the call will be synchronous. <br> If this is specified, the call will be asynchronous. <br><br> If this is a function, this is the function to call upon a successful return from the remote invocation. Its arguments are what the remote function on the server returned. <br><br> If this is an array, its elements are as follows (each may be null): <ol> <li> the callback function; </li> <li> a function to call on an error, with arguments being the error, the "extra" information object that has the functionName as its one property, and the XMLHttpRequest object used for the call if the call itself encountered an error; </li> <li> the timeout to use, in milliseconds (defaults to Jaxer.Callback.TIMEOUT). Use 0 to wait indefinitely. </li> </ol> <br><br> If this is an object, its "callback", "errorHandler", and timeout properties will be used, if any.
If synchronous, the value returned by the remote function; if asynchronous, an id by which the remote call can be canceled via Jaxer.XHR.cancel()
A namespace object holding functions and members for preparing the callback data at the end of page processing that will allow the page to call back its server-side functions.
Generate the unique key by which callbacks are stored/cached<br><br>(Advanced)
The name identifying the page that was served
The crc32 signature of the callback contents, used to see whether the code was changed
The key uniquely identifying the callback page
Process all functions for possible caching, proxying, and callback invocation.<br><br>(Advanced)
The current document's DocumentElement. This is used to create elements in the active DOM as needed.
An error that can be thrown on the client during a callback
An error that can be thrown on the client during a callback. If you want to throw a meaningful (i.e., non-generic) error on the browser from a callback, throw a new Jaxer.ClientError -- just be mindful not to pass sensitive server-side information. On the client, a new Error will be thrown by your proxy, or you can specify you'd like something else to be thrown.
The descriptive text of the Error to be thrown, or an object whose properties will be copied to the Error object to be thrown. But if options.wrapped is specified to be false, this argument itself is thrown on the client.
A hashmap of name-value property pairs. Currently one option is supported: if there is a 'wrapped' property and it is set to false, the info object itself is thrown on the client, rather than a new Error.
Namespace containing the config properties.
A Boolean flag to indicate whether to popup a window.alert(...) when a callback returns an error. By default this is set to true; if this is not the desired behavior in production, override it in your local Jaxer config. Whether to automatically create folders at the locations specified by each app's (resolved) PATH property, either at server start (if the app's name is a string) or when the app is first requested (if the app's name is a function of the request). This is true by default. A Boolean flag to indicate where to cache as source or bytecode. This is set to true by default, so it's easy in development time to read what was cached rather than caching the bytecode. Override it to false for better performance. Contains the message to display when a callback error occurs. Contains the message to display when a fatal callback error occurs. The special url designator, usually "/jaxer-server/callback". It is defined in the apache conf. The URL at which the client should look for the Jaxe client-side framework, if EMBEDDED_CLIENT_FRAMEWORK_SRC is undefined or null. To embed the client part of the Jaxer framework in the web page, specify its location in EMBEDDED_CLIENT_FRAMEWORK_SRC Alternatively, to have the web server serve its contents, <BR>1) comment out EMBEDDED_CLIENT_FRAMEWORK_SRC, <BR>2) copy the client framework to somewhere the web server can reach it, and <BR>3) set CLIENT_FRAMEWORK_SRC to the src of the script element that will be inserted into the page <BR>EMBEDDED_CLIENT_FRAMEWORK_SRC: "resource:///framework/clientFramework_compressed.js" If any config-type parameters were specified on the command line when launching Jaxer, they will be included as properties of this object. Note: This is created and populated inside aptEventHandler.js Contains the parameters that will be used for pages and applications that don't match any of the custom entries in Jaxer.Config.apps, as defined in configApps.js. This property is best managed, if needed, in the local_jaxer/conf/configApps.js which will not be overwritten by subsequent jaxer updates. Changes in that file will get picked up automatically on restart. Note: even though this is created as a plain object (hashmap) in config.js, it is wrapped up into a Jaxer.App object upon server start Contains the parameters for a connection object of one of the supported DB implementations. At the very least, the IMPLEMENTATION property must be defined and be the name of one of the supported implementations in the DB namespace (e.g. "SQLite", "MySQL"). The remaining parameters have all the information required to connect to the database. This will be used for pages and applications that don't match any of the custom entries in Jaxer.Config.apps, as defined in configApps.js. This property is best managed in the local_jaxer/conf/configApps.js which will not be overwritten by subsequent jaxer updates. Changes in that file will get picked up automatically on restart. For convenience, a central starting point from which to build paths used as default locations where apps read and write files. To make it easier to use cross-platform, should include trailing path separator. A flag to allow a central place to flip the operational behavior of a Jaxer instance from development to production mode. CAUTION: this should be set to false in a production environment to prevent sensitive information from getting to the browser! A Boolean flag to indicate whether errors should be displayed to the user. By default this is set to true, which is fit for development/debug mode only. CAUTION: In a production environment this should be set to false so that sensitive server content is not displayed to the client -- instead users will see a generic error page. If this is true, a conventional "X-Powered-By" HTTP header is added to every response processed by Jaxer indicating that is was processed by Jaxer and giving the Jaxer version. This is set to false by default for added security. The folder containing JavaScript extension scripts. All JavaScript files in this folder will be loaded on startup after the Jaxer framework. Contains the path (including filename) of the html file to be displayed instead of the detailed error message when a fatal error occurs, if Jaxer.Config.DISPLAY_ERRORS is set to false (i.e. in production mode). By default this is "resource:///content/fatalError.html", and if it is not set a default HTML string is used. Contains the parameters for a connection object of one of the supported DB implementations. At the very least, the IMPLEMENTATION property must be defined and be the name of one of the supported implementations in the DB namespace (e.g. "SQLite", "MySQL"). The remaining parameters have all the information required to connect to the database. This will be used for the Jaxer framework's internal persistence needs. It defaults to using SQLite. This property is best managed in the local_jaxer/conf/config.js which will not be overwritten by subsequent jaxer updates. Changes in that file will get picked up automatically on restart. Indicates where to find the framework content, usually a mozilla resource url relative to the jaxer executable install folder. By default it is "resource:///framework" The name of the JavaScript file containing the Jaxer framework code. By default it is "serverFramework.js". It is located in the folder indicated by Jaxer.Config.FRAMEWORK_DIR A flag to indicate whether errors during fetching of a file to be included are to be handled as response errors, e.g. using the response error page. By default this is true. Additional libraries to load on Jaxer startup. Multiple library names should be separated by spaces, commas, or semicolons. By default this is "JSLib.js". Contains the path to the folder containing local variants of the various Jaxer config-type files, which will override settings in the corresponding default files. The local files will not be overwritten by a Jaxer update. Relative paths should be anchored from the Jaxer executable folder. "../local_jaxer/conf" A flag that indicates (by convention) that the local config file was loaded during startup. Contains the path (including filename) to the local folder containing JavaScript extension scripts. All JavaScript file in this folder will be loaded on startup after the Jaxer framework. Relative paths should be anchored from the Jaxer executable folder. Contains the name of the log file to use if Jaxer.Config.USE_CORE_LOG_FILE is set to false. By default this is neither set nor used. To set any of Mozilla preferences, add properties to Jaxer.Config.MOZ_PREFS. The name of each property should correspond exactly to the Mozilla preference, and the value should be an integer, boolean, or string. To see some of the available options, launch Firefox and browse to about:config When true, the Jaxer framework will force reloading from source every script tag marked with autoload="true" during every request to the page (not during callbacks), rather than using the cached version which is refreshed only on server restart. This is intended for use while developing, as it allows you to edit autoloaded file and see the changes without restarting Jaxer. This is set to "true" by default and should be overridden to "false" for production. Contains the path (including filename) of the html file to be displayed instead of the detailed error message when a response error occurs, if Jaxer.Config.DISPLAY_ERRORS is set to false (i.e. in production mode). By default this is "resource:///content/responseError.html", and if it is not set a default HTML string is used. To include scripts, access files, and so on, Jaxer may need to fetch content from the web server. If your web server needs to be reached via a different domain/port than the incoming request, uncomment and change the following to replace the protocol://domain:port with this value. For example, setting it to "http://192.168.0.1:8082" will mean that Jaxer will request content from your web server using the IP address 192.168.0.1 on port 8082. This is neither used nor set by default. A regular expression used to test the requested url and determine whether or not to apply the Jaxer.Config.REWRITE_RELATIVE_URL If this is not set, and Jaxer.Config.REWRITE_RELATIVE_URL is set, then all requests to the web server are rewritten using Jaxer.Config.REWRITE_RELATIVE_URL. For example, setting it to "^http\\:\\/\\/my.domain.com" will mean that Jaxer will request content from your web server using Jaxer.Config.REWRITE_RELATIVE_URL only for URLs starting with "http://my.domain.com". This is neither used nor set by default. If a URL matches this regular expression, it will be treated as a file URL even when resolved for Web-type operations such as within script tags, in Jaxer.load(), or in Web.get(). This is useful for accessing files that reside the jaxer-include folder which are protected from being served out by the web server. A flag to indicate whether uncaught JavaScript errors are to be handled as response errors, e.g. using the response error page. By default this is true. A boolean flag to indicate whether to use the Jaxer core logfile for framework and application logging. By default this is true.
Container object that is used for all types of containers (e.g. session, sessionPage, etc).
This is the contructor for the Container object, used for all types of containers (session, sessionPage, etc).<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage container is per page, and the page's key is used here)
An instance of the persistor (e.g. a DBPersistor) to be used to persist this container
The name of this container
Returns an instance of Container.
Does the container have the given property set?<br><br>(Advanced)
The name of the property to look for
true if it exists, false otherwise
Gets the value of the given property<br><br>(Advanced)
The name of the property whose value we need
The value
Was this property just created, or was it previously persisted?<br><br>(Advanced)
The name of the property to query
true if it was already there before, false if it's newly added
Load the container from its store, but only if it has not yet been loaded<br><br>(Advanced)
Persists a container.<br><br>(Advanced)
The document into which container information may be persisted (currently not used)
Remove (unset) a property<br><br>(Advanced)
The name of the property to remove
Removes (unsets) all properties on this container<br><br>(Advanced)
Revert a property to its previously-persisted value<br><br>(Advanced)
The name of the property to revert
Sets a name-value pair in the current container.<br><br>(Advanced)
The name of the property to set
The value of the property
Mark a property as changed so it persists<br><br>(Advanced)
The name of the property to touch
Initialize the Containers subsystem for the current request<br><br>(Advanced)
The string identifying the application associated with the current request
The string identifying the page associated with the current request
Persists all container data to the store (as needed).<br><br>(Advanced)
The current document, if any, into which the clientData container's data will be inserted. Not applicable for callbacks.
A namespace object holding functions and members used to handle the events fired from the Jaxer Core into the Jaxer Framework.
Bind a handler to the specified eventType.<br><br>(Advanced)
One of the allowed event types (see Jaxer.CoreEvents.getEventNames)
A function reference invoked when the event specified by eventType is triggered
An optional function to be evaluated when the event is about to be fired; it'll only be fired if the function evaluates to true. The one argument passed to this function is the request (same as Jaxer.request)
Optional object on which to call the handlerFunction (it becomes the value of 'this' within the function).
Removes the handlers for the specified eventType.<br><br>(Advanced)
One of the allowed event types (see Jaxer.CoreEvents.getEventNames)
Triggers the handlers for the specified eventType.<br><br>(Advanced)
One of the allowed event types (see Jaxer.CoreEvents.getEventNames)
Returns a (copy of the) array of framework event names to which you can register handlers<br><br>(Advanced)
n array of handler names (modifying it has no impact on CoreEvents)
Returns an array of handlers for the specified eventType.<br><br>(Advanced)
One of the allowed event types (see Jaxer.CoreEvents.getEventNames)
An array of handlers
Should the given script element be evaluated (server-side) by Jaxer Core rather than be handled separately by the Jaxer framework or be ignored by Jaxer as far as evaluation goes. Note that if the script element has a src attribute then the framework will inline a call to load the script from the src, and that's why this method returns a true in that case.<br><br>(Advanced)
The DOM script element
true if it should be evaluated, false if it should not
Should the given script element be loaded and evaluated (server-side) by the Jaxer framework<br><br>(Advanced)
The DOM script element
true if it should be loaded and valuated, false if it should not
Remove an existing handler on an event type<br><br>(Advanced)
One of the allowed event types (see Jaxer.CoreEvents.getEventNames)
The handler to remove
The namespace that holds functions and other objects for working with a database.
Holds a reference to the constructor of the current default database connection used for database interactions, e.g. by Jaxer.DB.execute. This is determined by the settings in configApps.js and in config.js. It can be different for different requests. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc.<br><br>(Advanced) A hashmap that holds references to the currently-recognized default database connections, according to configApps.js, config.js, and the page requests encountered so far. It's keyed off the (resolved) name of the current app.<br><br>(Advanced) Holds a reference to the constructor of the current default connection used for the Jaxer framework's internal database interactions, e.g. by Jaxer.DB.frameworkExecute. This is determined by the settings in config.js. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc.<br><br>(Advanced) When you INSERT a row that has an AUTO_INCREMENT-type column in the default framework database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column.<br><br>(Advanced) When you INSERT a row that has an AUTO_INCREMENT-type column in the default framework database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertRowId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertRowId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column.<br><br>(Advanced) Holds a reference to the current default connection that will be used for database interactions, e.g. by Jaxer.DB.execute. This is determined by the settings in configApps.js and in config.js. It can be different for different requests. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. Holds a reference to the current default connection that will be used for the Jaxer framework's internal database interactions, e.g. by Jaxer.DB.frameworkExecute. This is determined by the settings in config.js. Its type is Jaxer.DB.MySQL.Connection or Jaxer.DB.SQLite.Connection, etc. When you INSERT a row that has an AUTO_INCREMENT-type column in the default developer database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column. When you INSERT a row that has an AUTO_INCREMENT-type column in the default developer database, the value of that column in this row is automatically set by the database. To know what it was set to (an integer), retrieve the lastInsertRowId right after you execute the INSERT statement. Under other circumstances, the behavior of lastInsertRowId depends on the database implementation; for example, SQLite always returns the rowid of the last successfully inserted row, whether or not it had an INTEGER PRIMARY KEY AUTO_INCREMENT column.
Closes all the default DB connections that are open. This is called by the framework when there is a fatal or response error, or after every request if CLOSE_AFTER_REQUEST is set to true in the connection's configuration parameters<br><br>(Advanced)
Set this to true if you only want to close connections whose CLOSE_AFTER_REQUEST parameter is true
Executes the given SQL query string on the default framework database (as defined in Jaxer.Config.DB_FRAMEWORK). If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array.<br><br>(Advanced)
<pre> rs = Jaxer.DB.frameworkExecute("SELECT * FROM containers"); rs = Jaxer.DB.frameworkExecute("SELECT * FROM containers WHERE id=? AND name=?", myId, myName); rs = Jaxer.DB.frameworkExecute("SELECT * FROM containers WHERE id=? AND name=?", [ myId, myName ] ); </pre>
The SQL to execute.
The results of the query (which may be an empty resultset)
Initializes a default database connection, which entails creating it (not necessarily opening it) and adding it to the Jaxer.DB.defaultConnections hashmap<br><br>(Advanced)
The (resolved) name of the app for which this connection should be used
The parameters to use for the database connection. In particular this object must have an IMPLEMENTATION property equal to "MySQL", "SQLite", or other supported databases.
Sets the given named connection as the default one from now on (though this is by default set anew for each request). If the given name is not already a recognized (i.e. initialized) connection, it will first be initialized.<br><br>(Advanced)
The (resolved) name of the app for which this connection should be used
The parameters to use for the database connection if the name is not already an initialized connection. In particular this object must have an IMPLEMENTATION property equal to "MySQL", "SQLite", or other supported databases.
Attempts to convert the given sql to a string, if needed, and then trim it. If the conversion fails or the string is empty, throws a Jaxer.Exception.<br><br>(Advanced)
The sql to convert to a string, if needed
The logger into which errors should be logged. Defaults to the DB module's logger.
The string representation of the sql.
Executes the given SQL query string on the current default database (as defined in configApps.js). If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array.
<pre> rs = Jaxer.DB.execute("SELECT * FROM myTable"); rs = Jaxer.DB.execute("SELECT * FROM myTable WHERE id=? AND zip=?", myId, myZip); rs = Jaxer.DB.execute("SELECT * FROM myTable WHERE id=? AND zip=?", [ myId, myZip ] ); </pre>
The SQL to execute.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. On MySQL only: if multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. On MySQL only: if multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. On MySQL only: if multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
Prepares the given SQL query string on the current default database (as defined in configApps.js) and then iteratively executes it over the given array of parameters.
<pre> [ rsA, rsB ] = Jaxer.DB.mapExecute("SELECT * FROM myTable WHERE id=?", [ idA, idB ] ); [ rsA, rsB ] = Jaxer.DB.mapExecute("SELECT * FROM myTable WHERE id=? AND zip=?", [ [ idA, zipA ] , [ idB, zipB ] ] ); </pre>
The SQL to execute, using ?'s (question marks) as parameter placeholders
An array of parameters to use for each execution. Each element of the array may itself be a single value or an array of values (corresponding to the ?'s in the SQL)
An optional hashmap of options. Currently one option is supported: flatten. If its value is true, the returned result will be a single ResultSet with its rows being the concatenated rows of each query.
A corresponding array of Jaxer.DB.ResultSet's for each query, or a single Jaxer.DB.ResultSet if the 'flatten' option is true.
Prepares the given SQL query string on the default framework database (as defined in Jaxer.Config.DB_FRAMEWORK) and then iteratively executes it over the given array of parameters.
<pre> [ rsA, rsB ] = Jaxer.DB.mapFrameworkExecute("SELECT * FROM containers WHERE id=?", [ idA, idB ] ); [ rsA, rsB ] = Jaxer.DB.mapFrameworkExecute("SELECT * FROM containers WHERE id=? AND name=?", [ [ idA, nameA ] , [ idB, nameB ] ] ); </pre>
The SQL to execute, using ?'s (question marks) as parameter placeholders
An array of parameters to use for each execution. Each element of the array may itself be a single value or an array of values (corresponding to the ?'s in the SQL)
An optional hashmap of options. Currently one option is supported: flatten. If its value is true, the returned result will be a single ResultSet with its rows being the concatenated rows of each query.
A corresponding array of Jaxer.DB.ResultSet's for each query, or a single Jaxer.DB.ResultSet if the 'flatten' option is true.
Namespace that holds the MySQL implementation of the Jaxer DB API.
Creates a new database named according to connectionParams.NAME, if one does not already exist.
A hashmap of required parameters to connect to the database. Required properties are HOST (hostname of the server), USER (username for authentication), PASS (password for authentication), NAME (database name), PORT (connection port, default value is "3306"), and CLOSE_AFTER_EXECUTE (whether to close the connection after each call to execute, default is open).
Returns and instance of Connection.
Validate the provided connection parameters
A hashmap of required parameters to connect to the database. Required properties are HOST (hostname of the server), USER (username for authentication), PASS (password for authentication), NAME (database name)
Creates a new connection to the given databaseName (file).
Creates a new connection to the given databaseName. The resulting connection object is the only way to interact with the database.
A hashmap of required parameters to connect to the database. Required properties are HOST (hostname of the server), USER (username for authentication), PASS (password for authentication), NAME (database name), PORT (connection port, default value is "3306"), and CLOSE_AFTER_EXECUTE (whether to close the connection after each call to execute, default is open).
Returns an instance of Connection.
Returns the string identifying the database implementation of this connection. You can compare this e.g. to Jaxer.DB.SQLite.IMPLEMENTATION or Jaxer.DB.MySQL.IMPLEMENTATION Is the connection currently open? Recall that even if the answer is no the connection would automatically be opened when needed. Returns the unique ID used for an AUTO_INCREMENT column in the most recent successful INSERT command on the current connection. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is a synonym for lastInsertRowId. See http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html for more details. Returns the unique ID used for an AUTO_INCREMENT column in the most recent successful INSERT command on the current connection. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is a synonym for lastInsertId. See http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html for more details. Returns the string identifying the version of the database to which you are connected.
Closes the connection if it's open. This is optional, and only does something if the connection is open.
Executes the given sql using the connection. If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array.
<pre> rs = conn.execute("SELECT * FROM myTable"); rs = conn.execute("SELECT * FROM myTable WHERE id=? AND zip=?", myId, myZip); rs = conn.execute("SELECT * FROM myTable WHERE id=? AND zip=?", [ myId, myZip ] ); </pre>
The sql statement to be executed as a prepared statement
The sequential parameters passed to the prepared statement for execution. If this is an array, it is used as the list of parameters. If this is one or more parameters, that is used as the list.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. If multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. If multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned. If multiple queries were issued (or a stored procedure was executed) the result will be a corresponding array of Jaxer.DB.ResultSet or Number objects.
Returns the unique ID used for an AUTO_INCREMENT column in the most recent successful INSERT command on the current connection. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is the same as asking for the lastInsertId or lastInsertRowId properties. See http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html for more details.
The id, or 0
Prepares the given SQL query string on the current default database (as defined in configApps.js) and then iteratively executes it over the given array of parameters.
<pre> [ rsA, rsB ] = conn.mapExecute("SELECT * FROM myTable WHERE id=?", [ idA, idB ] ); [ rsA, rsB ] = conn.mapExecute("SELECT * FROM myTable WHERE id=? AND zip=?", [ [ idA, zipA ] , [ idB, zipB ] ] ); </pre>
The SQL to execute, using ?'s (question marks) as parameter placeholders
An array of parameters to use for each execution. Each element of the array may itself be a single value or an array of values (corresponding to the ?'s in the SQL)
An optional hashmap of options. Currently one option is supported: flatten. If its value is true, the returned result will be a single ResultSet with its rows being the concatenated rows of each query.
A corresponding array of Jaxer.DB.ResultSets or Numbers for each query, or a combined Jaxer.DB.ResultSet or Number if the 'flatten' option is true. For SELECT-type queries one or more Jaxer.DB.ResultSets are returned; for INSERT/UPDATE/DELETE-type queries the number of affected rows is returned.
Opens the connection so queries can be executed. This is optional, since if the connection is not open when it's asked to execute some SQL, it will open the connection automatically. Also closing the connection is optional.
Tests the connection by trying to connect and catching and returning any error encountered. If the connection is successful, returns a null.
If true, the connection will be kept open (if the test was successful). If false, the connection will be left in the same state as before the test: if it was open before it will be kept open, otherwise it will be closed.
If successful, returns null; if unsuccessful, returns the error. Usually you can use the error's sqlErrorCode and sqlErrorDescription to see what the error was (or just its toString() method).
Contains the returned value of a SQL query.
If the third column is named "account" you can get to a given cell value either through resultSet.rows [ 10 ] .account or through resultSet.rows [ 10 ] .$values [ 2 ] or through resultSet.rowsAsArrays [ 10 ] [ 2 ]
Returned value of a SQL query, containing the named rows and columns of the result and to be used as the return value of execute(). Each row has a special property, $values, that is an array ordered according to the columns array. The rowsAsArray array is similar to the rows array but each row in it is an array itself: it is the corresponding $values array. To see if there is any data, check whether hasData is true or whether rows.length or rowsAsArrays.length exceed 0. To get a single result (the first column of the first row) grab singleResult.
Returns an instance of ResultSet.
An array of column names for all rows in this resultSet. TODO - Note that (depending on the DB "driver" implementation used) the columns array may be empty if there are no rows of data; this will be fixed in the future. This returns the data in the last row of the resultSet as an array, or else it contains an empty array. (You can disambiguate DB nulls from no data by checking the hasData property or rows.length). An alias of the Jaxer.DB.ResultSet.prototype.singleRow method True if this resultSet contains any data, false otherwise. The array of rows in the resultSet in the order retrieved from the database. Each row has properties corresponding to the column names in the returned data. Each row also has a special property, $values, that's an array of the values in that row (in the same order as the columns array). An alternate representation of the rows of the resultSet: each row is itself an array, containing the values (cells) in that row in the same order as the columns array. This returns the data in each of the first columns of the resultSet as an array, or else it contains an empty array. (You can disambiguate DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries that are used to populate dropdowns. This contains the first value (cell) in the first row in the resultSet, if any, or else it contains null. (You can disambiguate DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries (e.g. "SELECT COUNT(*) FROM mytable") that are known to return a single value. This contains the data in the first row of the resultSet as an array, or else it contains an empty array. (You can disambiguate DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries (e.g. "SELECT * FROM mytable where key = 'value'") that are known to return a single value.
Adds a row, where its structure is assumed to be the same as all the other rows. Note that in particular it must have a $values property.
The row to add
Closes this resultSet and empties its internal data structures. This is optional.
This return the data in the provided columns of the resultSet as an array, or else it contains null.
the columns to return, either as an array index value, or a column label value, you can specify 1 or more columns to be returned
A javascript array of arrays containg each of the values of the requested column from the current resultset
every runs a function against each row in the recordset while that function is returning true. returns true if the function returns true for every row it could visit The function is invoked with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
Returns an array of objects, one per row, that only have properties corresponding to the given columns.
The names of the columns that should be made available for each row.
An array of simple objects, each with the requested properties.
For the current row pointed to by the cursor, returns the value of the field (column) at the given (0-based) index, the same as this.rowsAsArrays [ currentRowIndex ] [ fieldIndex ] Throws a Jaxer.Exception if fieldIndex is out of range.
The 0-based index of the desired field (column), bounded by this.columns.length.
The value of the field (column)
For the current row pointed to by the cursor, returns the value of the field (column) at the given fieldName (column name), the same as this.rows [ currentRowIndex ] [ fieldName ] Throws a Jaxer.Exception if fieldName is not the name of a field (column).
The name of the desired field (column), which should be an element of the Array this.columns.
The value of the field (column)
Returns the number of fields (columns) in this resultSet, the same as this.columns.length.
The number of fields (columns)
Returns the name of the column at the given (0-based) index, the same as this.columns [ fieldIndex ] . Throws a Jaxer.Exception if fieldIndex is out of range.
The 0-based index of the desired field (column), bounded by this.columns.length.
The name of the field (column)
filter returns a new array with all of the elements of this array for which the provided filtering function returns true. The function is invoked with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
Function to test each row of the recordset
This contains the requested columns from the last row of the resultSet as an array, or else it contains an empty array.
the columns to return, either as an array index value, or a column label value, you can specify 1 or more columns to be returned
A javascript array the values of the requested columns from the last row of the current resultset
forEach executes the provided function (callback) once for each element present in the recordset. The callback is invoked with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
Function to execute against each row of the recordset
indexOf compares the value of the requested column in each row of the results using strict equality (the same method used by the ===, or triple-equals, operator). it returns either the index of the first matched item or -1 if no items match
Returns the index of the column with the given name
The textual name of the database column
The 0-based index in the columns array (and in each row in the rows array)
True if this resultSet's cursor is positioned on a valid row, which means you can access the row's data.
true if positioned on a valid row, false otherwise
indexOf compares the value of the requested column in each row of the results using strict equality (the same method used by the ===, or triple-equals, operator). it returns either the index of the last matched item or -1 if no items match
An alias of the Jaxer.DB.ResultSet.prototype.finalRowAsArray method
map runs a function on every row in the resultset and returns the results in an array. The row and index of the current item are passed as parameters to the current function.
Advances this resultSet's cursor to the next row of results. Use isValidRow() to determine if you've reached the end of the rows.
reduce runs a function on every item in the resultset and collects the results returned. reduce executes the callback function once for each element present in the resultset, receiving four arguments: - the initial value (or value from the previous callback call), - the value of the current row of the resultset, - the current index, - an array representing the resultset over which iteration is occurring.
reduceRight runs a function on every item in the resultset and collects the results returned, but in reverse order starting with the last element of the recordset. reduceRight executes the callback function once for each element present in the resultset, excluding holes in the array, receiving four arguments: - the initial value (or value from the previous callback call), - the value of the current row of the resultset, - the current index, - an array representing the resultset over which iteration is occurring.
An alias of the Jaxer.DB.ResultSet.prototype.singleRowAsArray method
This contains the requested columns from the first row of the resultSet as an array, or else it contains an empty array.
the columns to return, either as an array index value, or a column label value, you can specify 1 or more columns to be returned
A javascript array the values of the requested columns from the first row of the current resultset
some runs a function against each row in the recordset while that function until returning true. returns true if the function returns true for at least one row it could visit The function is invoked with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
split runs a function against each row in the recordset. returns A two element array containing the recorset items for which the function returned true as the first element and the items which returned false as the 2nd element. The function is invoked with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
Returns a HTML table snippet containing the resultset items
An optional hashmap which will be turned into attribute-value pairs on the table tag
An optional hashmap which will be turned into attribute-value pairs on the thead tag
An optional hashmap which will be turned into attribute-value pairs on the tbody tag
HTML table snippet containing the resultset items
Returns a string representation of the resultset object
A string representation of the resultset object
Namespace that holds the SQLite implementation of the Jaxer DB API.
Creates a new database file according to connectionParams.PATH
A hashmap of parameters needed to connect to the database. The properties required of connectionParams are: PATH: the path to the file of the database
Returns an instance of Connection.
Validate the provided connection parameters
A hashmap of parameters needed to connect to the database. The properties required of connectionParams are: PATH: the path to the file of the database
Creates a new connection to the given databaseName (file).
Creates a new connection to the given database (file). If the given database does not yet exist, it is created for you when you try to open it. The resulting connection object is the only way you interact with the database.
A hashmap of parameters needed to connect to the database. The only required property is PATH: the path to the database (data) file. An optional CLOSE_AFTER_EXECUTE parameter specifies whether to close the connection after each call to execute; the default is to keep it open.
Returns an instance of Connection.
Returns the string identifying the database implementation of this connection. You can compare this e.g. to Jaxer.DB.SQLite.IMPLEMENTATION or Jaxer.DB.MySQL.IMPLEMENTATION Is the connection currently open? Recall that even if the answer is no the connection would automatically be opened when needed. Returns the unique "rowid" of the most recent successful INSERT command on the current connection. If the table has a column of type INTEGER PRIMARY KEY, this is used as the rowid. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is a synonym for lastInsertRowId. See http://www.sqlite.org/c3ref/last_insert_rowid.html for more details. Returns the unique "rowid" of the most recent successful INSERT command on the current connection. If the table has a column of type INTEGER PRIMARY KEY, this is used as the rowid. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is a synonym for lastInsertId. See http://www.sqlite.org/c3ref/last_insert_rowid.html for more details. Returns the string identifying the version of the database to which you are connected.
Closes the connection if it's open. This is optional, and only does something if the connection is open.
Executes the given sql using the connection. If the SQL includes ?'s (question marks) as parameter placeholders, the values of those parameters should be passed in as extra arguments to this function, either as individual arguments or as a single array.
<pre> rs = conn.execute("SELECT * FROM myTable"); rs = conn.execute("SELECT * FROM myTable WHERE id=? AND zip=?", myId, myZip); rs = conn.execute("SELECT * FROM myTable WHERE id=? AND zip=?", [ myId, myZip ] ); </pre>
The sql statement to be executed as a prepared statement
The sequential parameters passed to the prepared statement for execution. If this is an array, it is used as the list of parameters. If this is one or more parameters, that is used as the list.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned.
The results of the query. For a SELECT-type query, a Jaxer.DB.ResultSet is returned, with 0 or more rows. For an INSERT/UPDATE/DELETE-type query, the number of rows affected is returned.
Returns the unique "rowid" of the most recent successful INSERT command on the current connection. If the table has a column of type INTEGER PRIMARY KEY, this is used as the rowid. If no successful INSERTs have ever occurred on this connection, 0 is returned. Note that unsuccessful INSERTs do not change this value. This is the same as asking for the lastInsertRowId or lastInsertId properties. See http://www.sqlite.org/c3ref/last_insert_rowid.html for more details.
The rowid, or 0
Prepares the given SQL query string on the current default database (as defined in configApps.js) and then iteratively executes it over the given array of parameters.
<pre> [ rsA, rsB ] = conn.mapExecute("SELECT * FROM myTable WHERE id=?", [ idA, idB ] ); [ rsA, rsB ] = conn.mapExecute("SELECT * FROM myTable WHERE id=? AND zip=?", [ [ idA, zipA ] , [ idB, zipB ] ] ); </pre>
The SQL to execute, using ?'s (question marks) as parameter placeholders
An array of parameters to use for each execution. Each element of the array may itself be a single value or an array of values (corresponding to the ?'s in the SQL)
An optional hashmap of options. Currently one option is supported: flatten. If its value is true, the returned result will be a single ResultSet with its rows being the concatenated rows of each query.
A corresponding array of Jaxer.DB.ResultSets or Numbers for each query, or a combined Jaxer.DB.ResultSet or Number if the 'flatten' option is true. For SELECT-type queries one or more Jaxer.DB.ResultSets are returned; for INSERT/UPDATE/DELETE-type queries the number of affected rows is returned.
Opens the connection so queries can be executed. This is optional, since if the connection is not open when it's asked to execute some SQL, it will open the connection automatically. Also closing the connection is optional.
Tests the connection by trying to connect and catching and returning any error encountered. If the connection is successful, returns a null.
If true, the connection will be kept open (if the test was successful). If false, the connection will be left in the same state as before the test: if it was open before it will be kept open, otherwise it will be closed.
If successful, returns null; if unsuccessful, returns the error. Usually you can use the error's sqlErrorCode and sqlErrorDescription to see what the error was (or just its toString() method).
A database-based persistor for Jaxer Container objects (session, sessionPage, etc.)
A database-based persistor for Jaxer Container objects (session, sessionPage, etc.)<br><br>(Advanced)
Returns an instance of DBPersistor.
Retrieve a given container type's and name's property, by name<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage ontainer is per page, and the page's key is used here)
The name of the property to query for
The value of the (usually serialized) requested property, or the empty string if there is none
Load all the name-value properties at once for the given container type and key<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage container is per page, and the page's key is used here)
A hashmap of name-value pairs; the values are usually serialized and need to be deserialized via Serialization.fromJSONString
Persist a particular property (by name) for the given container type and key<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage container is per page, and the page's key is used here)
The name of the property to persist
The value to persist for this property, which should have already been serialized (using Serialization.toJSONString)
Completely remove the given property from the database<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage container is per page, and the page's key is used here)
The name of the property to remove
Completely remove all the container's properties from the database<br><br>(Advanced)
The type of the container
The key for the specific instance of the container (e.g. the sessionPage container is per page, and the page's key is used here)
Creates the database schema needed to persist containers<br><br>(Advanced)
Utility object for filesystem directory access.
Creates a new Directory handle for performing filesystem directory operations.
a java style path object where double backslash is used as a folder hierarchy delimiter
a Dir object reference initialized to the provided path.
Throws an exception containing the error code.
Clone a directory object
an new Dir Object cloned from the original
Throws an Exception containing the error code.
Tests whether a file Object exists in the Physical directory referenced by the Dir object
the aFileObj parameter may be either a JSLib file object or a string containing the name of the object.
True/False indicates whether the file was found;
Throws an Exception containing the error code.
Creates a new folder under the referenced path of the directory object The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
The permissions used to create the filesystem object.
Throws a Exception containing the error code if filesytem object is unable to be created.
Creates a hierarchy of folders as needed to contain the current folder's path. The format of the permissions is the same as for the create method.
The permissions used to create al the filesystem objects
Throws a Exception containing the error code if any filesytem object is unable to be created.
Create a new unique folder under the referenced path of the directory object The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
The permissions used to create the filesystem object, this may be ignored by some versions of windows.
Throws an Exception containing the error code.
Read the contents of a directory
an Array of Filesystem Objects, with no sort order explicitly set.
Throws an Exception containing the error code.
Removes specified folder from the file system
True/False value to indicate whether the removal includes subfolders.
Throws a Exception containing the error code.
Combines any number of path fragments into a single path, using the current operating system's filesystem path separator. Before joining two fragments with the path separator, it strips any existing path separators on the fragment ends to be joined
Takes any number of string path fragments
The fragments joined into a path
Creates a new folder (directory) at the specified path and returns it The format of the permissions is a unix style numeric chmod i.e. 0777 or 444 on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
The path of the new folder
The permissions used to create the filesystem object.
The new directory object
Throws a Exception containing the error code if filesytem object is unable to be created.
Creates a hierarchy of folders as needed to contain the current folder's path. The format of the permissions is the same as for the create method.
The path of the new folder
The permissions used to create all the filesystem objects
The new directory object
Throws a Exception containing the error code if filesytem object is unable to be created.
Does the directory exist on disk?
The full or partial (to be resolved) path to test
true if exists, false otherwise
Scan a folder tree from the provided path and find files that match the provided regular expression pattern. The available options properties are pattern : a string containing a regular expression i.e. "^.*\.js$" flags : the flags to use with the regular express. i.e. "i" to ignore case recursive: true/false indication of whether to search sub folders for the match
The starting path for the search. This must be a folder.
Optional An Associative Array of optional parameters
An Array of Jaxer.File objects that matched the provided pattern
A Jaxer.Exception object is thrown when the path is not a valid folder
Scan a folder tree from the provided path and find files that match the provided regular expression pattern and run the provided function against each match
The starting path for the search. This must be a folder.
Optional An Associative Array of optional parameters
Optional The function to run. It will be invoked for each the matched Jaxer.File object, with the Jaxer.File object being passed as its parameter
An Array of objects created by invoking the provided function on each file which matched the provided pattern
A Jaxer.Exception object is thrown when the path is not a valid folder
Convert a native filesystem path to a URL format, which will begin with "file:...".
The full path to be converted
The URL, or null if the path could not be converted
The URL, or null if the path could not be converted
Resolves a path to an absolute path on the filesystem, using as a reference (base) the given path or the current page's path.
The path to resolve, e.g. a filename. It can also be a resource pattern (e.g. "resource:///...") or a file pattern (e.g. "file:///...")
An optional path to use as a reference. By default, it uses the current page's path.
The full path on the filesystem
Convert a URL in string format to a native filesystem path. The URL must begin with "file:..."
The URL to convert
The full path, or null if the URL could not be converted
The full path, or null if the URL could not be converted
This is a utility class that wraps XPCOM directory/folder utility functions
Directory Utility helper object
Returns an instance of DirUtils.
Return the path to the current folder the process is running from. Returns the deskTop Folder of the current user. Returns the home folder of the current user. Returns the Jaxer temp Folder.
Exception used by the Jaxer framework.
The exception used by the Jaxer framework. At runtime this is available from the window object
The descriptive text of the Exception to be thrown, or an Error-derived object
An optional reference to an instance of the framework logger to be used. A default setting is used if this parameter is omitted
An instance of Exception
Provides a string representation of the Exception description.
A description of the exception
Get verbose details on the error
The error object on which details are desired. An attempt is made to convert it into an Error-derived object before details are retrieved.
The detailed description
Returns a JavaScript Error (or Error-derived) object based on the given object
If this is already derived from an Error, it will just be returned. Otherwise it will be stringified and used as the description of the error.
The Error-derived representation
Utility object for simple filesystem access.
<pre> var p = '/tmp/foo.dat'; var f = new Jaxer.File(p); </pre>
Creates a new File handle for performing filesystem file operations.
an argument of string local file path
Returns an instance of File.
Throws a Exception containing the error code upon failure.
Checks 'end of file' status and returns boolean to indicate whether the end of file has been reached. This function takes no arguments but needs an open read mode filehandle. <pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); while(!f.EOF) dump("line: "+f.readline()+"\n"); </pre> Returns the extension of the file object <pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); alert(f.ext); </pre> outputs: dat Returns the current byte position in the referenced file. This method is only applicable when using the File.read() method. If used with the File.readline() method it will return the internal read ahead buffer position, which is unlikely to be what was expected. <pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); while(!f.EOF) { dump("pos: "+f.pos+"\n"); dump("line: "+f.readline()+"\n"); } </pre> Returns the size in bytes of the referenced file system object as reported by the OS. <pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.size; </pre> outputs: int 16
Return a new instance of a JSLib File object referencing the same path
A File object created from the path of the original file
Throws a Exception containing the error code.
Closes an open file stream, takes a single parameter Object which will be thrown as a Exception after the close and cleanup of the file stream.
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); f.close(); </pre>
the object to raise as an exception.
Copy to file to another location.
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.copy("/tmp/foo_copy.dat"); </pre>
the path to copy the file to.
Creates a new file under the referenced path of the object
Throws a Exception containing the error code.
Creates a new unique file under the referenced path of the object.
Throws a Exception containing the error code.
Opens the file for reading or writing. The provided file mode can be one or two characters the using 'rb','ab','wb' will cause the file to be opened in binary safe mode. NOTE: This implementation doesn't support file locking so will allow multiple open handles to the same file.
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); </pre>
an argument of string 'w', 'a', 'r', 'b'
a number containing the unix style chmod value for the permissions
Throws a Exception containing the error code.
Reads a file, if the file is binary it will return type ex: ELF takes no arguments but needs an open read mode filehandle returns data read from file as a string on success, or a null value on failure
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); myContent = f.read(); </pre>
the number of bytes to read from the file. If it is omitted the read will return the entire contents of the file.
<string contents of foo.dat>
Throws a Exception containing the error code.
Returns an array of individual lines read from the file on success, throws an Exception on failure
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); var lines = f.readAllLines(); </pre>
<string array of foo.dat>
Throws a Exception containing the error code.
Reads a single line from an open file, takes no arguments but needs an open read mode filehandle returns string containing the data read on success, null on failure
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open(); while(!f.EOF) dump("line: "+f.readline()+"\n"); </pre>
<string line of foo.dat>
Throws a Exception containing the error code.
Removes the referenced file object from the file system. Throws an exception is the action fails.
Throws a Exception containing the error code.
Truncates the file. Throws an exception if the action fails.
Throws a Exception containing the error code.
Write provided data to a file.
<pre> var p='/tmp/foo.dat'; var f=new Jaxer.File(p); f.open("w"); f.write("some data to be written"); </pre>
Buffer to be written to a file, if the file is Binary then the buffer should be an array.
Throws a Exception containing the error code.
Extracts the absolute path of the file referenced by the provided path
The full or partial (to be resolved) path of the file
The absolute path of the file referenced by the provided path
Add the provided text to the end of an existing file.
The full or partial (to be resolved) path to append to
The text to append
Add a line to the end of an existing file.
The full or partial (to be resolved) path to append to
The text to append, as a new line
Create a uniquely named backup copy of the file referenced by the provided path
The full or partial (to be resolved) path of the original file
The path to the backup copy of the file
return a crc32 checksum calculated from the file referenced by the provided path
The full or partial (to be resolved) path of the file
The checksum of the file referenced by the provided path
Get/Set the file permissions for the File object If the optional permissions parameter is provided chmod will set the permissions of the object to those provided. this may be ignored/misreported by some versions of windows. on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write
The full or partial (to be resolved) path of the original file
The file permissions to apply to the file referenced by the provided path, this number is an OCTAL representation of the permissions. to indicate a number is in octal format in javascript the first digit must be a 0
The file permissions from the file referenced by the provided path
Copies the file from sourcePath to destinationPath. If the destination file exists it will be overwritten.
The full or partial (to be resolved) path of the original file
The full or partial (to be resolved) path to the new file
Return the dateModified for the file referenced by the provided path
The full or partial (to be resolved) path of the file
The last modified date of file referenced by the provided path
Does the file (or folder) exist on disk?
The full or partial (to be resolved) path to test
true if exists, false otherwise
Return the file extension for the file referenced by the provided path
The full or partial (to be resolved) path of the file
The extension of the file referenced by the provided path
Extracts the filename for the file referenced by the provided path
The full or partial (to be resolved) of the path
The filename from the file referenced by the provided path
Get a file object, and if the object doesn't exist then automagically create it.
The full or partial (to be resolved) path to get or create
The file, possibly newly-created
Moves the file from sourcePath to destinationPath, the orginal file is deleted from the file system. If the destination file exists it will be overwritten.
The full or partial (to be resolved) path of the original file
The full or partial (to be resolved) path to the new file
Extracts the path of the containing folder for the file referenced by the provided path
The full or partial (to be resolved) path of the file
The path to the parent folder of file referenced by the provided path
Read the contents of a file on local disk. If the file does not exist, returns a null
The full or partial (to be resolved) path to read
The contents of the file as a string, or null if the file does not exist
The contents of the file as a string, or null if the file does not exist
Read the contents of a textfile on local disk, return an array of lines. When the optional sep parameter is not provided return a string with the lines concatenated by the provided parameter. If the file does not exist, returns a null
The full or partial (to be resolved) path to read
An optional separator to use between lines. If none is specified, returns an array of lines.
The contents of the file as a string or array of lines, or null if the file does not exist
The contents of the file as a string or array of lines, or null if the file does not exist
The contents of the file as a string or array of lines, or null if the file does not exist
Delete a file (only if it already exists).
The full or partial (to be resolved) path to delete
Returns the size of the file in bytes.
The full or partial (to be resolved) path to truncated
The size of the file in bytes
Creates a file if required, if the file already exists it will set the last modified timestamp to the current time.
The full or partial (to be resolved) path to touched
Truncates a file if the file already exists otherwise it will create an empty file.
The full or partial (to be resolved) path to truncated
Writes the provided text to file specified by the path. WARNING - destructive! This will overwrite an existing file so use File.append if you want to add the data to the end of an existing file.
The full or partial (to be resolved) path to read
The text to write to the file
This is a general class that wraps XPCOM filesystem functionality and from which File and Dir objects are derived.
A helper object for filesystem access
Returns an instance of FileUtils.
Throws a Exception containing the error code.
Changes the path of the filesystem object by appending the provided leaf value.
The leafname to be appended
The appended directory and leafname
Throws a Exception containing the error code.
Convert a chrome path to a filesystem path
chrome path
the chrome path as a filesystem path
Throws a Exception containing the error code.
Copies the source path to the destination path
path The source path
path The destination apth
Throws a Exception containing the error code.
Creates a file on the filesystem with the default permissions
a file system path
Throws a Exception containing the error code.
The last modified timestamp as reported by the OS
a date object representing the last modified timestamp of the file
Throws a Exception containing the error code.
A boolean indicator of whether the referenced object physically exists on the filesystem.
true if file exists otherwise false
Throws a Exception containing the error code.
Returns the extension of the file object
<pre> var p='/tmp/foo.dat'; var f=new File(p); alert(f.ext); </pre> outputs: dat
The path to the filesystem object
the file extension of the referenced filesytem object
Throws a Exception containing the error code.
Returns a boolean indicator that is true for a valid path and false otherwise
a file system path
true if valid path was requested
Throws a Exception containing the error code.
Returns the leaf (filename + extension) portion of the file path
filesystem path
The leaf name
Throws a Exception containing the error code.
Returns an nsIFIle object for the specified path
a file system path
nsIFile
Throws a Exception containing the error code.
Returns the path of the parent filesystem object
The path to the filesystem object
The path of the parent file system object
Convert a filesystem path to a file protocol URL
path
the filesystem path as a URL
Throws a Exception containing the error code.
Get the file permissions for the File object
the chmod style permissions of the file
Throws a Exception containing the error code.
Removes the referenced object physically from the filesystem.
Throws a Exception containing the error code.
Trys to execute the requested file as a separate *non-blocking* process. Passes the supplied *array* of arguments on the command line if the OS supports it.
a filesystem path
a set of arguments passed to the command to be run
the exit code of the process
Throws a Exception containing the error code.
Returns the size in bytes as reported by the OS
path The path to the filesystem object
the size of the file in bytes
Throws a Exception containing the error code.
Convert a file protocol URL to a filesystem path
URL
the URL as a filesystem path
Throws a Exception containing the error code.
This function will validate the numeric permissions value provided, if true the permissions value is valid, if false the value is invalid.
chmod style permission (0777,0622 etc)
indicates whether the permissions are valid
Throws a Exception containing the error code.
File System Object contains methods useful for accessing the basic file and directory objects.
File System Object. This object is used as a functional wrapper to the file system. It can represent, folders, files, symlinks
The path to the filesystem object
Returns an instance of Filesystem.
The last modified timestamp as reported by the OS. A boolean indicator of whether the referenced object physically exists on the filesystem. A boolean indicator of whether the referenced object is a folder/directory A boolean indicator of whether the referenced object is an executable A boolean indicator of whether the referenced object is a file A boolean indicator of whether the referenced object is a folder/directory an alias of as isDir A boolean indicator of whether the referenced object is hidden A boolean indicator of whether the referenced object is readable A boolean indicator of whether the referenced object is special. NOTE: Not implemented on Mac and possibly other systems. A boolean indicator of whether the referenced object is a symlink A boolean indicator of whether the referenced object is writable Get/Set the leaf (filename + extension) portion of the file path. Returns a clone of the underlying nsIFile object. Returns the path of the refererenced filesystem object. Get/Set the file permissions for the File object. this may be ignored/misreported by some versions of windows. on Windows, you can only set the Read/Write bits of a file. And User/Group/Other will have the SAME settings based on the most-relaxed setting (Read 04, 040, 0400, Write 02, 020, 0200). When a file is created, by default it has both Read and Write permissions. Also, you cannot set the file permission to WRITE-ONLY, doing so would set it to read-write Return the path of the referenced object as a file URL
Changes the path of the filesystem object by appending the provided leaf value.
The leafname to be appended
The appended directory and leafname
Throws a Exception containing the error code.
This method is used for appending a relative path to the current filesystem object
path
Throws a Exception containing the error code.
Evaluates whether the current filesystem object refers to the same file as the one provided as a parameter
file system object to be compared
true if object refers to same filesystem object, false otherwise
Throws a Exception containing the error code.
This method will initialize the file system object with the provided path information (or will attempt to derive the path if an object is provided). An existing File object can be 'repointed' to a new physical file sytem object by invoking this method.
set of arguments
the file extension of the referenced filesystem object
Throws a Exception containing the error code.
Move the referenced file to a new filesystem location provided as a parameter NOTE: after a move, 'this' will be reinitialized to reference the moved file!
path
Throws a Exception containing the error code.
As of Mozilla 1.7, the underlying XPCOM method is only implemented under UNIX builds (except for Mac OSX). This method will fail if the path does not exist.
Throws a Exception containing the error code.
Truncates the file referenced by the filesystem object.
true indicates success
Throws a Exception containing the error code.
Encapsulates function information needed for generating client-side proxies and for server-side storage of functions used in callbacks.
This class encapsulates function information needed for generating client-side proxies and for server-side storage of functions used in callbacks.
This parameter is the name of the function this info represents.
This parameter is an array of parameter names for the function this info represents.
This parameter is the actual source code of the function this info represents.
Returns an instance of FunctionInfo.
This class encapsulates function information needed for generating client-side proxies and for server-side storage of functions used in callbacks.<br><br>(Advanced)
This is a reference to the actual Javascript function instance this info represents.
This is an optional parameter that is the root node of an AST representing the function this info represents.
Returns an instance of FunctionInfo.
Create a string representation of the underlying function to be used client-side as the source of this function.<br><br>(Advanced)
Returns a string representation of this function info's underlying Javascript function in a form needed to execute the function on the client
Create a string representation of the underlying function to be used during a callback. This source will be stored in the callback database and will be used to reconstitute the function during a callback. This is used for cached and proxied functions.<br><br>(Advanced)
If specified, the function is specified as a property on the given namespace object. Otherwise, the function is specified as a global property.
If specified and true, the function will have a property called "proxy" and set to true.
If specified and true, the function will NOT be assigned to a global property with its name. That is, this.<name> will NOT be created.
Returns a string representation of this function info's underlying Javascript function in a form needed to execute the function on the server.
Is the underlying function a native one (for which no actual source is available)?<br><br>(Advanced)
Namespace object holding functions and members used to get and include HTML and JavaScript from external sources.
Compile the given JavaScript string in the given global context<br><br>(Advanced)
The string of script code to compile
An optional global context (usually a window object) in which to compile it
An optional parameter to indicate (e.g. in error messages) the effective URL from which this code originates.
The compiled bytecode, as a string.
Evaluate the given JavaScript bytecode string in the given global context<br><br>(Advanced)
The string of script code to evaluate
An optional global context (usually a window object) in which to evaluate it
The result of the last JavaScript expression evaluated.
Evaluate the given JavaScript string in the given global context<br><br>(Advanced)
The string of script code to evaluate
An optional global context (usually a window object) in which to evaluate it
An optional parameter to indicate (e.g. in error messages) the effective URL from which this code originates.
The result of the last JavaScript expression evaluated.
Loads and evaluates a JavaScript file on the given global execution object with the given runat attribute.
The URL from which the JavaScript file should be retrieved. If the src is an absolute file://... URL then it is retrieved directly from the file system, otherwise it is retrieved via a web request.
The global (usually a window object) on which to evaluate it. By default, it is the same global as the one in which the calling function is executing.
The value of the effective runat "attribute" to use when evaluating this code. By default, it uses the same runat attribute as the last evaluated script block.
If true, the file is loaded from a cached compiled version if available, and if not available the file's contents are fetched, compiled and cached. By default this is false.
If true, force loading from src even if found in cache. The loaded contents will then be cached. By default this is false.
If true, any functions created in this script block will not have a runat property set on them, not even the default runat of the last script block. By default this is false.
The result of the last JavaScript expression evaluated, if any.
Log is a static object meant to be shared across the framework and perhaps even the user's code. In a module, use it to create a module-specific logger and then log with it.
Add an appender to the referenced Log object<br><br>(Advanced)
The name of the appender
An instance of the appender. It should be derived from Jaxer.Log.Appender.
Get an appender reference from the referenced Log object<br><br>(Advanced)
The name of the appender to look for
The appender instance
Return a array of implemented Logger levelnames e.g. "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"<br><br>(Advanced)
Gets a sorted array of all the currently-defined modules.<br><br>(Advanced)
An array of strings, sorted alphabetically, of the names of modules for which ModuleLoggers have been defined.
Remove the specified appender from the referenced Log object<br><br>(Advanced)
The name of the appender to use.
Logs a message at the "DEBUG" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.DEBUG. This is the second-most verbose level - instrument your code with debug() calls in those places where debugging is likely to benefit from them.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "ERROR" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.ERROR. Use this to log non-fatal but nonetheless real errors.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "FATAL" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.FATAL. Use this to log the most serious errors.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Lazily creates a logger for the given module name, if needed, and in any case returns it. The referenced Log object knows to create log entries marked as belonging to the specific module.
The name of the module (just an identifier string).
The module-specific logger to use for log entries.
Get the logging level of the generic logger
The level below which non-module-specific messages will not be logged
Get the current JavaScript stack trace.
An optional prefix (e.g. whitespace for indentation) to prepend to every line of the stack trace
An optional number of frames to skip before starting to trace the remaining frames
The stack trace as a string consisting of a number of lines, starting at the deepest frame
Returns a boolean to indicate whether the referenced Log object is wired to do logging for the provided modulename
The name of the module to look up
Logs a message at the "INFO" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.INFO. By default, modules are set to show messages at this level, so use info() when you want to show log messages without needing to set the level to more verbose than usual, but don't keep info() messages in your code long term.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Set the logging level on ALL modules to level provided for the referenced Log object
The new level to use for all of them
Set the logging level for the generic logger (the one that's not module- specific)
The level to use on the generic logger messages below this level will not be logged.
Logs a message at the "TRACE" level. The message will only be appended to the log if the level for that module (and that appender) is set at Jaxer.Log.TRACE. This is the most verbose level - instrument your code liberally with trace() calls to be able to pinpoint any issues.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "WARN" level. The message will only be appended to the log if the level for that module (and that appender) is set at or below Jaxer.Log.WARN. Use this to warn of any unusual or unexpected, but not necessarily erroneous, conditions.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Base class of all Appenders: listeners that know how to append log messages somewhere, e.g. to a file or a database.
This is the base class of all Appenders: listeners that know how to append log messages somewhere, e.g. to a file or a database.<br><br>(Advanced)
The name to use to identify this appender
The level to start this appender at -- messages below this will not be appended
Returns an instance of Appender.
The level to which this appender is set. Messages below this level will not be logged.<br><br>(Advanced)
The current level
Sets the level below which this appender will not log messages.<br><br>(Advanced)
The minimum loggable level. Should be one of Log.TRACE, Log.DEBUG, Log.INFO, Log.WARN, Log.ERROR, Log.FATAL.
Identifies this appender instance by name<br><br>(Advanced)
The appender's name
Appends log messages to the same file as the Jaxer core.
Create an instance of the Core appender -- appends log messages to the same file as the Jaxer core<br><br>(Advanced)
The name to use to identify this appender
The level to start this appender at -- messages below this will not be appended
The hashtable of core trace methods that this should invoke
The core function to call before calling any core method -- it will turn on logging regardless of the core's settings
The core function to call after calling any core method -- it will restore using the core's log settings
Returns an instance of CoreAppender.
File-based Log Appender.
Create an instance of the FileAppender, a file-based Appender<br><br>(Advanced)
The appender name
The logging level to start using with this appender
The path to the logfile
Returns an instance of FileAppender.
Appends the provided message to the referenced appenders log<br><br>(Advanced)
The name of the module to use
The level to use for this message
The message to log
An optional exception object to use
Set the path for the filesystem logging target<br><br>(Advanced)
The new path to use for this appender.
Logging level object used by the Logging facility to set or determine the current log levels.
The constructor of a logging level object.Messages must exceed a certain severity level before they are logged.
The name of the level
The numeric value to associate with this level. Higher numbers are more severe.
Returns an instance of Level.
A common comparison operator on Jaxer.Log.Level objects: is the current level at or above the given level?
true if matches or exceeds the given level
A common comparison operator on Jaxer.Log.Level objects: is the current level at or below the given level?
true if matches or falls below the given level
A common comparison operator on Jaxer.Log.Level objects: is the current level below the given level?
true if falls below the given level
The textual representation of a level, namely its name
The name
Object created by the global Log.forModule("...") method for module-specific logging.
An object that's created only through the global Log.forModule("...") method for module-specific logging. Usually you create such a logger at the beginning of your module, and then use it throughout your module for logging at various levels. It has its own level, so you can control the verbosity of logging per module.
The name to use for the module
log level for the module
Returns an instance of ModuleLogger.
Logs a message at the "DEBUG" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at or below Jaxer.Log.DEBUG. This is the second-most verbose level - instrument your code with debug() calls in those places where debugging is likely to benefit from them.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "ERROR" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at or below Jaxer.Log.ERROR. Use this to log non-fatal but nonetheless real errors.
Tthe message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "FATAL" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at or below Jaxer.Log.FATAL. Use this to log the most serious errors.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Gets the level to which this ModuleLogger is set -- appending messages below this level will do nothing
The current level
Logs a message at the "INFO" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at or below Jaxer.Log.INFO. By default, modules are set to show messages at this level, so use info() when you want to show log messages without needing to set the level to more verbose than usual, but don't keep info() messages in your code long term.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Sets the level below which this moduleLogger will not log messages.
The minimum loggable level. Should be one of Jaxer.Log.TRACE, Jaxer.Log.DEBUG, Jaxer.Log.INFO, Jaxer.Log.WARN, Jaxer.Log.ERROR, Jaxer.Log.FATAL.
Logs a message at the "TRACE" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at Jaxer.Log.TRACE. This is the most verbose level - instrument your code liberally with trace() calls to be able to pinpoint any issues.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
Logs a message at the "WARN" level for this module. The message will only be appended to the log if the level for this module (and that appender) is set at or below Jaxer.Log.WARN. Use this to warn of any unusual or unexpected, but not necessarily erroneous, conditions.
The message to append to the log. The timestamp, modulename, and terminating newline will be added automatically.
An optional error or exception to be logged with this message
An optional indication of which function this message should appear to originate from. By default, it's the function that called this logging method.
This is a utility class that wraps XPCOM Network utility functions
Network Utility helper object
Invokes the XPCOM nsIURIFixup method and return a 'fixed' URI
The URI to process
The fixed URI as a string
A stub function to be overridden
request object
the contextual object for this request
Invokes the callback function for completed requests
the request object
the current context of the request context
the current status of the request object
Returns a QueryInterface for the provided XPCOM Interface ID
the requested XPCOM Interface ID
Validates the provided URI using XPCOM and returns JSLib.Ok if successful
The URI to validate
Namespace used for overriding some of the built-in JavaScript and JavaScript-environment (user-agent) functions that may not make sense or need to behave differently on the server.
Applies all the overrides on the given global object, including the no-ops "setTimeout" and "setInterval"<br><br>(Advanced)
The global (typically window) object
Alters the built-in setter methods for various DOM FORM element prototypes to alter the DOM as well as set the value of the associated in-memory property. E.g., normally when you set the value of an input element, the "value" attribute of the element in the DOM isn't altered. After running the function below, the "value" attribute on any input element will stay in sync with its in-memory value, so it will get serialized with the rest of the DOM when we're ready to send the DOM to the browser.<br><br>(Advanced)
The global object (usually a window object) whose prototype setters are to be overridden.
Alert in a server-side context will generate an info-level log message
Confirm in a server-side context will generate an info-level log message
Prompt in a server-side context will generate an info-level log message
Used to execute operating system processes
The constructor for an object that wraps an operating system process. This also provides static functions for more easily executing operating system processes.
The absolute path to the executable file to execute. This must be specified before execution begins.
By default, the process executes synchronously: it blocks until complete. If async is true, it will execute asynchronously, not blocking before completion. This can be specified at any time until execution begins.
The wrapper around the operating system process
The internal process handle<br><br>(Advanced) The internal status (state) of the process: one of Jaxer.Process.CREATED, Jaxer.Process.EXEC_BEGUN, Jaxer.Process.WRITE_ENED, and Jaxer.Process.EXEC_ENDED.<br><br>(Advanced) The size in bytes of the buffer to use when reading from STDOUT and STDERR. By default this is 1024 bytes.<br><br>(Advanced) The array of arguments to this process. If true, the process will be executed asynchronously (without blocking) Whether to detach the process (if it's asynchronous) after any writing to STDIN is complete. This is true by default Note that this property is only used by methods like exec and execAsync; you can always just explicitly detach by calling endExec. The exit status (i.e. return code) of the process, if any. For an async process this is null. The absolute path to the executable file to execute How to handle the standard error stream (STDERR) from the process. If this is a string, it read from STDERR as a character stream; otherwise no reading from STDERR is performed. Note that this property is only used by methods like exec and execAsync; you can always just explicitly read from STDERR using readErrString. How to handle the standard input stream (STDIN) to the process. If this is a string, it is written to STDIN as a character stream; if this is an array, it is written to STDIN as a binary (byte array) stream; otherwise no writing to STDIN is performed. Note that this property is only used by methods like exec and execAsync; you can always just explicitly write to STDIN using writeString or writeBinary. How to handle the standard output stream (STDOUT) from the process. If this is a string, it read from STDOUT as a character stream; if this is an array, it is read from STDOUT as a binary (byte array) stream; otherwise no reading from STDOUT is performed. Note that this property is only used by methods like exec and execAsync; you can always just explicitly read from STDOUT using readString or readBinary. The internal status indicating the process wrapper has been created but no execution has begun The internal status indicating the process has begun executing, but any writing to STDIN is not necessarily finished The internal status indicating the process has finished executing or has been detached (if async) The internal status indicating the process has begun executing and any writing to STDIN is finished
Begins execution of the process. Any arguments to this method are treated as arguments to the process; if no arguments are given, and this.args has been set, it will be used instead. You can start to write to STDIN and read from STDOUT and STDERR after you call this method.
Completes the execution of the process (if synchronous) or detaches it (if asynchronous). A running process may be stopped via kill() anytime before endExec() is called.
If the process is synchronous, its exit status (i.e. return code) is returned.
Closes STDIN for further writing, which may be needed by the process before it can proceed. This is automatically called by reading anything from STDOUT and STDERR and by endExec.
Executes the process. The path to the executable file should already have been set when creating the Process or via the path property. The arguments to this method are used as the arguments to the process. By default, the process is executed synchronously (i.e. it blocks), and nothing is written to STDIN nor read from STDOUT or STDERR. To override these defaults, set any of the following properties before calling this: async, stdin, stdout, stderr, and autoDetachIfAsync. If any of these are set they will be used; for stdout and stderr they will be used only if the process is synchronous, in which case they'll be set to STDOUT/STDERR. If the process is asycnhronous and autoDetachIfAsync is false, it will not be detached until it falls out of scope, so you can still read STDOUT or STDERR and kill it until it falls out of scope, at which point it will be detached; otherwise it will be detached immediately (or after any STDIN is written).
If the process is synchronous, its exit status (i.e. return code) is returned.
Executes the process asynchronously (i.e. without blocking). The path to the executable file should already have been set when creating the Process or via the path property. The arguments to this method are used as the arguments to the process. By default, nothing is written to STDIN, and the process is immediately detached after it is launched. To override these defaults, set stdin and/or autoDetachIfAsync on the process before calling this. If stdin is set, it will be used. If autoDetachIfAsync is not set (or set to the default value of true), the process will be detached immediately after any STDIN is written. If autoDetachIfAsync is set to false, the process will not be detached, so you can still read STDOUT or STDERR and kill it until it falls out of scope, at which point it will be detached.
Kills a running process. This can only be called before endExec() has been called.
Reads the process's STDOUT stream as a byte array.
If specified, limits reading of STDOUT to maxLength bytes
The binary value of STDOUT as an array of integers
Reads the process's STDERR stream as a character string.
If specified, limits reading of STDERR to maxLength characters
The string value of STDERR
Reads the process's STDOUT stream as a character string.
If specified, limits reading of STDOUT to maxLength characters
The string value of STDOUT
Writes the given byte array as a binary stream to the process's STDIN
The byte array (array of integers)
Writes the given string as a character stream to the process's STDIN.
The string to write
Executes the process specified by the given absolute path. Any remaining arguments to this function are used as the arguments to the process, except possibly for the last argument if it is an object, in which case it's removed and used to set options. By default, the process is executed synchronously (i.e. it blocks), and nothing is written to STDIN. To override these defaults, pass as a final argument an object containing the properties to be overridden: async, stdin, stdout, stderr, autoDetachIfAsync. If any of these are set they will be used; for stdout and stderr they will be used only if the process is synchronous, in which case their values in your object will be set to STDOUT/STDERR. For a synchronous process, the return value will be the STDOUT of the process, unless you specify stdout in your options object, in which case the return value is the exitStatus; and unless you specify stderr, an error will be thrown if the process's exitStatus is non-zero or if it writes to STDERR. If the process is executed asynchronously and autoDetachIfAsync is false, it will not be detached until it falls out of scope; otherwise it will be detached immediately (or after any STDIN is written).
<pre> document.write("The folder contains:\n" + Jaxer.Process.exec("/bin/ls")); var opts = { stdin : 'Hello world', stdout: '', stderr: ''}; var exitStatus = Jaxer.Process.exec("/bin/cat", "-", opts); document.write("Finished /bin/cat with status " + exitStatus + ": opts = " + uneval(opts)); </pre>
The absolute path of the executable file to execute
For a synchronous process (without having a stdout property in an options object), returns the STDOUT of the process; otherwise does not return anything.
Asynchronously executes the process specified by the given absolute path (so it does not block). Any remaining arguments to this function are used as the arguments to the process, except possibly for the last argument if it is an object, in which case it's removed and used to set options. By default, nothing is written to STDIN nor read from STDOUT or STDERR, and the process is immediately detached after it is launched. To override these defaults, pass as a final argument an object containing the properties to be overridden: stdin and/or autoDetachIfAsync. If stdin is set, it will be used. If autoDetachIfAsync is not set (or set to the default value of true), the process will be detached immediately after any STDIN is written. If autoDetachIfAsync is set to false, the process will not be detached until it falls out of scope, at which point it will be detached.
<pre> Jaxer.Process.execAsync("/bin/sleep", 1, { autoDetachIfAsync : false } ); var opts = { stdout : ''}; Jaxer.Process.exec('/bin/ps', '-ax', opts); print("Sleep is running? " + (Jaxer.Util.String.grep(opts.stdout, "/bin/sleep").length > 0)); Jaxer.Util.sleep(2000); Jaxer.Process.exec('/bin/ps', '-ax', opts); print("Sleep is running? " + (Jaxer.Util.String.grep(opts.stdout, "/bin/sleep").length > 0)); </pre>
The absolute path of the executable file to execute
An instance of this object has the lifecycle of the current request and contains information about it.
An instance of this object has the lifecycle of the current request and contains information about it.
The core event whose data is used to initialize this Request object instance
Returns an instance of Request.
A string used to identify what application the current request is asking for<br><br>(Advanced) A string used to identify what page in the application the current request is asking for<br><br>(Advanced) The Jaxer.App object constructed by searching in configApps.js for an object that matches the current request's parsedUrl and using it to set application-specific settings (such as the database connection to use) during this request Holds the parsed URL information of the current page, which on a callback is different from the original page. The folder (directory) on disk holding the file (pageFile) being served in this request. This is '' if there is no pageFile information, e.g. if the web server is on a different filesystem than Jaxer. An object holding the name=value pairs of the current request's body (assumed to be of type application/x-www-form-urlencoded) as properties The location on disk of the top folder from which all web pages are served by the web server, as an absolute URL (without the preceding file://). This is usually only meaningful if the web server is on the same filesystem as Jaxer. A collection of the environment variables received from the web server for this request, as properties on this simple JavaScript object. If multiple variables had the same name, their values are given as an array. An array of Jaxer.Request.FileInfo objects describing any uploaded files. You must call save(newFileName) on each of these if you'd like to save them, otherwise they will be purged at the end of the request. A collection of the HTTP headers received from the web server for this request, as properties on this simple JavaScript object. If multiple headers had the same name, their values are given as an array. True if Jaxer is the main "handler" for the current request, rather than is filtering a page served by a different handler. Currently, Jaxes is only a handler for callback requests. Whether the current page is being requested and served over the HTTPS protocol. The type of HTTP request this is: usually "GET" or "POST". The location on disk of the current page's file, served by the web server, as an absolute URL (without the preceding file://). This is usually only meaningful if the web server is on the same filesystem as Jaxer. True if the entire body (for a POST) request is to be considered as the single data parameter of this request. Holds the parsed URL information of the true page: this is the current URL for a regularly-served page, but for a callback this is the URL of the original page (now the Referer) that requested the callback. The body of the HTTP request, which usually contains the data during a POST request, and is often of type "application/x-www-form-urlencoded" (i.e. "name1=value1&name2=value2&..."). The protocol declared in the HTTP request, e.g. "HTTP/1.1". The query part of the current request's URL, after the "?". This is also available as Jaxer.request.parsedUrl.query and is parsed into the JavaScript object Jaxer.request.parsedUrl.queryParts. The value of the Referer HTTP header for this request, which should indicate the complete URL of the page that made this request. If this is a callback, the referer is taken from the "callingPage" parameter of the request, only using the Referer header if for some reason "callingPage" is not available. The Internet Protocol (IP) address of the client (browser) that sent the request. The name of the client (browser) that sent the request, or the IP address of the client if the name cannot be determined. If the browser making the request submitted HTTP authentication credentials, this is the username submitted. Otherwise it is the empty string. The URL (and URI) of the current request.
Low-level method to compile a string of JavaScript source code in a given global context and with a certain effectiveUrl as its "file".
The string of script code to evaluate
An optional global context (usually a window object) in which to evaluate it
An optional parameter to indicate (e.g. in error messages) the effective URL from which this code originates.
The compiled code
Low-level method to evaluate a string of compiled JavaScript code in a given global context.
The bytecode string of script code to evaluate
An optional global context (usually a window object) in which to evaluate it
The result of the evaluation, if any
Low-level method to evaluate a string of JavaScript source code in a given global context and with a certain effectiveUrl as its "file".
The string of script code to evaluate
An optional global context (usually a window object) in which to evaluate it
An optional parameter to indicate (e.g. in error messages) the effective URL from which this code originates.
The result of the evaluation, if any
Container for information about uploaded files.
A container for information about uploaded files. The constructor is not meant to be called directly.<br><br>(Advanced)
The Jaxer Core's request object
An index into the list of uploaded files
Returns an instance of FileInfo.
The name under which the file was temporarily saved<br><br>(Advanced) The content type of this file, as reported by the web server The name of the field as specified in the HTML form The original name of the file that was actually uploaded from the user's filesystem The size of the file contents, in bytes An index into the list of uploaded files The original name of the file that was actually uploaded from the user's filesystem
Save the uploaded file to the given path -- otherwise it will be automatically purged after this request
The name (or full path) of the file to which the uploaded file should be saved.
Current response and its associated information.
An instance of this object has the lifecycle of the current response and contains information about it.
The Jaxer Core event whose data is used to initialize this Response object instance and to output to the client
Returns an instance of Response.
A collection of the HTTP response headers that will be returned to the browser, as properties on this simple JavaScript object. If multiple headers have the same name, their values are given as an array. NOTE: some headers are set by the web server after Jaxer is done, and they will not appear here.
This will be true when the document processing has been exited before reaching the end of the document, via the exit() method or another method such as redirect() which uses exit() internally. When that happens, some post-processing steps such as callback proxying will be omitted.<br><br>(Advanced)
Gets the contents (body) of the response. For regular page requests, this will return null unless setContents has been called, in which case it will return the value set by the last call to setContents. For callbacks, this should only be called at the very end of callback processing, when the contents have been explicitly set by the Jaxer framework using the setContents method.<br><br>(Advanced)
The explicitly-set contents at this time, or null if no explicit contents have been set (so the DOM will be serialized if this is a regular page request).
Has the DOM possibly been modified in any way?<br><br>(Advanced)
true if it has (or might have), false if it could not have been
Has there been any possible side effect (e.g. database accessed, etc.)?<br><br>(Advanced)
true if there has been (or might have been), false if there could not have been
Remembers that the DOM has been altered in some way, which ensures that the final response will be the Jaxer-produced one rather than the original document Jaxer received.<br><br>(Advanced)
Remembers that processing this page has had some side effect, which ensures that the final response will be treated as having been processed by Jaxer, whether or not its contents have been modified.<br><br>(Advanced)
Once this is called, the contents of the response will be the same as the contents that Jaxer received in this request, i.e. all DOM changes will be discarded. This is ONLY effective for regular requests, not callbacks.<br><br>(Advanced)
Adds an HTTP header to the response. If an existing header with this name exists, this value will be appended -- if you don't want that, just set Jaxer.response.headers [ name ] = value
The name of the HTTP header
The value to use
Stops processing the current request's HTML page and JavaScript, and returns this response to the browser via the web server.
The HTTP status code to return to the browser: by default it is 200.
The contents to use for the body of the response. If this is null or undefined, and setContents has not been called on this response, the current DOM will be serialized and returned as the response contents. If this is an XMLDocument or an E4X XML object, its string representation will be used, and a Content-Type header of "application/xml" will be returned (unless a Content-Type header was already specified in this response)
The text description (e.g. "OK") of the status code. For all the standard status codes this is optional, as the standard description for the status code will be used by default.
If Jaxer.Config.EXPOSE_JAXER, this sets an "X-Powered-By" header on the response indicating that Jaxer processing has occurred and noting the build number.
Gets the error, if any, of which the framework has been notified during the handling of this request and generation of this response.
Gets the parameters of the alternate client framework that will be injected into this response, if the default client framework has been overridden using setClientFramework().
A JavaScript object with properties isSrc (Boolean indicating whether the value is the src or the contents of the script block to be injected) and value (the src or the contents).
Has the framework been notified of an error during the handling of this request and generation of this response?
True if an error was submitted.
Checks whether the client framework has been overridden for this response, i.e. whether setClientFramework has been called.
true if the client framework is overridden, false otherwise
Notifies the framework that an error has occurred during the handling of this request and generation of this response. How this is handled is then determined by the Jaxer.Config settings.
The error describing what happened. If the framework has already been notified of an error during the current request, this newError is not used.
If this evaluates to true, an error message will not be logged during this call. Note that if an error message has been logged already in this request, another message will not be logged in any case.
Notifies the framework that an error has already been reported in the output page so it need not be reported in the output page again.
Stops processing the current request's HTML page and JavaScript, and returns a redirect-type HTTP response to the browser. No contents (response body) are returned to the browser, and the DOM is not serialized.
The URL to which the browser should redirect the request. This is mandatory unless the Location header has already been set for this response.
The HTTP status code to return to the browser: by default it is 307 (temporary redirect).
The text description of the status code. For all the standard status codes this is optional, as the standard description for the status code will be used by default.
Removes an HTTP header with a specific value from the response. If there is no such name-value pair, it does nothing. If an existing header with this name exists and has multiple values, this value will be removed -- if you don't want that, just delete Jaxer.response.headers [ name ]
The name of the HTTP header
The value to remove
Restores the use of the default client framework (using the Jaxer.Config settings), undoing any previous calls to setClientFramework().
Overrides the automatic injection of the client framework into the response page. If neither src nor contents are given, then NO client framework is injected into the page. Make sure you do not rely (implicitly or explicitly) on the presence of the default Jaxer client framework if you call this method!
The url of the alternate client framework to use, if any. If this src argument is given, any contents argument will not be used.
The contents of the script block to use as an alternate client framework. If a src argument is specified, the contents argument will not be used.
Sets the contents (body) of the response. Once the response's contents are set this way, the DOM is no longer serialized into the response contents at the end of page processing.
The new contents to use.
Sets headers on this response to mark it as a dynamic one and avoid its being cached. This will always be called by the framework during callback processing. For regular (non-callback) requests, this will only be called by the framework if the DOM has been changed or a side-effect has (or could have) occurred during the processing of this request and the generation of the response.
Returns the standard W3C reason phrase for the given standard status code. For example, passing in 200 returns "OK", and passing in 404 returns "Not Found".
The status code, as an integer (or a string that can be parsed to an integer). If this is not a recognized status code, "Unknown Status Code" is returned.
True if an error has already been reported in the output page so it need not be reported in the output page again.
True if notifyErrorShown() was called in this response, false otherwise.
A namespace object holding functions and members used for sending emails via SMTP (Simple Mail Transfer Protocol).
Sends an email via SMTP
The host to connect to
The port to connect on
The address this message is coming from
The address this message is going to
The subject of the message
The body of the message
Sends an email message object via SMTP
The host to connect to
The port to connect on
The Jaxer.SMTP.MailMessage object to send
A structure holding email message information.
A structure holding email message information
Returns an instance of MailMessage.
Adds a recipient to the message
The email address
Sets the body (contents) of the message
The text of the message
Sets the timestamp on the message
The date it's sent
Sets the "From" address on the message
The email address from which this message is coming
Sets the "Subject" of the message
The subject text
The Class describing a Sandbox: a container that can load a server-side window with its own DOM, and executes JavaScript server-side, but is more protected than the regular Jaxer server-side window.
The constructor of a Sandbox: a container that can load a server-side window with its own DOM, and executes JavaScript server-side, but is more protected than the regular Jaxer server-side window.
The url to load. If no url is give, nothing is loaded -- you can later use the load method to load it.
To GET a page from the url, leave this parameter undefined or pass in null. To POST to the url, set this parameter to the data to be POSTed. It may be a string (usually of the form name1=value&name2=value), or an object whose name->value property pairs will be used to construct such a string.
A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.
Returns an instance of Jaxer.Sandbox
Returns the DOM document that's been loaded into this sandbox's window, or null if a url has not been loaded yet. Returns the window that's been loaded into this sandbox, or null if a url has not been loaded yet. The default OpenOptions which new calls to new Jaxer.Sandbox() or Jaxer.Web.load() will use, unless overridden by the options argument.
Closes the Sandbox's window, which terminates any async loading and removes the window and its document. This call is usually optional, since the window and its document are automatically removed at the end of the Jaxer request, and they are safely reused if you open (load) the same Sandbox more than once. It's therefore mostly useful for stopping open async requests.
Opens the sandbox's window and document by creating them (if needed) and then loading a url into them, via a GET or POST request. You usually do not need to explicitly close() this, except to cancel async requests.
The url to load from
To GET a page from the url, leave this parameter undefined or pass in null. To POST to the url, set this parameter to the data to be POSTed. It may be a string (usually of the form name1=value&name2=value), or an object whose name->value property pairs will be used to construct such a string.
A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.
Loads the sandbox's window and document from a string by creating them (if needed) and then loading the string into them. You do not need to explicitly close() this.
The contents to load into the window, usually HTML
A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.
Options used to define the behavior of Jaxer.Sandbox opening.
Options used to define the behavior of Jaxer.Sandbox loading. Create a new Jaxer.Sandbox loading() to get the default options, then modify its properties as needed before passing it to new Jaxer.Sandbox() or to load() on an instance of Jaxer.Sandbox.
Returns an instance of OpenOptions.
Whether to allow (server-side) execution of JavaScript, if any, within the loaded page. By default, this is true. This applies to JavaScript in the page inside this Sandbox instance, not the JavaScript of the loading page. Note that the JavaScript inside this Sandbox instance in any case does not have access to the Jaxer framework, and is running without the usual Jaxer server-side privileges. Whether to allow refresh-based redirects within the loaded page. By default, this is true; Whether to allow the loaded page to itself load frames or iframes. By default, this is true. Set to true for asynchronous, false for synchronous (default). To use it asynchronously, see also Jaxer.Thread.waitFor. Add name-value pairs to this object to set headers on the http request. Both the name and the value should be strings. For POST requests, a 'Content-Type' header with value "application/x-www-form-urlencoded" will be added automatically unless you specify a different one, and a 'Content-Length' header with the appropriate value will also be set. The value of this, if any, will be used as the Sandbox's onload handler. The onload handler will be called after the page is loaded, and after the page's own onload is invoked, if any. It's particularly useful when the page is loaded asynchronously, in which case it may be used in conjuction with Jaxer.Thread.waitFor.
Container object used during runat attribute and property processing.
This is a container object used during runat attribute and property processing. This allows all runat-related state to be passed around in one simple container object. At the same time, this formalizes what is being passed around which is preferable to using a simple anonymous object.<br><br>(Advanced)
Returns an instance of ScriptInfo.
This class processes script elements to determine which of its functions fall into the various runat categories.
This class processes script elements to determine which of its functions fall into the various runat categories. This class collects each function into its appropriate category and provides convenience functions to generate the necessary source code for this block needed for both client-side and server-side use.<br><br>(Advanced)
The underlying script element to be processed by this class
If a non-null object, its properties are the function names that should be proxied even if not explicitly marked as such. If null, no functions should be proxied.
Returns an instance of ScriptProcessor.
The default value to use when creating new Jaxer.XHR.SendOptions() objects, in milliseconds. It's only used for async requests. It defaults to 30 seconds (30000) on the server, and 0 on the client. 0 means no timeout. NOTE: To set the the default timeout to use when creating new XHR()s (i.e. XMLHttpRequests), set Jaxer.XHR.defaults.timeout instead.
This is the namespace that contains Jaxer serialization methods. The Jaxer serializer uses the familiar and popular JSON format. However, additional functionality has been provided to allow for serialization of more complex data structures. Specifically, this module supports cyclical data structures, multiple references, and custom serializers. Each of these is described below. Cyclical data structures occur when an object (or array) contains a descendent structure that also references that same object. For example, a DOM node has references to its children and these children also have references to the DOM node (their parentNode). In a traditional JSON environment, if you were to try to serialize this structure, you would end up in an infinite loop as the serializer traversed the parent node, its child nodes, and then back up to the parent node through the child's parentNode property. Indeed, the serializer couldn't get past the first child in this scenario. The Jaxer serializer gets around this via specially formatted strings referred to as "references". Multiple references are similar to cyclical data structures in that an object is referenced two or more times. However, this does not necessarily create a cycle. For example, say you have the following code: <pre>var car = { color: "blue", price: 10000 }; var cars = [ car, car ] ;</pre> As you can see, the same car object has been referenced twice in the array. In a traditional JSON serializer, each instance of car would be serialized separately. Unfortunately, that alters the data structure that will be accessed after deserialization. You will end up with two independent car objects which means that changing the price of one will not change the price of the other as would have happened before the serialization/deserialization cycle. In order to restore the same references, Jaxer serializes the car only once and then leaves placeholders to point to that single serialization instance. During deserialization, the placeholders are replaced with references to the deserialized object, thus restoring the original data structure. Some data types cannot be expressed in JSON. For example, the Date type is not listed as a valid type in JSON. So, in order to support this type and potentially many others, the serializer allows the developer to register custom serializers and associated deserializers for a given type. When the serializer sees these types, the custom handlers are used to convert the item to a string. It is then the responsibility of the custom deserializer to restore the item to its original structure, as appropriate. For example, Jaxer supports XMLDocuments. The custom serializer creates an XML string which is specially tagged so the deserializer can restore the XML string back to an XMLDocument. Next, we briefly discuss how Jaxer recognizes cycles, multi-references, and how it represents references and custom serialized objects. The Jaxer serializer makes an initial pass over the data being serialized. Each object, array, and custom serialization object is tagged with a unique index. (Note that some objects do not allow properties to be added to them. In this situation, the Jaxer serializer maintains an array of these items. This array is searched when new items are encountered and serves the same purpose as the id property). Before adding the index, we first check if we have already indexed the item. If the tag already exists, then we've either exposed a cycle or a multi-reference. At this point, the serializer knows to switch to another JSON format that minimizes the amount of data to be serialized. References and custom serialization objects each make use of specially formatted strings. To make this a bit clearer, we create an array of two references to the same date object. <pre>var d = new Date(); var items = [ d, d ] ; var json = Jaxer.Serialization.toJSONString(items);</pre> The resulting JSON string will look like the following: <pre> [ [ "~1~","~1~" ] , "~Date:2007-08-17T11:57:30~" ] </pre> This format always has a top-level array whose first element is the root item that was originally being serialized. In this case, our top-most element was an array. As an aside, the only top-level elements that can generate this format are arrays, objects, and custom serialization objects. The first special format used for references and is defined with "~ # ~" where # is a number. The number is the index into the top-level array. The element at that index is the item that needs to be referenced where the reference string lives. In this example, once deserialization has completed, both instances of "~1~" will have been replaced with references to the deserialized date object. The next custom format, the date, shows how custom serializers emit text. The first item after the ~ but before the : is the name of the type. This is the fully-qualified type as you would have to type it in JavaScript to get to that type's constructor. The string after the : is in a format as generated by the type's custom serializer. The resulting string generated by the custom serializer is in turn serialized as a string, so the deserializer does not need to handle special characters or escape sequences. It is the responsibility of the custom deserializer to consume that text and to return effectively a clone of the original object. This module also allows a developer to register alternate serialization and deserialization methods. The default method as described above is referred to as the "jaxer" method. Alternately, if you require strict adherence to pure JSON, you can use the "json" method. The method is specificed in a separate optional parameter to the "toJSONString" function (see that function for more details).
Add a top-level JSON serializer
The unique name of the deserializer. This name can be specified in the options object provided to the fromJSONString function. That will select this deserializer as the top-level function to deserialize the specified object. Note that case is not significant
The function used to deserialized the JSON string created by the associated serializer.
An optional function that will be called before the top-level deserialization process begins. This function should take a single parameter which will be the options object provided to the fromJSONString function. Note that the options object will be an inherited clone of the object sent to fromJSONString. This allows this function to initialize any data structures needed by the deserializer without altering the original options object passed into fromJSONString
An optional function that will be called after the top-level deserialization process ends. This function should take a single parameter which will be the options object provided to the fromJSONString function. Note that the options object will be an inherited clone of the object sent to the fromJSONString.
Add a top-level JSON serializer
The unique name of the serializer. This name can be specified in the options object provided to the toJSONString function. That will select this serializer as the top-level function to serialize the specified object. Note that case is not significant
The function used to serialize data. This function should take two arguments: the actual data to serialize and an options object
An optional function that will be called before the top-level serialization process begins. This function should take a single parameter which will be the options object provided to the toJSONString function. Note that the options object will be an inherited clone of the object sent to the toJSONString. This allows this function to initialize any data structures needed by the serializer without altering the original options object passed into toJSONString
An optional function that will be called after the top-level serialization process ends. This function should take a single parameter which will be the options object provided to the toJSONString function. Note that the options object will be an inherited clone of the object sent to the toJSONString.
Add handlers for custom serialization/deserialization
The fully-qualified name of the type. This should reflect the full, potentially dotted, notation you would need to use to access this type's constructor from the global context.
A function that takes an instance of the type it serializes and that returns a string representation of the type suitable as input into the deserializer
A function that takes a string produced by the custom serializer and that returns a new instance of the custom supported type.
An optional function that takes an object instance and returns a boolean. This function should return true if it the current handler is able to serialize the object passed to it.
An optional function that takes an object instance and returns a boolean. This function should return true if it the current handler is able to deserialize the string passed to it.
Reconstruct a Javascript data structure from a JSON string. Note that we have extended JSON to support object references and to support dates. Object references allow multiple places within the JSON data structure to point to the same object as opposed to clones of those objects. Date support uses a special string format to store a given date in GMT
A string in the JSON format
The options objecct which can be used to control deserialization
The resulting object graph after converting the JSON string to the equivalent Javascript data structure
Remove support for the custom JSON serializer
The name of the serializer to remove. Note that case is not significant
Returns true if the serializer was successfully removed. Note that this function will return false if you attempt to remove a handler that is not already registered or if it is a built-in serializer like "jaxer".
Remove support for custom serialization/deserialization for the specified type
The fully qualified name of the type to remove
Returns true if the handler was successfully removed. Note that this function will return false if you attempt to remove a handler that is not already registered.
Convert the specified object into a JSON representation. Note that we have modified JSON to support object references (cycles) and to convert Dates into a special format that will be recognized by our code during deserialization. This function includes an optional second parameter which can be used to control how the data is serialized. If the options parameter defines an 'as' property, the will be used to select the serialization format. Currently, the values 'jaxer' and 'json' are supported where 'jaxer' includes support for cycles, multi-refs, and custom type serializers and where 'json' follows the serialization format and semantics as defined by Douglas Crockford on the json.org website. When specifying the 'jaxer' serializer, additional options are available. The "useCustomSerializers" has a boolean value which defaults to true. When this property is true, any type serializers that have been registered via addTypeHandler will be used in the serialization process. When this value is false, items needing custom serialization will be ignored as they would be in the "json" format. The "undefinedSerializationAction" property determines how the 'undefined' value is handled. The action defaults to 'serialize', but 'throw' is also supported which will throw an exception when trying serialize 'undefined'. When specifying the 'json' serializer, additional options are available. The 'maxDepth' property, which defaults to 10, is used to prevent deep recursion. If the recursion level is encountered, the 'maxDepthAction' property determines the serializer's action. 'truncate' will emit a "__truncated__" string in place of the object that would cause the recursion level to be exceeded. 'throw' will throw an exception. The 'dateSerializationAction' property is used to determine how dates are processed. A value of 'serialize' will convert the date to a specially formatted string as described in the json.org example code. A value of 'throw' will throw an exception when a date is encountered. The 'undefinedSerializationAction' property is used to determine how 'undefined' is processed. A value of 'serialize' will convert the value to 'undefined'. 'throw' will throw an exception and 'nullify' will return 'null'. The 'specialNumberSerializationAction' property is used to determine how Infinity, -Infinity, and NaN are processed. A value of 'serialize' will convert the value to their text representation which is the same as the identifier used to represent them. 'throw' will throw an exception and 'nullify' will return null. Note that other serializers may be registered with Jaxer. Most likely those serializers will define their own set of options. You will need to refer to the implementors documentation to discover those properties, their value, and their associated semantics.
The source object to convert to a JSON string
An optional object used to specify configuration info to the selected serializer
The resulting JSON string which can be reversed back into the source object via Serialization.fromJSONString
A namespace object holding functions and members used to manage a user session across multiple requests.
Get session key from the client via cookie, or create one as needed<br><br>(Advanced)
The key that uniquely identifies the current application
A session key that can be used to track the current session (new or existing)
Set session key on the response to the client via a cookie<br><br>(Advanced)
The key that uniquely identifies the current application
The session key to use
Network socket utility object for simple character-based (non-binary) socket access.
The constructor of a network socket object used for character-based (non-binary) operations
Returns an instance of Socket.
How many bytes (not characters) are currently available on the stream?
the number of bytes available
Close the socket
Flush the socket's output stream
Open the socket for communication
The host to connect to
The port on which to connect
Read a single line from the socket
The text read in
Read characters from the socket into a string
How many characters to read
The text read in
Write a string to the socket
The text to write
Namespace object holding functions and members used to access operating system resources and processes.
The path on disk of the current user's desktop folder The path on disk of the current executable's folder The path on disk of the current user's home folder A string identifying the current operating system The filesystem separator character (either \ or /) The path on disk of the system's temp folder
Ask the operating system to attempt to open the file. This simulates "double clicking" the file on your platform. This routine only works on platforms which support this functionality. This is non-blocking and script execution will continue.
A String containing the path to the file or a Jaxer.File object referencing the filesystem object
A namespace object used to access threading-related functionality, such as async processing
The currently executing thread. The default number of milliseconds to wait before timing out waitFor. Set to 3000 (3 seconds) by default).
Allows asynchronous processing (e.g. async XHR requests, async Sandbox loading, etc.) to happen and waits for them to complete -- completion is indicated by a test function returning true. You can specify a maximum time you want to wait before giving up and continuing.
The function to evaluate periodically to see whether we should continue to wait. When testFunction returns true, the waitFor function exits.
The number of milliseconds to wait for testFunction to return true before timing out and exiting. If this is zero or negative, waits indefinitely (though other timeouts may intervene)
true if waitFor returned true, false if the timeout was reached before then
A namespace to hold a miscellany of generic utility functions and other objects. In particular, it also holds sub-namespaces for more specific operations.
Clones an object (actually any argument) and returns the clone. If obj is of type "object", then the clone is created from the same constructor (but without any arguments). For a deep clone, every (enumerable) property is itself cloned; otherwise, every (enumerable) property is simply copied (by value or reference).
The object to clone. If it's not of type object, its value is simply copied and returned. It is not altered.
Whether to make a deep clone or a shallow one (just copy properties); by default, false.
An optional maximum cloning depth. By default it's 10. This prevents infinite loops.
The new, cloned object.
Returns an array whose elements consist of the elements of all the arrays or array-like objects passed in as arguments. If any of the arguments is null or undefined (i.e. is equivalent to false) it is skipped.
Any number of arrays or array-like objects (e.g. a function's arguments meta-array). Note that, unlike Array.concat, the arguments here need to be arrays or array-like objects that have a length property and an indexer (i.e. obj [ i ] is defined)
The concatenated array
Extends an object by (shallow) cloning it and then copying all (enumerable) properties from the extensions object to the new cloned object.
The object to use as a base and extend. It is not altered.
The object to use as extensions -- usually this is a simple hashmap of properties and their values.
The extended clone.
Remove items from an array that do not pass a given criteria. Each item in the specified array will be passed to the filtering function. If that function returns true, then the item will be appended to the resulting array. If the function returns false, the item is not added to the resulting array. Note that the specified array is not altered in place. A new array is created as a result of this function call.
The source array to be filtered
The filtering function to apply to each array item. This filter has two parameters. The first parameter is the current item in the array that is potentially being filtered. The second parameter is the index of the item potentially being filtered. The index can be used in cases where the filtering decision needs to be determined based on proximity to other items in the array
Returns a new array containing only items that were approved by the filtering function.
Remove items from an array that do not pass a given criteria. Each item in the specified array will be passed to the filtering function. If that function returns true, then the item will remain in the specified array. If the function returns false, the item is removed from the specified array. Note that the specified array is altered in place. If you prefer to create a new array, leaving the original in tact, then use Util.filter instead
The source array to be filtered
The filtering function to apply to each array item. This filter has two parameters. The first parameter is the current item in the array that is potentially being filtered. The second parameter is the index of the item potentially being filtered. The index can be used in cases where the filtering decision needs to be determined based on proximity to other items in the array
Returns the filtered array containing only items that were approved by the filtering function. Note that this instance will be the same as the instance passed into the function. This is provided as a convenience and to keep this function signature the same as Util.filter's signature.
Apply a function to each element in an array.
The source array
The function to apply to each of the items in the source array. The function has two parameters. The first parameter is the current item in the array to be process by this function. The second parameter is the index of the item being processed.
Get all property names or filtered subset of names from an object.
The source object
An optional filter function to apply to the property's name and value. filter(name, value) should return something that's equivalent to true if the property is to be included.
If true, returns the result as a hash (with all values set to true)
A list or hash of the property names depending on the value provided to the asHash parameter
Determine if the specified object contains all properties in a list of property names.
The source object
The list of property names to test on the specified object
Returns true if all properties in the list exist on the specified object
Tests whether the given object is a Date object (even if it's from a different global context)
The object to test
True if it's a Date (or at least seems to be a Date), false otherwise
Tests whether the given object is devoid of any (enumerable) properties.
The object to test
false if there is (at least) one enumerable property, true otherwise
Tests whether the given function is native (i.e. for which there is actually no source code)
The function to test
True if it's a native function, false otherwise
Tests whether the given string is the source of a native function (i.e. for which there is actually no source code)
The source string to test
True if it's a native function's source, false otherwise
Create a new array by applying the result of a function to each of the items in the array.
The source array
The function to apply to each of the items in the source array. The function has two parameters. The first parameter is the current item in the array that is being transformed. The second parameter is the index of the item being transformed.
Returns a new array where each item is the result of the specified function as it was applied to each of the source array items.
Replace each item of an array by applying a function and then replacing the original item with the results of that function.
The source array
The function to apply to each of the items in the source array. The function has two parameters. The first parameter is the current item in the array that is being transformed. The second parameter is the index of the item being transformed.
Returns the mapped array. Note that this instance will be the same as the instance passed into the function. This is provided as a convenience and to keep this function's signature the same as Util.map's signature.
Does nothing for the given number of milliseconds
The number of milliseconds to pause.
Namespace used to hold functions and other objects for using CRC32
Create a CRC32 from an array of bytes. The user may specify the starting offset within the array and the total number of bytes past the offset to include in the resulting CRC32.
An array of byte values
The optional offset within the array where the calculated CRC32 should start
The optional number of bytes starting from the offset to include in the resulting CRC32.
The resulting CRC32
Create a CRC32 from the characters of a string
The source string to convert
The resulting CRC32 of the source string
Namespace object holding functions and members for working with client (browser) cookies on the server side.
Get a cookie key value
The name of the cookie to retrieve
Returns the value of the specified cookie or null if the value does not exist.
Get an object containing all cookie keys and values from the current request. Each cookie name will become a property on the object and each cookie value will become that property's value.
The resulting object of all cookie key/value pairs
Parses a given array of an HTTP response's "Set-Cookie" header strings to extract the cookie fields
An array of the (string) values of the HTTP response's Set-Cookie headers
An array of objects, one per Set-Cookie header, with properties corresponding to the name, value, expires, path, and domain values in the header
Set a cookie name/value pair
The name of the cookie to set
The value of the cookie
Namespace used to hold functions and other objects that extend JavaScript's DOM capabilities.
Create a new script element with the specified content and attributes
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Convert an object's properties and property values into a string of attributes suitable for use in creating a string representation of an HTMLElement. Each property is used as the attribute name and each property value becomes the attribute value. Attribute values are surrounding in double-quotes and all property values containing double-quotes will have those characters escaped with backslashes.
The source object
The resulting string of attribute name/value pairs
Creates a new script element and adds it as the next sibling of the specified element in the DOM.
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
The element in the DOM after which the new script element will be inserted
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Creates a new script element and adds it as the first child of a specified element in the DOM.
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
The element in the DOM where the new script element will be added as the element's first child.
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Creates a new script element and adds it as the last child of a specified element in the DOM.
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
The element in the DOM where the new script element will be added as the element's last child.
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Creates a new script element and adds it before a specified element in the DOM.
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
The element in the DOM before which the new script element will be inserted
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Replace a specified element in the DOM with a new script element.
The DocumentElement to use when creating elements for the active document.
The text content for the script element. This value will be set via innerHTML once the new script element has been created
The element to replace with the a script element
A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values
The new script element with content and attributes applied.
Namespace used to hold functions and other objects that extend JavaScript's datetime handling.
Converts a date to a string and pads the month and date values to align all date values in columns. Not yet internationalized.
The source date
The source data converted to a string with month and data values padded with spaces to align all values
Namespace used to hold functions and other objects that extend JavaScript's math capabilities
Forces num into a finite integer. If it's a string, it first attempts to parse it to an integer. If it's a number, it takes its integer part by applying Math.floor() to it. If it's anything else, o NaN (not a number), it uses the defaultNum or 0.
The object to turn into an integer
The integer to use as a default (which will itself be forced to be 0 if not an integer)
Determine whether the specified value is an integer value
The number to test
Returns true if the number is an integer value
Namespace used to hold functions that create and manipulate a hash whose values are primitives or Arrays of primitives
Adds the name-value pair to the MultiHash: if the name does not exist, it is added with the given value; if the name exists, the previous value is turned into an Array, if needed, and then the given value is appended to it
The multihash to which the name-value should be added
The name to use as a key
The value to associate with the key -- it must not be an array
Analyzes the first MultiHash relative to the second
The MultiHash whose changes we are interested in
The MultiHash relative to which the changes have occurred
The results of the analysis, an object with three properties: 'added' is a hash of all the name-value pairs added; 'changed' is a hash of all the name-value pairs that have changed (the value is the one in after); and 'deleted' is a hash of all the name-value pairs that have been deleted (the value is the one in before, of course)
Removes the name-value pair from the MultiHash: if the name does not exist, or it does not have the value, nothing happens; if the name exists and has the value, that value is removed, and if no more values remain for that name, the name is removed
The multihash from which the name-value should be removed
The name of the key
The value to remove from the key -- it must not be an array
The namespace that holds functions timing javascript
A hashmap keyed by timer label, each element contains the timestamp last set. A hashmap keyed by lap label, each element contains the timestamp last set. A hashmap keyed by timer label, each element contains an Array of timing measurements.
This method is invoked to analyze/save/display the currently stored measurement timers. If no function parameter is provided then contents of the measurement timers are written to the logfile. If a function is provided then it is invoked with the timings hashmap (Jaxer.Util.Stopwatch.timings) as the only parameter.
The provided function is executed before all current timers are cleared. The function is provided the timings hashmap (Jaxer.Util.Stopwatch.timings) as the only parameter.
A lap timer which will store the delta between each invocation for later analysis
A label to uniquely identify this measurement timer
This method returns the value of the lapcounter for the provided label.
A label to uniquely identify this measurement timer
Reset all the currently managed timers
Start a timer for the provided label
A label to uniquely identify this measurement timer
Stops the current timer and stores the result for later analysis
A label to uniquely identify this measurement timer
Namespace that holds functions and other objects that extend JavaScript's string capabilities.
Check to see if a string ends with a string
The string to look in
The string to look for
Set to true for case insensitive searches
true if the string ends with the provided string
Escapes an input string for use with javascript
The source string
The escaped string suitable for use in an eval statement
Escapes an input string for use with SQL
The source string
The escaped string suitable for use in a SQL query
Searches the given lines for the given pattern, and returns the lines that matched.
The string to search through, which will be split up into its lines, or an array of lines (i.e. a string that has already been split)
The string pattern to look for, which will be turned into a RegExp, or the RegExp to match
An array of the lines that matched the pattern
Surround the provided string in single quotation marks
The original string
The original string encased in single quotes
Check to see if a string starts with another string
The string to look in
The string to look for
Set to true for case insensitive searches
true if the string starts with the provided string
Left or right trim the provided string. Optionally, you can specify a list of characters (as a single string) to trim from the source string. By default, whitespace is removed. Also, you can control which side of the string (start or end) is trimmed with the default being both sides.
The source string
This optional parameter can be used to specify a list of characters to remove from the sides of the source string. Any combination of these characters will be removed. If this parameter is not specified, then all whitespace characters will be removed.
This optional parameter can be used to control which side of the string is trimmed. A value of "L" will trim the start of the string and all other string values will trim the end of the string. If this parameter is not specified, then both sides of the string will be trimmed
The resulting trimmed string
Convert a string to a CamelCase representation by removing interword spaces and capitalizing the first letter of each word following an underscore
The orignal string containing underscores between words
The resulting string with underscores removed and the first letter of a word capitalized
Namespace that holds functions and other objects for working with URLs.
Combines any number of URL fragments into a single URL, using / as the separator. Before joining two fragments with the separator, it strips any existing separators on the fragment ends to be joined
Takes any number of string URL fragments
The fragments joined into a URL
If the given URL is already a file-type URL, it's returned untouched. Otherwise we turn it into a file-type URL by prefixing it with "file://"
The URL to apply this to
URL expressed as a file type URL
Decode a URL by replacing +'s with spaces and all hex values (%xx) with their character value
The source URL to decode
The resulting URL after all hex values have been converted
Encode a URL by replacing all special characters with hex values (%xx)
The string to encode
The resulting URL after special characters and spaces have been encoded
Converts an object's properties and property values to a string suitable as a query string. Each property name becomes a key in the query string and each property value becomes the key value. A key and its value are separated by the '=' character. Each key/value pair is separated by '&'. Note that each value is encoded so invalid URL characters are encoded properly.
The object to convert to a query string
The resulting query string
Tests whether the given URL is a reasonable file URL rather than something that's available over the network.The test is pretty simplistic: the URL must start with file://, resource://, or chrome://, or it must contain a backslash (i.e. a Windows filesystem separator)
The URL to test
True if a reasonable file URL, false otherwise
Parse a string containing a URL into a Jaxer.Util.Url.ParsedUrl object to allow manipulation of the individual URL component parts
The URL to parse
The parts of a URL broken down into useful pieces
Create a Util.Url.ParsedUrl object from the component pieces provided as parameters to the functions calls.
The host (and port, if any) containing the given path
The absolute path to a resource on the host
The protocol ('http' or 'https'); the default is 'http'
The parts of a URL broken down into useful pieces
Divides the key/value pairs in a query string and builds an object for these values. The key will become the property name of the object and the value will become the value of that property
A query string
An object describing the parsed pieces of a URL.
An object describing the parsed pieces of a URL. This object contains sub properties to allow access to the individual pieces of the URL
Returns an instance of ParsedUrl.
The protocol, host, and port (e.g. 'http://www.aptana.com:8081'), which might not have a protocol or a port if they were not specified The highest-level non-TLD domain (e.g. 'aptana.com' in 'www.playground.aptana.com'), or the IP address if the host was an IP address The file (e.g. 'logo.gif') after the hostAndPort and the filename, and before any fragment or query, or '' if not specified The fragment string (e.g. 'myBookmark') after the # symbol (e.g. # myBookmark), or '' if not specified The host (e.g. 'www.aptana.com'), or '' if not specified The combined host and port (e.g. 'www.aptana.com:8081'), which might be just the host if no port was specified The path (e.g. '/images') between the hostAndPort and the filename, or '' if none The path and file (e.g. '/images/small/logo.png' in 'www.aptana.com/images/small/logo.png') after the domain and before any query or fragment A possibly-empty array of strings that compose the path part of the URL (e.g. [ "images", "small" ] in 'www.aptana.com/images/small/logo.png') The port as a string (e.g. '80'), or '' if not specified The protocol (typically 'http' or 'https'), or '' if not specified The query string (e.g. 'name=joe&id=12') after the (first) question mark (?), or '' if not specified An object containing a property for each name=value pair in the query string of the URL, e.g. 'http://www.aptana.com/staff?name=joe&id=12' leads to queryParts.name = "joe" and queryParts.id = "12" The subdomain (e.g. 'www.playground' in 'www.playground.aptana.com') before the domain, or '' if none or if the host was an IP address The complete (but whitespace-trimmed) original URL, before parsing
Namespace object holding functions and members used to resolve and fetch web resources. Fetching is done via XMLHttpRequests.
Returns the URL to be used as a reference for resolving relative URLs if no other reference is given<br><br>(Advanced)
The absolute URL
Fetch a document from a URL by resolving it to a local file (if it starts with file://) or by a GET command.
The URL to fetch, which may be a file:// URL if desired. This will first be resolved by Dir.resolve() or Web.resolve().
Options for finer control of how the request is made.
The text of the requested document, or the XML DOM if the response was an XML document. Set the "as" property in the options argument to "text" or "xml" to force what is returned. An Exception is thrown if not successful.
GET or POST data to a URL, loading the result into the window of a new Jaxer.Sandbox object.
The URL of the page to GET or POST to. This will first be resolved by Web.resolve().
The data to submit, if any. If this parameter is omitted or is null, a GET is used; otherwise a POST is used. If this is a string, it should usually be a query string in a format (name1=value1&name2=value2) suitable for a Content-Type of 'application/x-www-form-urlencoded'. If an object, its enumerable properties will be used to construct the query string.
Options for finer control of how the request is made.
The Sandbox, which will usually have a window and document in it (if the request was successful and returned an HTML page)
POST data to a URL and return the response web page.
The URL of the page to POST to and fetch. This will first be resolved by Web.resolve().
The data to submit. If a string, it should be a query string in a format (name1=value1&name2=value2) suitable for a Content-Type of 'application/x-www-form-urlencoded'. If an object, its enumerable properties will be used to construct the query string.
Options for finer control of how the request is made.
The text of the requested document, or the XML DOM if the response was an XML document. Set the "as" property in the options argument to "text" or "xml" to force what is returned. An Exception is thrown if not successful.
Resolves a URL to an absolute URL (one starting with protocol://domain...) To resolve a relative URL (with or without a leading /), use a current document or callback for reference. Uses the base href of the current document, if specified. If Jaxer.Config.REWRITE_TO_FILE_URL_REGEX exists and matches the url, the url is resolved as a file-type URL: it will use the given referenceUrl if it's already a file-based one, otherwise it will use the Jaxer.request.documentRoot for an absolute url or Jaxer.request.currentFolder for a relative url. If Jaxer.Config.REWRITE_RELATIVE_URL exists (and we're not dealing in file-based URLs), its value is used to rewrite the relative url -- replacing Jaxer.Config.REWRITE_RELATIVE_URL_REGEX pattern, if it exists, else replacing http [ s ] :// followed by anything but a slash.
The URL to resolve
An optional reference URL to use, overriding the built-in logic
The fully-resolved URL, or the original URL if the input was already an absolute URL
A generalized method to access a web URL via the built-in XMLHttpRequest object.
The url to access
Usually 'GET' (default) or 'POST'
Use for POST submissions, or for GET requests if the url does not already contain the data. This may be a string (usually of the form name1=value&name2=value), or an object whose name->value property pairs will be used to construct such a string.
Options for finer control of how the request is made.
The text of the requested document, or the XML DOM if the response was an XML document. Set the "as" property in the options argument to "text" or "xml" or "e4x" to force what is returned. An Exception is thrown if not successful.
Namespace to hold the Jaxer client-side cross-browser wrapper around XMLHttpRequest.
The value of the "reason" property that indicates a communication failure has occurred. This property is set on the Error object that's thrown by XHR.send() during synchronous requests that don't use the onsuccess function but rather just return a response or throw an Error.<br><br>(Advanced) The value of the "reason" property that indicates a timeout has occurred. This property is set on the Error object that's thrown by XHR.send() during synchronous requests that don't use the onsuccess function but rather just return a response or throw an Error.<br><br>(Advanced) The default SendOptions which new calls to Jaxer.XHR.send(message, options, extra) will use, unless overridden by the options argument. This is slightly different for client-side and server-side requests (e.g. server-side requests are by default synchronous).
Returns an XMLHttpRequest object by calling the platform-specific API for it. On the server side of Jaxer, the XPCOM version of XMLHttpRequest is used.<br><br>(Advanced)
The default client-side function used to handle any errors that occur during XMLHttpRequest processing by throwing an error describing them<br><br>(Advanced)
An error object describing the error, if one was thrown. Otherwise this is null.
Any extra information passed into Jaxer.XHR.send(), e.g. to make error messages more informative.
The XMLHttpRequest object that contains the information received from the server, e.g. in xhr.status and xhr.responseText. It may be null if an error was encountered creating it.
The default client-side function used to handle any timeout errors that occur during XMLHttpRequest processing by throwing an error describing them<br><br>(Advanced)
The timeout error object encountered, having a "timeout" property with its value indicating the timeout (in milliseconds) used in this request.
Any extra information passed into Jaxer.XHR.send(), e.g. to make error messages more informative.
The XMLHttpRequest object that contains the information received from the server, e.g. in xhr.status and xhr.responseText. It may be null if an error was encountered creating it.
The default function used to test whether the XMLHttpRequest got a successful response or not, in particular using xhr.status, location.protocol and some browser sniffing.<br><br>(Advanced)
The XMLHttpRequest object that got the response
true if successful, false otherwise
Cancels the pending async XMLHttpRequest if its response has not yet been received and if it has not yet timed out.
The key that Jaxer.XHR.send() returned when the request was created.
true if the request was found and canceled, false if it was not found (i.e. was not in the pending queue)
The generic function used to send requests via XMLHttpRequest objects. Each request gets its own XMLHttpRequest object, and async requests hold onto that object until they're finished or timed out or canceled. On the server side of Jaxer, only synchronous requests are supported. <br><br> For async requests, this returns a key that can be used to abort the request via Jaxer.XHR.cancel(). <br><br> For synchronous requests, returns the response of the server or throws an exception if an error occurred, unless an onsuccess function was specified in the options, in which case it passes the response to that function and also handles any errors through the onfailure function if specified in the options. <br><br> In any case, the response can be a text string or an XML DOM. To force one or the other, set the "as" property on the options argument, e.g. if as="text" it will definitely be a text string, if as="xml" it will definitely be an XML DOM, and if as="e4x" it will be an E4X DOM (if E4X is supported -- which is always the case server-side but may not be client-side).
The message to send, usually as a query string ("name1=value&name2=value2...")
A JavaScript object (hashmap) of name: value property pairs specifying how to handle this request.
Any extra information that might be useful e.g. in the error handlers on this request. This object is simply passed on to them if/when they're called. E.g. Jaxer.Callback uses this information to pass the name of the function being called remotely, so error messages can be more informative.
For async requests, a key to the XHR object; for synchronous requests (with no onsuccess handler in the options), a text string or an XML DOM, or an object containing detailed information about the response (if the options specified extendedResponse=true)
A hashmap containing detaild information about the response from an XHR.send.
A hashmap containing detailed information about the response from an XHR.send. This is returned as the response of XHR.send when the SendOptions specify extendedResponse=true.
Returns an instance of ResponseData.
An array of cooky directives indicated in the response via the "Set-Cookie" header. Each cookie is represented by an object with properties corresponding to its name, value, expires, path, and domain. The value of the "extra" parameter, if any, passed into XHR.send. A hashmap containing properties corresponding to the names of the response headers. For each property, if the header name was present multiple times in the response, the value of the property is an array of the corresponding header values; otherwise, the value of the property is the value of the header. The responseText string or responseXML XMLDocument of the response, depending on the SendOptions and the returned content type The HTTP status code of the response (e.g. 200) The HTTP status text of the response (e.g. "OK") The responseText of the response, or null if none The XMLHttpRequest object used in the request-response The responseXML of the response, or null if none
Options used to define the behavior of Jaxer.XHR.send.
Options used to define the behavior of Jaxer.XHR.send. Create a new Jaxer.XHR.SendOptions() to get the default options, then modify its properties as needed before passing it to Jaxer.XHR.send.
Returns an instance of SendOptions.
For async requests, the number of milliseconds between polling for onreadystatechange, by default 11<br><br>(Advanced) Set to "text" to force interpreting the response as text regardless of mimetype. Set to "xml" to force interpreting the response as XML regardless of mimetype and returning the XML as an XML (DOM) object via XMLHttpRequest.responseXML. Set to null to not force anything - see overrideMimeType and responseType for finer control. Set to true for asynchronous, false for synchronous. By default it's true client-side and false server-side. To use it server-side, see also Jaxer.Thread.waitFor. If true (default, client-side), a random name and value query pair will be appended to the URL on each call The content type of the request being sent (by default "application/x-www-form-urlencoded") The function to use to create the XMLHttpRequest, by default XHR.getTransport Set to null to use default headers; set to an array of [ name, value ] arrays to use custom headers instead Should be "GET" (default, server-side) or "POST" (default, client-side) Set to a custom callback function to call if unsuccessful (by default set to Jaxer.XHR.onfailure client-side). Its arguments are the error encountered, the "extra" information from the caller, and the XHR instance. Set to a custom function to call when done receiving (or timed out), usually to abort() Set to a custom function to call just before sending (e.g. to set custom headers, mimetype, keep reference to xhr object, etc.) Set to a function to call if successful. Its arguments are the response received back from the server, and any "extra" information passed in when calling send(). For synchronous calls, you can optionally set onsuccess to null to have XHR.send() return a value directly (and throw errors on failure/timeout). Set to a custom timeout function to call if timeout is used and the async request has timed out. Its arguments are the timeout error encountered, the "extra" information from the caller, and the XHR instance. Set to null to use whatever mimetype the server sends in the response; set to a mimetype string (e.g. "text/plain") to force the response to be interpreted using the given mimetype If the target URL requires authentication, specify this password, otherwise leave this as null. Set to "text" (default) to use the responseText, to "xml" to use the responseXML, or "auto" to use the response's content-type to choose Set to a custom function that receives the XMLHttpRequest (after readyState == 4) and tests whether it succeeded (by default Jaxer.XHR.testSuccess) For async (client-side) requests, set to number of milliseconds before timing out, or 0 to wait indefinitely The URL to which the XMLHttpRequest is to be sent. On the client side, defaults to Jaxer.CALLBACK_URI which is used to handle function callbacks from client-side proxies to their server-side counterparts. If the target URL requires authentication, specify this username, otherwise leave this as null. If this is set to true, the response returned directly or passed to an onsuccess handler will contain detailed information about the response, in the form of a Jaxer.XHR.ResponseData object.
The default value to use when creating new Jaxer.XHR (XMLHttpRequest) requests, in milliseconds. This also applies to anything that uses XHRs, such as Jaxer.Web.get. It's only used for async requests. It defaults to 30 seconds (30000) on the server, and 0 on the client. 0 means no timeout. NOTE: To set the the default timeout to use when creating new XHR.SendOptions() objects, set Jaxer.XHR.SendOptions.timeout instead.