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

      • 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 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
      • 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 request
        location - suffix of url path
        Returns:
        Throws:
        IOException
        dap4.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:
        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
      • 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
      • printDMR

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