Package dap4.servlet

Class DapRequest

java.lang.Object
dap4.servlet.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 Details

    • WEBINFPATH

      protected static final String WEBINFPATH
      See Also:
    • RESOURCEDIRNAME

      protected static final String RESOURCEDIRNAME
      See Also:
    • controller

      protected DapController controller
    • request

      protected jakarta.servlet.http.HttpServletRequest request
    • response

      protected jakarta.servlet.http.HttpServletResponse response
    • xuri

      protected dap4.core.util.XURI xuri
    • mode

      protected dap4.dap4lib.RequestMode mode
    • format

      protected dap4.core.util.ResponseFormat format
    • order

      protected ByteOrder order
    • checksummode

      protected dap4.core.util.ChecksumMode checksummode
    • datasetpath

      protected String datasetpath
    • dataset

      protected String dataset
  • Constructor Details

    • DapRequest

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

    • 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
    • getOrder

      public ByteOrder getOrder()
    • getChecksumMode

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

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

      public jakarta.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
    • getOutputStream

      public OutputStream getOutputStream() throws IOException
      Throws:
      IOException
    • 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
    • queryLookup

      public String queryLookup(String name)
    • getQueries

      public Map<String,String> getQueries()