|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
opendap.servlet.AbstractServlet
public abstract class AbstractServlet
AbstractServlet is the base servlet class for an OPeNDAP servers. Default handlers for all of the acceptable OPeNDAP client requests are here.
Each of the request handlers appears as an adjunct method to the doGet() method of the base servlet class. In order to reduce the bulk of this file, many of these methods have been in wrapper classes in this package (opendap.servlet). This is an abstract class because it is left to the individual server development efforts to write the getDDS() and getServerVersion() methods. The getDDS() method is intended to be where the server specific OPeNDAP server data types are used via their associated class factory. This code relies on thejavax.servlet.ServletConfig
interface (in particular the getInitParameter()
method)
to record detailed configuration information used by
the servlet and it's children.
The servlet should be started in the servlet engine with the following
initParameters for the tomcat servlet engine:
<servlet> <servlet-name> dts </servlet-name> <servlet-class> opendap.servers.test.dts </servlet-class> <init-param> <param-name>INFOcache</param-name> <param-value>/home/Datasets/info</param-value> </init-param> <init-param> <param-name>DDScache</param-name> <param-value>/home/Datasets/dds</param-value> </init-param> <init-param> <param-name>DAScache</param-name> <param-value>/home/Datasets/das</param-value> </init-param> <init-param> <param-name>DDXcache</param-name> <param-value>/home/Datasets/ddx</param-value> </init-param> </servlet>Obviously the actual values of these parameters will depend on your particular file system.
processDodsURL()
could be overloaded
if some kind of special processing of the incoming request is needed
to ascertain the OPeNDAP URL information.
GetAsciiHandler
,
GetDirHandler
,
GetHTMLInterfaceHandler
,
GetInfoHandler
,
ReqState
,
ParsedRequest
,
GuardedDataset
,
testDataset
,
Serialized FormField Summary | |
---|---|
protected boolean |
allowDeflate
|
Constructor Summary | |
---|---|
AbstractServlet()
|
Method Summary | |
---|---|
void |
anyExceptionHandler(java.lang.Throwable e,
javax.servlet.http.HttpServletResponse response,
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(DAP2Exception de,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Sends a OPeNDAP DAP2 error to the client. |
void |
doDebug(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for debug requests; |
protected boolean |
doDebugCmd(java.lang.String cmd,
java.util.StringTokenizer tz,
java.io.PrintStream pw)
|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
*********************************************************************** Handles incoming requests from clients. |
void |
doGetASC(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for OPeNDAP ascii data requests. |
void |
doGetBLOB(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's data request. |
void |
doGetCatalog(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Default handler for OPeNDAP catalog.xml requests. |
void |
doGetDAP2Data(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's data request. |
void |
doGetDAS(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's DAS request. |
void |
doGetDDS(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's DDS request. |
void |
doGetDDX(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's DDS request. |
void |
doGetDIR(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for the client's directory request. |
void |
doGetHELP(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Default handler for the client's help request. |
void |
doGetHTML(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for OPeNDAP .html requests. |
void |
doGetINFO(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Default handler for OPeNDAP info requests. |
void |
doGetStatus(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Default handler for OPeNDAP status requests; not publically available, used only for debugging |
void |
doGetSystemProps(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Default handler for OPeNDAP status requests; not publically available, used only for debugging |
void |
doGetVER(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Default handler for the client's version request. |
protected abstract GuardedDataset |
getDataset(ReqState rs)
************************************************************************ This method must be implemented locally for each OPeNDAP server. |
java.lang.String |
getServerName()
************************************************************************ In this (default) implementation of the getServerName() method we just get the name of the servlet and pass it back. |
abstract java.lang.String |
getServerVersion()
************************************************************************ This function must be implemented locally for each OPeNDAP server. |
void |
init()
************************************************************************ Intitializes the servlet. |
void |
IOExceptionHandler(java.io.IOException e,
javax.servlet.http.HttpServletResponse response,
ReqState rs)
************************************************************************ Sends an error to the client. |
void |
parseExceptionHandler(ParseException pe,
javax.servlet.http.HttpServletResponse response)
************************************************************************ Turns a ParseException into a OPeNDAP DAP2 error and sends it to the client. |
protected void |
printCatalog(javax.servlet.http.HttpServletRequest request,
java.io.PrintWriter os)
|
protected void |
printStatus(java.io.PrintWriter os)
|
void |
probeRequest(java.io.PrintStream ps,
javax.servlet.http.HttpServletRequest request)
************************************************************************ 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(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String clientMsg,
java.lang.String serverMsg)
************************************************************************ Sends a OPeNDAP DAP2 error (type UNKNOWN ERROR) to the client and displays a message on the server console. |
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 |
Field Detail |
---|
protected boolean allowDeflate
Constructor Detail |
---|
public AbstractServlet()
Method Detail |
---|
public abstract java.lang.String getServerVersion()
protected abstract GuardedDataset getDataset(ReqState rs) throws DAP2Exception, java.io.IOException, ParseException
rs
- The ReqState object for this particular client request.
DAP2Exception
java.io.IOException
ParseException
ServerDDS
,
test_ServerFactory
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void parseExceptionHandler(ParseException pe, javax.servlet.http.HttpServletResponse response)
pe
- The ParseException
that caused the problem.response
- The HttpServletResponse
for the client.public void dap2ExceptionHandler(DAP2Exception de, javax.servlet.http.HttpServletResponse response)
de
- The OPeNDAP DAP2 exception that caused the problem.response
- The HttpServletResponse
for the client.public void IOExceptionHandler(java.io.IOException e, javax.servlet.http.HttpServletResponse response, ReqState rs)
e
- The exception that caused the problem.response
- The HttpServletResponse
for the client.public void anyExceptionHandler(java.lang.Throwable e, javax.servlet.http.HttpServletResponse response, ReqState rs)
e
- The exception that caused the problem.response
- The HttpServletResponse
for the client.public void sendDODSError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String clientMsg, java.lang.String serverMsg) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request object.response
- The server's HttpServletResponse
response object.clientMsg
- Error message String
to send to the client.serverMsg
- Error message String
to display on the server console.
java.io.IOException
javax.servlet.ServletException
public void doGetDAS(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
Once the DAS has been parsed it is sent to the requesting client.
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.
java.io.IOException
javax.servlet.ServletException
ReqState
public void doGetDDS(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
Once the DDS has been parsed and constrained it is sent to the requesting client.
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.
java.io.IOException
javax.servlet.ServletException
ReqState
public void doGetDDX(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
Once the DDS has been parsed and constrained it is sent to the requesting client.
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.
java.io.IOException
javax.servlet.ServletException
ReqState
public void doGetBLOB(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
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.
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.
java.io.IOException
javax.servlet.ServletException
ReqState
This class/method is associated with pre-release version of the DDX API. It is experimental and is subject to (significant) change.
public void doGetDAP2Data(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
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.
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.
java.io.IOException
javax.servlet.ServletException
ReqState
public void doGetDIR(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetDirHandler
public void doGetVER(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Returns a plain text document with server version and OPeNDAP core version #'s
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
public void doGetHELP(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Returns an html page of help info for the server
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
public void badURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
public void doGetASC(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.lang.Exception
request
- The client's HttpServletRequest
request object.response
- The server's HttpServletResponse
response object.rs
- the decoded Request State
java.lang.Exception
public void doGetINFO(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetInfoHandler
public void doGetHTML(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetHTMLInterfaceHandler
public void doGetCatalog(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetHTMLInterfaceHandler
protected void printCatalog(javax.servlet.http.HttpServletRequest request, java.io.PrintWriter os) throws java.io.IOException
java.io.IOException
public void doDebug(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ReqState rs) throws java.io.IOException
request
- The client's HttpServletRequest
request object.response
- The server's HttpServletResponse
response object.
java.io.IOException
protected boolean doDebugCmd(java.lang.String cmd, java.util.StringTokenizer tz, java.io.PrintStream pw)
public void doGetSystemProps(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetHTMLInterfaceHandler
public void doGetStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
GetHTMLInterfaceHandler
protected void printStatus(java.io.PrintWriter os) throws java.io.IOException
java.io.IOException
public void probeRequest(java.io.PrintStream ps, javax.servlet.http.HttpServletRequest request)
HttpServletRequest
from the client.
This method calls the get*
methods of the request and prints
the results to standard out.
request
- The HttpServletRequest
object to probe.public java.lang.String getServerName()
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
AbstractServlet
.
doGet
in class javax.servlet.http.HttpServlet
request
- The client's HttpServletRequest
request
object.response
- The server's HttpServletResponse
response
object.
java.io.IOException
javax.servlet.ServletException
ReqState
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |