Package dap4.servlet
Class DapController
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- dap4.servlet.DapController
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public abstract class DapController extends javax.servlet.http.HttpServlet- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringBIG_ENDIANprotected static DapCachecacheprotected static StringDATAEXTstatic booleanDEBUGstatic longDEFAULTBINARYWRITELIMITprotected static StringDMREXTprotected static StringDSREXTstatic booleanDUMPDATAstatic booleanDUMPDMRprotected static String[]ENDINGSprotected static StringFAVICONprotected booleaninitializedprotected static booleanIS_BIG_ENDIANprotected static StringLITTLE_ENDIANstatic booleanPARSEDEBUGstatic booleanTESTING
-
Constructor Summary
Constructors Constructor Description DapController()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddCommonHeaders(DapRequest drq)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 voiddoFavicon(String icopath, dap4.core.util.DapContext cxt)Process a favicon request.abstract longgetBinaryWriteLimit()Get the maximum # of bytes per requestprotected static DapCachegetCache()protected DapRequestgetRequestState(javax.servlet.http.HttpServletRequest rq, javax.servlet.http.HttpServletResponse rsp)Merge the servlet inputs into a single object for easier transport as well as adding value.abstract StringgetResourcePath(DapRequest drq, String location)Convert a URL path into an absolute file path Note that it is assumed than any leading servlet prefix has been removed.abstract StringgetServletID()Get the servlet name (with no leading or trailing slashes)voidhandleRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)voidinit()voidinitialize()Initialize servlet/controllerstatic StringprintDMR(dap4.core.dmr.DapDataset dmr)protected voidsenderror(DapRequest drq, int httpcode, Throwable t)Generate an error based on the parametersprotected static voidsetCache(DapCache cache)-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
TESTING
public static boolean TESTING
-
DEBUG
public static boolean DEBUG
-
DUMPDMR
public static boolean DUMPDMR
-
DUMPDATA
public static boolean DUMPDATA
-
PARSEDEBUG
public static boolean PARSEDEBUG
-
BIG_ENDIAN
protected static final String BIG_ENDIAN
- See Also:
- Constant Field Values
-
LITTLE_ENDIAN
protected static final String LITTLE_ENDIAN
- See Also:
- Constant Field Values
-
IS_BIG_ENDIAN
protected static boolean IS_BIG_ENDIAN
-
DMREXT
protected static final String DMREXT
- See Also:
- Constant Field Values
-
DATAEXT
protected static final String DATAEXT
- See Also:
- Constant Field Values
-
DSREXT
protected static final String DSREXT
- See Also:
- Constant Field Values
-
ENDINGS
protected static final String[] ENDINGS
-
FAVICON
protected static final String FAVICON
- See Also:
- Constant Field Values
-
DEFAULTBINARYWRITELIMIT
public static final long DEFAULTBINARYWRITELIMIT
- See Also:
- Constant Field Values
-
cache
protected static DapCache cache
-
initialized
protected boolean initialized
-
-
Method Detail
-
setCache
protected static void setCache(DapCache cache)
-
getCache
protected static DapCache getCache()
-
doFavicon
protected abstract void doFavicon(String icopath, dap4.core.util.DapContext cxt) throws IOException
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
-
getResourcePath
public abstract String getResourcePath(DapRequest drq, String location) throws dap4.core.util.DapException
Convert a URL path into an absolute file path Note that it is assumed than any leading servlet prefix has been removed.- Parameters:
drq- dap requestlocation- suffix of url path- Returns:
- Throws:
IOExceptiondap4.core.util.DapException
-
getBinaryWriteLimit
public abstract long getBinaryWriteLimit()
Get the maximum # of bytes per request- Returns:
- size
-
getServletID
public abstract String getServletID()
Get the servlet name (with no leading or trailing slashes)- Returns:
- name
-
init
public void init()
- Overrides:
initin classjavax.servlet.GenericServlet
-
initialize
public void initialize()
Initialize servlet/controller
-
handleRequest
public void handleRequest(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException- Throws:
IOException
-
doDSR
protected void doDSR(DapRequest drq, dap4.core.util.DapContext cxt) throws IOException
Process a DSR request. * @param cxt The dap context- Throws:
IOException
-
doDMR
protected void doDMR(DapRequest drq, dap4.core.util.DapContext cxt) throws IOException
Process a DMR request.- Parameters:
cxt- The dap context- Throws:
IOException
-
doData
protected void doData(DapRequest drq, dap4.core.util.DapContext cxt) throws IOException
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
protected void addCommonHeaders(DapRequest drq) throws IOException
- Throws:
IOException
-
getRequestState
protected DapRequest getRequestState(javax.servlet.http.HttpServletRequest rq, javax.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
protected void senderror(DapRequest drq, int httpcode, Throwable t) throws IOException
Generate an error based on the parameters- Parameters:
drq- DapRequesthttpcode- 0=>no code specifiedt- exception that caused the error; may be null- Throws:
IOException
-
printDMR
public static String printDMR(dap4.core.dmr.DapDataset dmr)
-
-