Package thredds.server.opendap
Class OpendapServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- thredds.server.opendap.servlet.AbstractServlet
-
- thredds.server.opendap.OpendapServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,org.springframework.beans.factory.InitializingBean
@Controller @RequestMapping("/dods") public class OpendapServlet extends AbstractServlet implements org.springframework.beans.factory.InitializingBeanTHREDDS opendap server.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description OpendapServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voiddap2ExceptionHandler(opendap.dap.DAP2Exception de, ReqState rs)voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handles incoming requests from clients.voiddoGetASC(ReqState rs)Default handler for OPeNDAP ascii data requests.voiddoGetBLOB(ReqState rs)Default handler for the client's data request.voiddoGetDAP2Data(ReqState rs)Default handler for the client's data request.voiddoGetDAS(ReqState rs)Default handler for the client's DAS request.voiddoGetDDS(ReqState rs)Default handler for the client's DDS request.voiddoGetDDX(ReqState rs)Default handler for the client's DDS request.voiddoGetDIR(ReqState rs)Default handler for the client's directory request.voiddoGetHELP(ReqState rs)Default handler for the client's help request.voiddoGetHTML(ReqState rs)Default handler for OPeNDAP .html requests.voiddoGetINFO(ReqState rs)Default handler for OPeNDAP info requests.voiddoGetVER(ReqState rs)Default handler for the client's version request.protected GuardedDatasetgetDataset(ReqState preq)This method must be implemented locally for each OPeNDAP server.protected longgetLastModified(javax.servlet.http.HttpServletRequest req)protected ReqStategetRequestState(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)StringgetServerName()In this (default) implementation of the getServerName() method we just get the name of the servlet and pass it back.StringgetServerVersion()This function must be implemented locally for each OPeNDAP server.voidparseExceptionHandler(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 voidprintBadURLPage(PrintWriter pw)Prints the Bad URL Page page to the passed PrintWriter-
Methods inherited from class thredds.server.opendap.servlet.AbstractServlet
anyExceptionHandler, badURL, dap2ExceptionHandler, doDebug, doDebugCmd, doGetCatalog, doGetStatus, doGetSystemProps, IOExceptionHandler, parseConstraint, printCatalog, printStatus, printThrowable, probeRequest, sendDODSError, setLog
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service
-
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getServerVersion
public String getServerVersion()
Description copied from class:AbstractServletThis function must be implemented locally for each OPeNDAP server. It should return a String containing the OPeNDAP Server Version...- Specified by:
getServerVersionin classAbstractServlet- Returns:
- The Server Version String
-
getLastModified
protected long getLastModified(javax.servlet.http.HttpServletRequest req)
- Overrides:
getLastModifiedin classjavax.servlet.http.HttpServlet
-
doGet
@RequestMapping(value="**", method=GET) public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Description copied from class:AbstractServletHandles incoming requests from clients. Parses the request and determines what kind of OPeNDAP response the client is requesting. If the request is understood, then the appropriate handler method is called, otherwise an error is returned to the client. This method is the entry point forAbstractServlet.- Overrides:
doGetin classAbstractServlet- Parameters:
request- The client'sHttpServletRequestrequest object.response- The server'sHttpServletResponseresponse object.- See Also:
ReqState
-
doGetASC
public void doGetASC(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for OPeNDAP ascii data requests. Returns the request data as a comma delimited ascii file. Note that this means that the more complex OPeNDAP structures such as Grids get flattened... Modified 2/8/07 jcaron to not make a DConnect2 call to itself- Overrides:
doGetASCin classAbstractServlet- Parameters:
rs- the decoded Request State- Throws:
Exception
-
doGetDAS
public void doGetDAS(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's DAS request. Operates on the assumption that the DAS information is cached on a disk local to the server. If you don't like that, then you better override it in your server :)Once the DAS has been parsed it is sent to the requesting client.
- Overrides:
doGetDASin classAbstractServlet- Parameters:
rs- The ReqState of this client request. Contains all kinds of important stuff.- Throws:
Exception- See Also:
ReqState
-
doGetDDS
public void doGetDDS(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's DDS request. Requires the getDDS() method implemented by each server localization effort.Once the DDS has been parsed and constrained it is sent to the requesting client.
- Overrides:
doGetDDSin classAbstractServlet- Parameters:
rs- The ReqState of this client request. Contains all kinds of important stuff.- Throws:
Exception- See Also:
ReqState
-
doGetDDX
public void doGetDDX(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's DDS request. Requires the getDDS() method implemented by each server localization effort.Once the DDS has been parsed and constrained it is sent to the requesting client.
- Overrides:
doGetDDXin classAbstractServlet- Parameters:
rs- The ReqState of this client request. Contains all kinds of important stuff.- Throws:
Exception- See Also:
ReqState
-
doGetBLOB
public void doGetBLOB(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault 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:
doGetBLOBin classAbstractServlet- Parameters:
rs- The ReqState of this client request. Contains all kinds of important stuff.- Throws:
Exception- See Also:
ReqState
-
doGetDAP2Data
public void doGetDAP2Data(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault 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:
doGetDAP2Datain classAbstractServlet- Parameters:
rs- The ReqState of this client request.- Throws:
Exception
-
doGetVER
public void doGetVER(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's version request.Returns a plain text document with server version and OPeNDAP core version #'s
- Overrides:
doGetVERin classAbstractServlet- Parameters:
rs- The client'sReqState- Throws:
Exception
-
doGetHELP
public void doGetHELP(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's help request. Returns an html page of help info for the server- Overrides:
doGetHELPin classAbstractServlet- Parameters:
rs- The client'sReqState- Throws:
Exception
-
doGetDIR
public void doGetDIR(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for the client's directory request. 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.- Overrides:
doGetDIRin classAbstractServlet- Parameters:
rs- The client'sReqState- Throws:
Exception- See Also:
GetDirHandler
-
doGetINFO
public void doGetINFO(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for OPeNDAP info requests. Returns an HTML document describing the contents of the servers datasets.- Overrides:
doGetINFOin classAbstractServlet- Parameters:
rs- The client'sReqState- Throws:
Exception- See Also:
GetInfoHandler
-
doGetHTML
public void doGetHTML(ReqState rs) throws Exception
Description copied from class:AbstractServletDefault handler for OPeNDAP .html requests. Returns the OPeNDAP Web Interface (aka The Interface From Hell) to the client. The bulk of this code resides in the class opendap.servlet.GetHTMLInterfaceHandler and documentation may be found there.- Overrides:
doGetHTMLin classAbstractServlet- Parameters:
rs- The client'sReqState- Throws:
Exception- See Also:
GetHTMLInterfaceHandler
-
getServerName
public String getServerName()
Description copied from class:AbstractServletIn 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().- Overrides:
getServerNamein classAbstractServlet- Returns:
- A string containing the name of the servlet class that is running.
-
printBadURLPage
protected void printBadURLPage(PrintWriter pw)
Prints the Bad URL Page page to the passed PrintWriter- Overrides:
printBadURLPagein classAbstractServlet- Parameters:
pw- PrintWriter stream to which to dump the bad URL page.
-
getRequestState
protected ReqState getRequestState(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
- Overrides:
getRequestStatein classAbstractServlet- Returns:
- the request state
-
getDataset
protected GuardedDataset getDataset(ReqState preq) throws Exception
Description copied from class:AbstractServletThis 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.server types back into the running servlet. This method should do the following:- Make a new ServerFactory (aka BaseTypeFactory) for the dataset requested.
- Instantiate a ServerDDS using the ServerFactory and populate it (this could be accomplished by just opening a (cached?) DDS in a file and parsing it)
- Return this freshly minted ServerDDS object (to the servlet code where it is used.)
- Specified by:
getDatasetin classAbstractServlet- Parameters:
preq- The ReqState object for this particular client request.- Returns:
- A GuardedDataset object cintaininb the parsed DAS and DDS.
- Throws:
Exception
-
parseExceptionHandler
public void parseExceptionHandler(opendap.dap.parsers.ParseException pe, javax.servlet.http.HttpServletResponse response)Description copied from class:AbstractServletTurns a ParseException into a OPeNDAP DAP2 error and sends it to the client.- Overrides:
parseExceptionHandlerin classAbstractServlet- Parameters:
pe- TheParseExceptionthat caused the problem.response- TheHttpServletResponsefor the client.
-
dap2ExceptionHandler
public void dap2ExceptionHandler(opendap.dap.DAP2Exception de, ReqState rs)
-
-