API - Overview of Classes, Methods, and Fields
The JWIG Application Programming Interface provides functionality for
defining Web services.
In addition to this API, JWIG adds a set of language constructs to the Java language for
constructing and showing XML documents and receiving form input.
A brief overview of the central parts of the API:
- abstract class dk.brics.jwig.runtime.Service - base class for JWIG services
- void setOutputEncoding - sets output encoding (default: ISO-8859-1)
- Log servicelog - service log file
- void log(int level, String msg) - writes message to service log
- String formatHTTPTime(Date d) - formats Date according to RFC 822/1123
- String urlEncode(String s) - URL encodes string using UTF-8
- String urlDecode(String s) - URL decodes string in UTF-8
- String getURL(Class c) - returns URL for creating a thread in the current service
- void checkpoint() - writes shared service data to disk
- void rollback() - restores shared service data from disk
- boolean setExcludeLock() - locks service for new requests
- void releaseExcludeLock() - removes service lock
- boolean sendMail(String to, Map header, String body, String enc) - sends an email
- abstract class ServerThread - base class for all server threads
- List arglist - interaction field arguments (list of Arg) in order of occurence
- Map argmap - interaction field arguments (map from String to list of Arg)
- Map env - interaction environment (map from String to String)
- Map cookies - incoming cookies (map from String to String)
- String out_cookies - raw string containing outgoing cookies
- int reply_timeout - time-out (seconds) for waiting for service reply and refresh interval
- int show_timeout - time-out at 'show'
- int terminated_timeout - time-out for garbage collecting completed sessions
- String serverdir - Apache/mod_bigwig server home directory
- String servicedir - service home directory
- String sessiondir - session home directory
- String serverurl - server URL (protocol and host)
- String serviceurl - URL to service home directory (excluding protocol and host)
- String sessionurl - URL to session home directory (excluding protocol and host)
- String intkey - interaction access key
- boolean validate_xhtml - perform runtime XHTML validation if true (default: false)
- void addCookie(String name, String value, String expires, String path, String domain, boolean secure) - adds cookie to out_cookies
- void enableSSL() - sets protocol to HTTPS
- void disableSSL() - sets protocol to HTTP
- void setFileAttributes(boolean local, boolean remove, String path, String mime, String encoding, boolean nocache, boolean sendcookies) - writes ".http" attribute file
- abstract class Session - base class for session threads, extends ServerThread
- abstract void main() - main method
- String continueURL() - returns URL for continuing the current session
- void setTemporaryReply(XML doc) - writes temporary reply page
- void makeUserFile(boolean local, String userfile, List usernames) - writes .htpasswd file for HTTP Authentication
- void setAccessControl(boolean local, String userfile, String realm, boolean require_ssl) - writes .htaccess file for HTTP Authentication
- boolean removeAccessControl(boolean local) - removes .htaccess file
- abstract class Page - base class for page threads, extends ServerThread
- abstract void main() - main method
- abstract class Seslet - base class for seslet threads, extends ServerThread
- abstract void main(InputStream in, OutputStream out) - main method
- class dk.brics.jwig.runwig.Log - logging facility
- void setLogLevel(int level) - sets logging verbosity level
- void setStream(PrintStream s) - changes print stream
- void write(int level, String msg) - writes message to log
- void write(String msg, Throwable e) - writes Throwable message to log
- class dk.brics.jwig.runwig.Arg - HTTP input field, used for file uploads
- String name - field name
- String value - field value
- String filename - filename attribute, if file upload
- String contenttype - contenttype attribute, if file upload
- String charset - charset attribute, if file upload
- interface dk.brics.jwig.runwig.XMLSerializable - for XML serialization of shared data
- Element toXML() - creates JDOM XML representation of the shared state
- void fromXML(Element e) - restores shared state from JDOM XML representation
The full javadoc API specification
for the BRICS JWIG implementation is available online.
(Note, however, that the javadoc currently exposes many low-level methods and fields that should not
be exploited directly - in a future version, we will hide those parts.)