Sleepbot.com Java Classes

com.sleepbot.WRLDtime.app
Class WRLDtimeServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.sleepbot.WRLDtime.app.WRLDtimeServlet
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class WRLDtimeServlet
extends javax.servlet.http.HttpServlet
implements java.lang.Runnable

A simple HTTP servlet that returns the current WRLD.time.
 
The servlet maintains a 4-digit WRLD.time code -- measure, separator and beat -- and responds with a formatted number. See the Param* documentation for the ways to configure the response format. The servlet will only recognize GET parameters.
 
The servlet periodically aligns itself (via UTC) to one of the time.nist.gov servers.
 
For more information, please see the general documentation at Sleepbot.com.
 
version 1.3 - 02Jan05 - Daniel M Foley

See Also:
Serialized Form

Field Summary
static int ErrorBEAT
           
static int ErrorGENERIC
           
static int ErrorMEASURE
           
static int ErrorNONE
           
static java.lang.String ParamBEAT
          The &beat= parameter.
static java.lang.String ParamDELIMITER
          The &delimiter= parameter.
static java.lang.String ParamFORMAT
          The &format= parameter.
static java.lang.String ParamMEASURE
          The &measure= parameter.
static java.lang.String ParamPADDING
          The &padding= parameter.
static java.lang.String ParamTEXTAFTER
          The &textafter= parameter.
static java.lang.String ParamTEXTBEFORE
          The &textbefore= parameter.
static java.lang.String ParamTEXTTYPE
          The &texttype= parameter.
static java.lang.String ValueBEAT_DEFAULT
           
static java.lang.String ValueDELIMITER_DEFAULT
           
static java.lang.String ValueMEASURE_DEFAULT
           
static java.lang.String ValuePADDING_DEFAULT
          The 'default' &padding= parameter (ParamPADDING) setting.
static java.lang.String ValuePADDING_NO
          The 'no' &padding= parameter (ParamPADDING) setting.
static java.lang.String ValuePADDING_YES
          The 'yes' &padding= parameter (ParamPADDING) setting.
static java.lang.String ValueTEXTTYPE_DEFAULT
           
 
Constructor Summary
WRLDtimeServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          The GET request processor for the servlet.
 void init()
          The initialization for the servlet.
 void run()
          The maintenance thread for the servlet.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ParamFORMAT

public static final java.lang.String ParamFORMAT
The &format= parameter.
 
If provided, it's split into a beat and then a measure. The beat-measure delimiter is a '.'. See ParamBEAT and ParamMEASURE for more information.

See Also:
Constant Field Values

ParamMEASURE

public static final java.lang.String ParamMEASURE
The &measure= parameter.
 
The number of significant digits in the WRLDtime measure. That's the part of the WRLDtime code that comes before the delimiter -- eg. the 'hour' part. The measure may be left-padded with zeros to fill the significant digits (see ParamPADDING). The default value is 2; the maximum value is 2.

See Also:
Constant Field Values

ParamBEAT

public static final java.lang.String ParamBEAT
The &beat= parameter.
 
The number of significant digits in the WRLDtime beat. That's the part of the WRLDtime code that comes after the delimiter -- eg. the 'minute' part. The beat may be left-padded with zeros to fill the significant digits (see ParamPADDING). The default value is 2; the maximum value is 5 (which is milli-beat precision).

See Also:
Constant Field Values

ParamPADDING

public static final java.lang.String ParamPADDING
The &padding= parameter.
 
Acceptable values are ValuePADDING_YES and ValuePADDING_NO. The default value is ValuePADDING_DEFAULT.

See Also:
Constant Field Values

ParamDELIMITER

public static final java.lang.String ParamDELIMITER
The &delimiter= parameter.
 
The delimiter text, which goes between the WRLDtime beat and measure. The default value is '.'.

See Also:
Constant Field Values

ParamTEXTBEFORE

public static final java.lang.String ParamTEXTBEFORE
The &textbefore= parameter.
 
Optional text be prepended before the WRLDtime value.

See Also:
Constant Field Values

ParamTEXTAFTER

public static final java.lang.String ParamTEXTAFTER
The &textafter= parameter.
 
Optional text to be appended after the WRLDtime value.

See Also:
Constant Field Values

ParamTEXTTYPE

public static final java.lang.String ParamTEXTTYPE
The &texttype= parameter.
 
A text Content Type. The default value is 'plain', which results in 'text/plain' as a Content Type.

See Also:
Constant Field Values

ValuePADDING_DEFAULT

public static final java.lang.String ValuePADDING_DEFAULT
The 'default' &padding= parameter (ParamPADDING) setting.
 
The beat is NOT left-padded with zeros, but the measure is. Example: for a WRLDtime code of 8.8 and 2 significant digits, that'd be '8.08'.

See Also:
Constant Field Values

ValuePADDING_YES

public static final java.lang.String ValuePADDING_YES
The 'yes' &padding= parameter (ParamPADDING) setting.
 
Both the beat AND the measure are left-padded with zeros. Example: for a WRLDtime code of 8.8 and 2 significant digits, that'd be '08.08'.

See Also:
Constant Field Values

ValuePADDING_NO

public static final java.lang.String ValuePADDING_NO
The 'no' &padding= parameter (ParamPADDING) setting.
 
Neither the beat NOR the measure are left-padded with zeros. Example: for a WRLDtime code of 8.8 and 2 significant digits, that'd be '8.8'.

See Also:
Constant Field Values

ValueBEAT_DEFAULT

public static final java.lang.String ValueBEAT_DEFAULT
See Also:
Constant Field Values

ValueMEASURE_DEFAULT

public static final java.lang.String ValueMEASURE_DEFAULT
See Also:
Constant Field Values

ValueDELIMITER_DEFAULT

public static final java.lang.String ValueDELIMITER_DEFAULT
See Also:
Constant Field Values

ValueTEXTTYPE_DEFAULT

public static final java.lang.String ValueTEXTTYPE_DEFAULT
See Also:
Constant Field Values

ErrorNONE

public static final int ErrorNONE
See Also:
Constant Field Values

ErrorGENERIC

public static final int ErrorGENERIC
See Also:
Constant Field Values

ErrorBEAT

public static final int ErrorBEAT
See Also:
Constant Field Values

ErrorMEASURE

public static final int ErrorMEASURE
See Also:
Constant Field Values
Constructor Detail

WRLDtimeServlet

public WRLDtimeServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res)
           throws javax.servlet.ServletException,
                  java.io.IOException
The GET request processor for the servlet.
 
It pretty much just collects all the parameters, applies them and spits out a WRLD.time code. Not much interesting to describe here.
 
The best documentation example in the com.sleepbot.WRLDtime.app.* package is WRLDtimeApplet.

Throws:
javax.servlet.ServletException
java.io.IOException

init

public void init()
The initialization for the servlet.
 
This method:


run

public void run()
The maintenance thread for the servlet.
 
This method:

Specified by:
run in interface java.lang.Runnable

Sleepbot.com Java Classes

Copyright 1995-..   Lookit the Cat Productions