public class DTSServlet
extends opendap.servlet.AbstractServlet
Configuration:
The AbstractServlet relies on the javax.servlet.ServletConfig
interface (in particular the getInitParameter() method)
to retrieve configuration information used by the servlet.
InitParameters:
<servlet>
<servlet-name>
dts
</servlet-name>
<servlet-class>
opendap.servers.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>
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
DTSServlet()
************************************************************************
Intitializes the servlet.
|
| Modifier and Type | Method and Description |
|---|---|
void |
anyExceptionHandler(Throwable e,
opendap.servlet.ReqState rs)
Sends an error to the client.
|
void |
badURL(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sends an html document to the client explaining that they have used a
poorly formed URL and then the help page...
|
void |
dap2ExceptionHandler(opendap.dap.DAP2Exception de,
javax.servlet.http.HttpServletResponse response)
Sends a OPeNDAP DAP2 error to the client.
|
void |
doDebug(opendap.servlet.ReqState rs)
Handler for debug requests;
|
protected boolean |
doDebugCmd(String cmd,
StringTokenizer tz,
PrintStream pw) |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles incoming requests from clients.
|
void |
doGetASC(opendap.servlet.ReqState rs)
Handler for OPeNDAP ascii data requests.
|
void |
doGetBLOB(opendap.servlet.ReqState rs)
Handler for the client's data request.
|
void |
doGetCatalog(opendap.servlet.ReqState rs)
Handler for OPeNDAP catalog.xml requests.
|
void |
doGetDAP2Data(opendap.servlet.ReqState rs)
Handler for the client's data request.
|
void |
doGetDAS(opendap.servlet.ReqState rs)
Handler for the client's DAS request.
|
void |
doGetDDS(opendap.servlet.ReqState rs)
Handler for the client's DDS request.
|
void |
doGetDDX(opendap.servlet.ReqState rs)
Handler for the client's DDX request.
|
void |
doGetDIR(opendap.servlet.ReqState rs)
Handler for the client's directory request.
|
void |
doGetHELP(opendap.servlet.ReqState rs)
Handler for the client's help request.
|
void |
doGetHTML(opendap.servlet.ReqState rs)
Handler for OPeNDAP .html requests.
|
void |
doGetINFO(opendap.servlet.ReqState rs)
Handler for OPeNDAP info requests.
|
void |
doGetStatus(opendap.servlet.ReqState rs)
Handler for OPeNDAP status requests; not publically available,
used only for debugging
|
void |
doGetSystemProps(opendap.servlet.ReqState rs)
Handler for OPeNDAP status requests; not publically available,
used only for debugging
|
void |
doGetVER(opendap.servlet.ReqState rs)
Handler for the client's version request.
|
protected opendap.servlet.GuardedDataset |
getDataset(opendap.servlet.ReqState rs)
************************************************************************
This method must be implemented locally for each OPeNDAP server.
|
protected opendap.servlet.ReqState |
getRequestState(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
String |
getRootPath()
Getter function for rootpath
|
String |
getServerName()
In this (default) implementation of the getServerName() method we just get
the name of the servlet and pass it back.
|
String |
getServerVersion()
This method returns a String containing the OPeNDAP Server Version...
|
void |
init() |
void |
IOExceptionHandler(IOException e,
opendap.servlet.ReqState rs)
Sends an error to the client.
|
void |
parseExceptionHandler(opendap.dap.parsers.ParseException pe,
javax.servlet.http.HttpServletResponse response)
Turns a ParseException into a OPeNDAP DAP2 error and sends it to the client.
|
protected void |
printCatalog(opendap.servlet.ReqState rs,
PrintWriter os) |
protected void |
printStatus(PrintWriter os) |
void |
probeRequest(PrintStream ps,
opendap.servlet.ReqState rs)
This is a bit of instrumentation that I kept around to let me look at the
state of the incoming
HttpServletRequest from the client. |
void |
sendDODSError(opendap.servlet.ReqState rs,
String clientMsg,
String serverMsg)
Sends a OPeNDAP DAP2 error (type UNKNOWN ERROR) to the client and displays a
message on the server console.
|
badURL, doDebugCmd, printDODSException, printThrowable, probeRequest, sendDODSError, setLog, setRootpathdoDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, servicepublic DTSServlet()
public String getRootPath()
public String getServerVersion()
getServerVersion in class opendap.servlet.AbstractServletprotected opendap.servlet.GuardedDataset getDataset(opendap.servlet.ReqState rs)
throws opendap.dap.DAP2Exception,
IOException,
opendap.dap.parsers.ParseException
This method should do the following:
getDataset in class opendap.servlet.AbstractServletrs - The ReqState object for this particular client request.opendap.dap.DAP2ExceptionIOExceptionopendap.dap.parsers.ParseExceptionpublic void init()
throws javax.servlet.ServletException
init in class javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic void parseExceptionHandler(opendap.dap.parsers.ParseException pe,
javax.servlet.http.HttpServletResponse response)
parseExceptionHandler in class opendap.servlet.AbstractServletpe - The ParseException that caused the problem.response - The HttpServletResponse for the client.public void dap2ExceptionHandler(opendap.dap.DAP2Exception de,
javax.servlet.http.HttpServletResponse response)
dap2ExceptionHandler in class opendap.servlet.AbstractServletde - The OPeNDAP DAP2 exception that caused the problem.response - The HttpServletResponse for the client.public void IOExceptionHandler(IOException e, opendap.servlet.ReqState rs)
IOExceptionHandler in class opendap.servlet.AbstractServlete - The exception that caused the problem.rs - The ReqState for the client.public void anyExceptionHandler(Throwable e, opendap.servlet.ReqState rs)
anyExceptionHandler in class opendap.servlet.AbstractServlete - The exception that caused the problem.rs - The ReqState for the client.public void sendDODSError(opendap.servlet.ReqState rs,
String clientMsg,
String serverMsg)
throws Exception
rs - The client's ReqState object.clientMsg - Error message String to send to the client.serverMsg - Error message String to display on the server console.Exceptionpublic void doGetDAS(opendap.servlet.ReqState rs)
throws Exception
Once the DAS has been parsed it is sent to the requesting client.
doGetDAS in class opendap.servlet.AbstractServletrs - The ReqState of this client request. Contains all kinds of
important stuff.ExceptionReqStatepublic void doGetDDS(opendap.servlet.ReqState rs)
throws Exception
Once the DDS has been parsed and constrained it is sent to the requesting client.
doGetDDS in class opendap.servlet.AbstractServletrs - The ReqState of this client request. Contains all kinds of
important stuff.ExceptionReqStatepublic void doGetDDX(opendap.servlet.ReqState rs)
throws Exception
Once the DDX has been parsed and constrained it is sent to the requesting client.
doGetDDX in class opendap.servlet.AbstractServletrs - The ReqState of this client request. Contains all kinds of
important stuff.ExceptionReqStatepublic void doGetBLOB(opendap.servlet.ReqState rs)
throws Exception
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.
doGetBLOB in class opendap.servlet.AbstractServletrs - The ReqState of this client request. Contains all kinds of
important stuff.ExceptionReqStatepublic void doGetDAP2Data(opendap.servlet.ReqState rs)
throws Exception
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.
doGetDAP2Data in class opendap.servlet.AbstractServletrs - The ReqState of this client request. Contains all kinds of
important stuff.IOExceptionjavax.servlet.ServletExceptionExceptionReqStatepublic void doGetDIR(opendap.servlet.ReqState rs)
throws Exception
Returns an html document to the client showing (a possibly pseudo) listing of the datasets available on the server in a directory listing format.
The bulk of this code resides in the class opendap.servlet.GetDirHandler and documentation may be found there.
doGetDIR in class opendap.servlet.AbstractServletrs - The client's ReqStateExceptionGetDirHandlerpublic void doGetVER(opendap.servlet.ReqState rs)
throws Exception
Returns a plain text document with server version and OPeNDAP core version #'s
doGetVER in class opendap.servlet.AbstractServletrs - The client's ReqStateExceptionpublic void doGetHELP(opendap.servlet.ReqState rs)
throws Exception
Returns an html page of help info for the server
doGetHELP in class opendap.servlet.AbstractServletrs - The client's ReqState Exceptionpublic void badURL(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
request - The client's request response - The client responseExceptionpublic void doGetASC(opendap.servlet.ReqState rs)
throws Exception
Modified 2/8/07 jcaron to not make a DConnect2 call to itself
doGetASC in class opendap.servlet.AbstractServletrs - the decoded Request StateExceptionpublic void doGetINFO(opendap.servlet.ReqState rs)
throws Exception
The bulk of this code resides in the class opendap.servlet.GetInfoHandler and documentation may be found there.
doGetINFO in class opendap.servlet.AbstractServletrs - The client's ReqState ExceptionGetInfoHandlerpublic void doGetHTML(opendap.servlet.ReqState rs)
throws Exception
The bulk of this code resides in the class opendap.servlet.GetHTMLInterfaceHandler and documentation may be found there.
doGetHTML in class opendap.servlet.AbstractServletrs - The client's ReqStateExceptionGetHTMLInterfaceHandlerpublic void doGetCatalog(opendap.servlet.ReqState rs)
throws Exception
doGetCatalog in class opendap.servlet.AbstractServletrs - The client's ReqState ExceptionGetHTMLInterfaceHandlerprotected void printCatalog(opendap.servlet.ReqState rs,
PrintWriter os)
throws IOException
printCatalog in class opendap.servlet.AbstractServletIOExceptionpublic void doDebug(opendap.servlet.ReqState rs)
doDebug in class opendap.servlet.AbstractServletrs - The client's ReqState object.protected boolean doDebugCmd(String cmd, StringTokenizer tz, PrintStream pw)
public void doGetSystemProps(opendap.servlet.ReqState rs)
throws Exception
doGetSystemProps in class opendap.servlet.AbstractServletrs - The client's ReqState ExceptionGetHTMLInterfaceHandlerpublic void doGetStatus(opendap.servlet.ReqState rs)
throws Exception
doGetStatus in class opendap.servlet.AbstractServletrs - The client's ReqStateExceptionGetHTMLInterfaceHandlerprotected void printStatus(PrintWriter os)
printStatus in class opendap.servlet.AbstractServletpublic void probeRequest(PrintStream ps, opendap.servlet.ReqState rs)
HttpServletRequest from the client.
This method calls the get* methods of the request and prints
the results to standard out.ps - The PrintStream to send output.rs - The ReqState object to probe.public String getServerName()
In this (default) implementation of the getServerName() method we just get the name of the servlet and pass it back. If something different is required, override this method when implementing the getDDS() and getServerVersion() methods.
This is typically used by the getINFO() method to figure out if there is information specific to this server residing in the info directory that needs to be returned to the client as part of the .info rs.getResponse().
getServerName in class opendap.servlet.AbstractServletpublic void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method is the entry point for DTSServlet.
doGet in class opendap.servlet.AbstractServletrequest - The client's HttpServletRequest request
object.response - The server's HttpServletResponse response
object.ReqStateprotected opendap.servlet.ReqState getRequestState(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws opendap.dap.DAP2Exception
getRequestState in class opendap.servlet.AbstractServletrequest - opendap.dap.DAP2Exception