Package dap4.servlet

Class DapController

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public abstract class DapController
    extends javax.servlet.http.HttpServlet
    See Also:
    Serialized Form
    • Constructor Detail

      • DapController

        public DapController()
    • Method Detail

      • printDMR

        public static String printDMR​(dap4.core.dmr.DapDataset dmr)
      • doFavicon

        protected abstract void doFavicon​(String icopath,
                                          dap4.core.util.DapContext cxt)
                                   throws IOException
        Process a favicon request.
        Parameters:
        icopath - The path to the icon
        cxt - 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

        public abstract String getServletID()
        Get the servlet name (with no leading or trailing slashes)
        Returns:
        name
      • getWebContentRoot

        protected abstract String getWebContentRoot​(DapRequest drq)
                                             throws dap4.core.util.DapException
        Get the absolute address of the web-content directory
        Parameters:
        drq - dap request
        Returns:
        the web content directory absolute path
        Throws:
        IOException
        dap4.core.util.DapException
      • getResourcePath

        protected abstract String getResourcePath​(DapRequest drq,
                                                  String location)
                                           throws dap4.core.util.DapException
        Convert a URL path for a dataset into an absolute file path
        Parameters:
        drq - dap request
        location - suffix of url path
        Returns:
        path in a string builder so caller can extend.
        Throws:
        IOException
        dap4.core.util.DapException
      • init

        public void init()
        Overrides:
        init in class javax.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 dap4.core.util.DapException
        Throws:
        dap4.core.util.DapException
      • 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 object
        rsp - 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 - DapRequest
        httpcode - 0 => no code specified
        t - 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