Package dap4.servlet
Class DapController
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
dap4.servlet.DapController
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public abstract class DapController
extends jakarta.servlet.http.HttpServlet
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringstatic booleanstatic final longprotected static final Stringprotected static final Stringprotected static final String[]protected static final Stringprotected booleanprotected static booleanprotected static final Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddap4.core.util.DapContextbuildDapContext(DapRequest daprequest) computeDMRChecksums(CDMWrap c4, dap4.core.util.DapContext cxt) dap4.core.ce.CEConstraintconstrainDapContext(dap4.core.util.DapContext dapcxt, dap4.core.dmr.DapDataset dmr) protected abstract voiddoCapabilities(DapRequest drq, dap4.core.util.DapContext cxt) Process a capabilities request.protected voiddoData(DapRequest drq, dap4.core.util.DapContext cxt) Process a DataDMR request.protected voiddoDMR(DapRequest drq, dap4.core.util.DapContext cxt) Process a DMR request.protected voiddoDSR(DapRequest drq, dap4.core.util.DapContext cxt) Process a DSR request.protected abstract voidProcess a favicon request.abstract longGet the maximum # of bytes per requestprotected abstract CDMWrapgetCDMWrap(DapRequest drq) Obtain a wrapped CDM source (NetcdfDataset) to Provide a DAP4 APIprotected DapRequestgetRequestState(jakarta.servlet.http.HttpServletRequest rq, jakarta.servlet.http.HttpServletResponse rsp) Merge the servlet inputs into a single object for easier transport as well as adding value.abstract StringGet the servlet name (with no leading or trailing slashes)protected abstract StringGet the absolute address of the web-content directoryvoidhandleRequest(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) voidinit()voidInitialize servlet/controllerstatic StringprintDMR(dap4.core.dmr.DapDataset dmr) protected voidsenderror(DapRequest drq, int httpcode, Throwable t) Generate an error based on the parametersMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
DEBUG
public static boolean DEBUG -
BIG_ENDIAN
- See Also:
-
LITTLE_ENDIAN
- See Also:
-
IS_BIG_ENDIAN
protected static boolean IS_BIG_ENDIAN -
DMREXT
- See Also:
-
DATAEXT
- See Also:
-
DSREXT
- See Also:
-
ENDINGS
-
FAVICON
- See Also:
-
DEFAULTBINARYWRITELIMIT
public static final long DEFAULTBINARYWRITELIMIT- See Also:
-
initialized
protected boolean initialized -
webContentRoot
-
testDataRoot
-
-
Constructor Details
-
DapController
public DapController()
-
-
Method Details
-
printDMR
-
doFavicon
Process a favicon request.- Parameters:
icopath- The path to the iconcxt- The dap context- Throws:
IOException
-
doCapabilities
protected abstract void doCapabilities(DapRequest drq, dap4.core.util.DapContext cxt) throws IOException Process a capabilities request. Currently, does nothing (but see D4TSServlet.doCapabilities).- Parameters:
cxt- The dapontext- Throws:
IOException
-
getBinaryWriteLimit
public abstract long getBinaryWriteLimit()Get the maximum # of bytes per request- Returns:
- size
-
getServletID
Get the servlet name (with no leading or trailing slashes)- Returns:
- name
-
getWebContentRoot
Get the absolute address of the web-content directory- Parameters:
drq- dap request- Returns:
- the web content directory absolute path
- Throws:
IOExceptiondap4.core.util.DapException
-
getCDMWrap
Obtain a wrapped CDM source (NetcdfDataset) to Provide a DAP4 APIThis method assumes a resource on the local filesystem. Override this method to provide other request/dataset location mappings. *
- Parameters:
drq- DapRequest- Throws:
IOException- error obtaining the dataset described by the DapRequest
-
init
public void init()- Overrides:
initin classjakarta.servlet.GenericServlet
-
initialize
public void initialize()Initialize servlet/controller -
handleRequest
public void handleRequest(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException - Throws:
IOException
-
doDSR
Process a DSR request. * @param cxt The dap context- Throws:
IOException
-
doDMR
Process a DMR request.- Parameters:
cxt- The dap context- Throws:
IOException
-
doData
Process a DataDMR request. Note that if this throws an exception, then it has not yet started to output a response. It a response had been initiated, then the exception would produce an error chunk.* @param cxt The dap context
- Throws:
IOException
-
addCommonHeaders
- Throws:
dap4.core.util.DapException
-
getRequestState
protected DapRequest getRequestState(jakarta.servlet.http.HttpServletRequest rq, jakarta.servlet.http.HttpServletResponse rsp) throws IOException Merge the servlet inputs into a single object for easier transport as well as adding value.- Parameters:
rq- A Servlet request objectrsp- A Servlet response object- Returns:
- the union of the servlet request and servlet response arguments from the servlet engine.
- Throws:
IOException
-
senderror
Generate an error based on the parameters- Parameters:
drq- DapRequesthttpcode- 0 => no code specifiedt- exception that caused the error; may be null- Throws:
IOException
-
buildDapContext
public dap4.core.util.DapContext buildDapContext(DapRequest daprequest) throws dap4.core.util.DapException - Throws:
dap4.core.util.DapException
-
constrainDapContext
public dap4.core.ce.CEConstraint constrainDapContext(dap4.core.util.DapContext dapcxt, dap4.core.dmr.DapDataset dmr) throws dap4.core.util.DapException - Throws:
dap4.core.util.DapException
-
computeDMRChecksums
protected Map<dap4.core.dmr.DapVariable,Long> computeDMRChecksums(CDMWrap c4, dap4.core.util.DapContext cxt) throws dap4.core.util.DapException - Throws:
dap4.core.util.DapException
-