opendap.servers.test
Class dts

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by opendap.servlet.AbstractServlet
              extended by opendap.servers.test.dts
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class dts
extends AbstractServlet

Purpose:
This is the OPeNDAP Test servlet (dts). It allows the owner of the server to deliver data in ANY valid DDS to a client. This DDS will be filled with invented data if the client requests a DataDDS. This kind of test fixture is useful for evaluating a clients ability to handle the various complexities of the OPeNDAP data types.

Configuration:
The AbstractServlet relies on the javax.servlet.ServletConfig interface (in particular the getInitParameter() method) to retrieve configuration information used by the servlet. InitParameters:

Here is an example entry from the web.xml file (for tomcat3.3a) for the OPeNDAP Test Server (DTS):

         <servlet>
            <servlet-name>
                dts
            </servlet-name>
 

<servlet-class> opendap.servers.test.dts </servlet-class>

<init-param> <param-name>DebugOn</param-name> <param-value>showRequest showResponse </param-value> </init-param>

<init-param> <param-name>INFOcache</param-name> <param-value>/usr/Java-OPeNDAP/sdds-testsuite/info/</param-value> </init-param>

<init-param> <param-name>DDScache</param-name> <param-value>/usr/Java-OPeNDAP/sdds-testsuite/dds/</param-value> </init-param>

<init-param> <param-name>DAScache</param-name> <param-value>/usr/Java-OPeNDAP/sdds-testsuite/das/</param-value> </init-param> </servlet>

Version:
$Revision: 23881 $
Author:
Nathan David Potter
See Also:
Serialized Form

Field Summary
 
Fields inherited from class opendap.servlet.AbstractServlet
allowDeflate
 
Constructor Summary
dts()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          ************************************************************************ We override this crucial method from the parent servlet in order to force the client not to cache.
 void doGetASC(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs)
          ************************************************************************ Default handler for the client's data request.
 void doGetBLOB(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs)
          ************************************************************************ Default handler for the client's data request.
 void doGetDAP2Data(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs)
          ************************************************************************ Default handler for the client's data request.
protected  GuardedDataset getDataset(ReqState rs)
          ************************************************************************ This method must be implemented locally for each OPeNDAP server.
 java.lang.String getServerVersion()
          ************************************************************************ This method returns a String containing the OPeNDAP Server Version...
 void init()
          ************************************************************************ Intitializes the servlet.
 
Methods inherited from class opendap.servlet.AbstractServlet
anyExceptionHandler, badURL, dap2ExceptionHandler, doDebug, doDebugCmd, doGetCatalog, doGetDAS, doGetDDS, doGetDDX, doGetDIR, doGetHELP, doGetHTML, doGetINFO, doGetStatus, doGetSystemProps, doGetVER, getServerName, IOExceptionHandler, parseExceptionHandler, printCatalog, printStatus, probeRequest, sendDODSError
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, 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
 

Constructor Detail

dts

public dts()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Description copied from class: AbstractServlet
************************************************************************ Intitializes the servlet. Init (at this time) basically sets up the object opendap.util.Debug from the debuggery flags in the servlet InitParameters. The Debug object can be referenced (with impunity) from anywhere in the VM.

Overrides:
init in class AbstractServlet
Throws:
javax.servlet.ServletException

getServerVersion

public java.lang.String getServerVersion()
************************************************************************ This method returns a String containing the OPeNDAP Server Version...

Specified by:
getServerVersion in class AbstractServlet
Returns:
The Server Version String

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
************************************************************************ We override this crucial method from the parent servlet in order to force the client not to cache. This is achieved by setting the header tag "Last-Modified" to the current date and time.

Overrides:
doGet in class AbstractServlet
Parameters:
request - The client's HttpServletRequest request object.
response - The server's HttpServletResponse response object.
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
ReqState

doGetDAP2Data

public void doGetDAP2Data(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response,
                          ReqState rs)
                   throws java.io.IOException,
                          javax.servlet.ServletException
************************************************************************ Default handler for the client's data request. Requires the getDDS() method implemented by each server localization effort.

Once the DDS has been parsed, the data is read (using the class in the localized server factory etc.), compared to the constraint expression, and then sent to the client.

Overrides:
doGetDAP2Data in class AbstractServlet
Parameters:
request - The client's HttpServletRequest request object.
response - The server's HttpServletResponse response object.
rs - The ReqState of this client request. Contains all kinds of important stuff.
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
ReqState

doGetASC

public void doGetASC(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     ReqState rs)
              throws java.lang.Exception
************************************************************************ Default handler for the client's data request. Requires the getDDS() method implemented by each server localization effort.

Once the DDS has been parsed, the data is read (using the class in the localized server factory etc.), compared to the constraint expression, and then sent to the client.

Overrides:
doGetASC in class AbstractServlet
Parameters:
request - The client's HttpServletRequest request object.
response - The server's HttpServletResponse response object.
rs - the decoded Request State
Throws:
java.lang.Exception

doGetBLOB

public void doGetBLOB(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      ReqState rs)
               throws java.io.IOException,
                      javax.servlet.ServletException
************************************************************************ Default handler for the client's data request. Requires the getDDS() method implemented by each server localization effort.

Once the DDS has been parsed, the data is read (using the class in the localized server factory etc.), compared to the constraint expression, and then sent to the client.

Overrides:
doGetBLOB in class AbstractServlet
Parameters:
request - The client's HttpServletRequest request object.
response - The server's HttpServletResponse response object.
rs - The ReqState of this client request. Contains all kinds of important stuff.
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
ReqState

This class/method is associated with pre-release version of the DDX API. It is experimental and is subject to (significant) change.


getDataset

protected GuardedDataset getDataset(ReqState rs)
                             throws DAP2Exception,
                                    java.io.IOException,
                                    ParseException
Description copied from class: AbstractServlet
************************************************************************ This method must be implemented locally for each OPeNDAP server. The local implementation of this method is the key piece for connecting any localized data types that are derived from the opendap.dap.Server types back into the running servlet.

This method should do the following:

Specified by:
getDataset in class AbstractServlet
Parameters:
rs - The ReqState object for this particular client request.
Returns:
The ServerDDS object all parsed and ready to roll.
Throws:
DAP2Exception
java.io.IOException
ParseException
See Also:
ServerDDS, test_ServerFactory