Servertec iws
Documentation
Conventions
Command Line
Java API
AccessLogEntry
Codecs
DString
ErrorLogEntry
EventLogEntry
iws
iwsStorage
Logger
ServletManager
Utils

Servlet API
Servlets
Config Files
Log Files
Classes
Directory Tree

Return

 

java.lang.Object
 |
 +--stec.iws.iws

public class iws

Methods used to initialize, run and stop Servertec Internet Server.

Fields

Field Description
aliases Used to access, add, remove and change aliases.
messages Used to access, add, remove and change messages.
mimetypes Used to access, add, remove and change mimetypes.
resources Used to access, add, remove and change resources.
servlets Used to access, add, remove and change servlets.

Methods

Method Description
destroy Stops the Servertec Internet Server runtime environment.
getBaseDirectory Returns the base directory or archive that Servertec Internet Server uses to run from.
getMimeType Returns the MIME type of the specified file.
getServerVersion Returns the current version of Servertec Internet Server.
getStartTime Returns the time in milliseconds since January 1, 1970 UTC when the server was started.
init Initializes the Servertec Internet Server runtime environment.
log Used to log exceptions or errors messages.
run Starts and run Servertec Internet Server.
shutdown Used by administration thread to shutdown Servertec Internet Server.

Example

import stec.iws.iws;

public class testServer
{
    void static main(String[] args)
    {
        try
        {
            iws.init(args);

            iws.servlets.put("File", "stec.iws.FileServlet");
            ServletManager.loadServlet("File");

            iws.run();
        }
        catch(Exception ex)
        {
            log(ex);
        }
        finally
        {
            iws.destroy();
        }
    }
}

aliases

Used to access, add, remove and change aliases.

Syntax

public static Hashtable aliases

Notes

Aliases are automatically loaded when iws.init() is called.

Example

iws.aliases.put("/scripts", "/cgi-bin")

messages

Used to access, add, remove and change messages.

Syntax

public static Hashtable messages

Notes

Messages are automatically loaded when iws.init() is called.

Example

iws.messages.put("200", "200 OK")

mimetypes

Used to access, add, remove and change mimetypes.

Syntax

public static Hashtable mimetypes

Notes

Mimetypes are automatically loaded when iws.init() is called.

Example

iws.mimetypes.put(".htm", "text/html")

resources

Used to access, add, remove and change resources.

Syntax

public static Hashtable resources

Notes

Resources are automatically loaded when iws.init() is called.

Example

iws.resources.put("/protected", "default")

servlets

Used to access, add, remove and change servlets.

Syntax

public static Hashtable servlets

Notes

Servlets are automatically loaded when iws.init() is called.

Example

iws.servlets.put("FileServlet", "stec.iws.FileServlet")

destroy

Stops the Servertec Internet Server runtime environment.

Syntax

public static void destroy()

Parameters

None

Returns

Nothing

Throws

Nothing

Example

iws.destroy();

getBaseDirectory

Returns the base directory or archive that Servertec Internet Server uses to run from.

Syntax

public static String getBaseDirectory()

Parameters

None

Returns

String the base directory or archive file.

Throws

Nothing

Notes

A files MIME, Multipurpose Internet Mail Extension, type is a Web protocol for defining a files type.

Example

String base_dir = iws.getBaseDirectory();

getMimeType

Returns the MIME type of the specified file.

Syntax

public static String getMimeType(String filename)

Parameters

filename the filename to use.

Returns

String the associated mime type.

Throws

Nothing

Notes

A files MIME, Multipurpose Internet Mail Extension, type is a Web protocol for defining a files type.

Example

String mimetype = iws.getMimeType(filename);

getServerVersion

Returns the current version of Servertec Internet Server.

Syntax

public static String getServerVersion()

Parameters

None

Returns

String the current version of Servertec Internet Server.

Throws

Nothing

Example

String version = iws.getServerVersion();

getStartTime

Returns the time in milliseconds since January 1, 1970 UTC when the server was started.

Syntax

public static long getStartTime()

Parameters

None

Returns

long the time in milliseconds since January 1, 1970 UTC when the server was started.

Throws

Nothing

Example

long start_time = iws.getStartTime();

init

Initializes the Servertec Internet Server runtime environment.

Syntax

public static void init(String[] args)

Parameters

args an array of strings containing arguments to Servertec Internet Server.

Returns

Nothing

Throws

Nothing

Notes

Presently the only parameter is an optional base directory that Servertec Internet Server uses to find its configuration files.

Example

iws.init(args);

log

Used to log exceptions or errors messages.

Syntax

public static void log(Throwable exception)
public static void log(String message)
public static void log(Throwable exception, String message)

Parameters

exception an Error or Exception object.
message event message to log.

Returns

Nothing

Throws

Nothing

Example

iws.destroy();

run

Starts and run Servertec Internet Server.

Syntax

public static void run() throws Exception

Parameters

None

Returns

Nothing

Throws

Nothing

Example

iws.run();

shutdown

Used by administration thread to shutdown Servertec Internet Server.

Syntax

public static void shutdown(int returnCode)

Parameters

returnCode the return code to return to the iws wrapper.

0 to stop the server or 0x7fff to restart the server.

Returns

Nothing

Throws

Nothing

Example

iws.shutdown(0);
 top of page
Copyright © 1998-2005 Servertec. All rights reserved.
Privacy Statement.
Last Modified: Mon Sep 05 14:25:47 EDT 2005