Package dap4.servlet

Class DapRequest


  • public class DapRequest
    extends Object
    User requests get cached here so that downstream code can access the details of the request information.

    Modified by Heimbigner for DAP4.

    • Field Detail

      • request

        protected javax.servlet.http.HttpServletRequest request
      • response

        protected javax.servlet.http.HttpServletResponse response
      • xuri

        protected dap4.core.util.XURI xuri
      • mode

        protected dap4.dap4lib.RequestMode mode
      • format

        protected dap4.core.util.ResponseFormat format
      • checksummode

        protected dap4.core.util.ChecksumMode checksummode
      • datasetpath

        protected String datasetpath
      • dataset

        protected String dataset
    • Constructor Detail

      • DapRequest

        public DapRequest​(DapController controller,
                          javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws dap4.core.util.DapException
        Throws:
        dap4.core.util.DapException
    • Method Detail

      • parseURI

        protected void parseURI()
                         throws IOException
        The goal of parse() is to extract info from the underlying HttpRequest and cache it in this object.

        In particular, the incoming URL needs to be decomposed into multiple pieces. Certain assumptions are made: 1. every incoming url is of the form (a) http(s)://host:port/d4ts/ or (b) http(s)://host:port/d4ts/?query Case a indicates that the front page is to be returned. Case b indicates a request for a dataset (or dsr), and its value is determined by its extensions. The query may be absent. We want to extract the following pieces. 1. (In URI parlance) The scheme plus the authority: http://host:port 3. The return type: depending on the last extension (e.g. ".txt"). 4. The requested value: depending on the next to last extension (e.g. ".dap"). 5. The suffix path specifying the actual dataset: datasetpath with return and request type extensions removed. 6. The url path = servletpath + datasetpath. 7. The query part.

        Throws:
        IOException
      • getChecksumMode

        public dap4.core.util.ChecksumMode getChecksumMode()
      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
      • getResponse

        public javax.servlet.http.HttpServletResponse getResponse()
      • getWebContentRoot

        public String getWebContentRoot()
                                 throws dap4.core.util.DapException
        Throws:
        dap4.core.util.DapException
      • getServletID

        public String getServletID()
                            throws dap4.core.util.DapException
        Throws:
        dap4.core.util.DapException
      • getResourcePath

        public String getResourcePath​(String location)
                               throws dap4.core.util.DapException
        Convert a URL path for a dataset into an absolute file path
        Parameters:
        location - suffix of url path
        Returns:
        path in a string builder so caller can extend.
        Throws:
        IOException
        dap4.core.util.DapException
      • getWebContentPath

        public String getWebContentPath​(String location)
                                 throws dap4.core.util.DapException
        Convert a URL path for a web-content related file into an absolute file path
        Parameters:
        location - suffix of url path
        Returns:
        path in a string builder so caller can extend.
        Throws:
        IOException
        dap4.core.util.DapException
      • getURL

        public String getURL()
      • getDatasetPath

        public String getDatasetPath()
      • getDataset

        public String getDataset()
      • getMode

        public dap4.dap4lib.RequestMode getMode()
      • getFormat

        public dap4.core.util.ResponseFormat getFormat()
      • setResponseHeader

        public void setResponseHeader​(String name,
                                      String value)
        Set a request header
        Parameters:
        name - the header name
        value - the header value