[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
[0354]
[0355]
[0356]
[0357]
[0358]
[0359]
[0360]
[0361]
[0362]
[0363]
[0364]
[0365]
[0366]
[0367]
[0368]
[0369]
[0370]
[0371]
[0372]
[0373]
[0374]
[0375]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Thu Sep 03 01:10:48 CDT 1998 -->
<title>
  Class CGIplus
</title>
</head>
<body>
<a name="_top_"></a>
<h1>
  Class CGIplus
</h1>
<pre>
java.lang.Object
   |
   +----CGIplus
</pre>
<hr>
<dl>
  <dt> public class <b>CGIplus</b>
  <dt> extends Object
</dl>
This class allows CGI scripting to be supported relatively simply using
 Java.  Relies on the WASD HTTPd CGIplus environment providing the CGI
 variables in a data stream rather than as process environment variables.
 <P>
 Hence scripts must be activated via mapping rules that execute them within
 the CGIplus environment, although the scripts themselves do not have to
 "persist" in the usual CGIplus script manner, just "System.exit(0)" when
 finished processing (at the slight cost of destroying the subprocess).
 <P>
 Currently supports GET and "x-www-form-urlencoded" POST HTTP method scripts.
 Will be expanded to more fully support POST processing as time permits.
<p>
<dl>
  <dt> <b>Version:</b>
  <dd> 1.0.0, 09-DEC-97
  <dt> <b>Author:</b>
  <dd> MGD
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#CGIplus()"><b>CGIplus</b></a>()
  <dd> 
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#begin()"><b>begin</b></a>()
  <dd>  Begin script processing, and synchronize persistant (CGIplus) scripts.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#dumpBody()"><b>dumpBody</b></a>()
  <dd>  Output all lines in request body (for debugging POSTed requests, etc.)

 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#dumpCgiVar()"><b>dumpCgiVar</b></a>()
  <dd>  Output all CGI variable 'name=value' pairs (for debugging, etc.)

 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#dumpForm()"><b>dumpForm</b></a>()
  <dd>  Output all form 'field=value' pairs (for debugging, etc).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#end()"><b>end</b></a>()
  <dd>  Conclude the response.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getCgiVar(java.lang.String)"><b>getCgiVar</b></a>(String)
  <dd>  Return the value of the specified CGI variable name.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getCgiVarCount()"><b>getCgiVarCount</b></a>()
  <dd>  Return the number of CGI variables available.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getContentLength()"><b>getContentLength</b></a>()
  <dd>  Returns the content-length of the body for a POSTed request.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getContentType()"><b>getContentType</b></a>()
  <dd>  Returns the MIME content-type of the body of a POSTed request.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getFormField(java.lang.String)"><b>getFormField</b></a>(String)
  <dd>  Return the value of the specified form field name.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getFormFieldCount()"><b>getFormFieldCount</b></a>()
  <dd>  Return the number of form fields.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getUsageCount()"><b>getUsageCount</b></a>()
  <dd>  Return the number of times the script has been used.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isPOSTedForm()"><b>isPOSTedForm</b></a>()
  <dd>  Tests whether the request is POSTed and "www-form-urlencoded".
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextCgiVar()"><b>nextCgiVar</b></a>()
  <dd>  Successive calls return each CGI variable 'name=value' pair.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nextFormField()"><b>nextFormField</b></a>()
  <dd>  Successive calls return each form field 'name=value' pair.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#readBodyLine()"><b>readBodyLine</b></a>()
  <dd>  Read a line from the body of the request (for POSTed requests).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#urlDecode(java.lang.String)"><b>urlDecode</b></a>(String)
  <dd>  Decode the supplied URL-encoded string.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="CGIplus"></a>
<a name="CGIplus()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>CGIplus</b>
<pre>
 public CGIplus()
</pre>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="begin()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="begin"><b>begin</b></a>
<pre>
 public void begin()
</pre>
<dl>
  <dd> Begin script processing, and synchronize persistant (CGIplus) scripts.
 For the first call checks for the CGIPLUSEOF string (if not available
 reports it as an error and exits), then opens the CGIPLUSIN stream.
 Wait for a request to become available (first record read and discarded).
 Then read series of records up until the first empty record (indicates end
 of CGI variables), placing each of these records into a vector object for
 later search and retrieval.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> none
  </dl></dd>
</dl>
<a name="end()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="end"><b>end</b></a>
<pre>
 public void end()
</pre>
<dl>
  <dd> Conclude the response.
 Write the CGIplus end-of-output value to the server.
 Release any resources not relevant to next request (if CGIplus).
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> none
  </dl></dd>
</dl>
<a name="getUsageCount()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getUsageCount"><b>getUsageCount</b></a>
<pre>
 public int getUsageCount()
</pre>
<dl>
  <dd> Return the number of times the script has been used.
 Relevant only when behaving as a persistant, CGIplus script.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> none
  </dl></dd>
</dl>
<a name="getCgiVar(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getCgiVar"><b>getCgiVar</b></a>
<pre>
 public String getCgiVar(String varName)
</pre>
<dl>
  <dd> Return the value of the specified CGI variable name.
 It is less expensive but not mandatory to supply the the "WWW_" prefix.
 Returns null if the specified variable name does not exist.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> varName - the name of the CGI variable
    <dt> <b>Returns:</b>
    <dd> the CGI variable string
  </dl></dd>
</dl>
<a name="nextCgiVar()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextCgiVar"><b>nextCgiVar</b></a>
<pre>
 public String nextCgiVar()
</pre>
<dl>
  <dd> Successive calls return each CGI variable 'name=value' pair.
 Returns null and resets when the CGI variables are exhausted.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the 'name=value' string
  </dl></dd>
</dl>
<a name="getCgiVarCount()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getCgiVarCount"><b>getCgiVarCount</b></a>
<pre>
 public int getCgiVarCount()
</pre>
<dl>
  <dd> Return the number of CGI variables available.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> count of CGI variables
  </dl></dd>
</dl>
<a name="dumpCgiVar()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="dumpCgiVar"><b>dumpCgiVar</b></a>
<pre>
 public void dumpCgiVar()
</pre>
<dl>
  <dd> Output all CGI variable 'name=value' pairs (for debugging, etc.)
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> none
  </dl></dd>
</dl>
<a name="getContentType()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getContentType"><b>getContentType</b></a>
<pre>
 public String getContentType()
</pre>
<dl>
  <dd> Returns the MIME content-type of the body of a POSTed request.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> body content-type
  </dl></dd>
</dl>
<a name="isPOSTedForm()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isPOSTedForm"><b>isPOSTedForm</b></a>
<pre>
 public boolean isPOSTedForm()
</pre>
<dl>
  <dd> Tests whether the request is POSTed and "www-form-urlencoded".
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> true or false
  </dl></dd>
</dl>
<a name="getContentLength()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getContentLength"><b>getContentLength</b></a>
<pre>
 public int getContentLength()
</pre>
<dl>
  <dd> Returns the content-length of the body for a POSTed request.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> length of POSTed body
  </dl></dd>
</dl>
<a name="readBodyLine()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="readBodyLine"><b>readBodyLine</b></a>
<pre>
 public String readBodyLine()
</pre>
<dl>
  <dd> Read a line from the body of the request (for POSTed requests).
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the line (or null if body exhausted)
  </dl></dd>
</dl>
<a name="dumpBody()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="dumpBody"><b>dumpBody</b></a>
<pre>
 public void dumpBody()
</pre>
<dl>
  <dd> Output all lines in request body (for debugging POSTed requests, etc.)
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> none
  </dl></dd>
</dl>
<a name="dumpForm()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="dumpForm"><b>dumpForm</b></a>
<pre>
 public void dumpForm()
</pre>
<dl>
  <dd> Output all form 'field=value' pairs (for debugging, etc).
 For a 'x-www-form-urlencoded', POSTed request.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the 'name=value' string
  </dl></dd>
</dl>
<a name="getFormField(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getFormField"><b>getFormField</b></a>
<pre>
 public String getFormField(String fieldName)
</pre>
<dl>
  <dd> Return the value of the specified form field name. 
 Returns null if the specified field name does not exist.
 For a 'x-www-form-urlencoded', POSTed request.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> fieldName - the name of the field
    <dt> <b>Returns:</b>
    <dd> the (URL-decoded) field value
  </dl></dd>
</dl>
<a name="nextFormField()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nextFormField"><b>nextFormField</b></a>
<pre>
 public String nextFormField()
</pre>
<dl>
  <dd> Successive calls return each form field 'name=value' pair.
 Returns null and resets when the form fields are exhausted.
 For a 'x-www-form-urlencoded', POSTed request.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the 'name=value' string
  </dl></dd>
</dl>
<a name="getFormFieldCount()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getFormFieldCount"><b>getFormFieldCount</b></a>
<pre>
 public int getFormFieldCount()
</pre>
<dl>
  <dd> Return the number of form fields.
 For a 'x-www-form-urlencoded', POSTed request.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> count of fields in request
  </dl></dd>
</dl>
<a name="urlDecode(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="urlDecode"><b>urlDecode</b></a>
<pre>
 public String urlDecode(String estr)
</pre>
<dl>
  <dd> Decode the supplied URL-encoded string.
 Converts '+' into ' ' and "%nn" hex-encoded values into their ASCII
 characters.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> estr - the url-encoded string
    <dt> <b>Returns:</b>
    <dd> the decoded string
  </dl></dd>
</dl>
</body>
</html>