Class ApiResource

    • Constructor Summary

      Constructors 
      Constructor Description
      ApiResource​(ApiSignature signature)
      Creates an instance with a given signature.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accepts​(HttpExtension.Method method, String type)
      Returns true if this resource accepts a given media type for a given method.
      void doDelete​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doHead​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doOptions​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doPut​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doTrace​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      Set<Exclude> excludes()
      Returns the set of request paths that should be excluded from request management.
      static ApiSignature handles​(String mapping)
      Returns a ApiSignature that declares the method and media types handled by an ApiResource for a given mapping.
      static ApiMethodSignature method​(HttpExtension.Method method)
      Returns an ApiMethodSignature that declares the media types handled by an ApiResource for a given method.
      boolean produces​(HttpExtension.Method method, String type)
      Returns true if this resource produces a given media type for a given method.
      ApiSignature signature()
      Return the signature of this resource.
      boolean supports​(HttpExtension.Method method)
      Returns true if this resource supports a given method.
      • Methods inherited from class javax.servlet.http.HttpServlet

        getLastModified, service, service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
      • Methods inherited from interface javax.servlet.Servlet

        destroy, getServletConfig, getServletInfo, init, service
    • Constructor Detail

      • ApiResource

        public ApiResource​(ApiSignature signature)
        Creates an instance with a given signature.
        Parameters:
        signature - the signature
    • Method Detail

      • handles

        public static ApiSignature handles​(String mapping)
        Returns a ApiSignature that declares the method and media types handled by an ApiResource for a given mapping.
        Parameters:
        mapping - the mapping
        Returns:
        the signature
      • supports

        public boolean supports​(HttpExtension.Method method)
        Returns true if this resource supports a given method.
        Parameters:
        method - the method
        Returns:
        true if this resource supports the given method
      • accepts

        public boolean accepts​(HttpExtension.Method method,
                               String type)
        Returns true if this resource accepts a given media type for a given method.
        Parameters:
        method - the method
        type - the media type
        Returns:
        true if this resource accepts the given media type for the given method
      • produces

        public boolean produces​(HttpExtension.Method method,
                                String type)
        Returns true if this resource produces a given media type for a given method.
        Parameters:
        method - the method
        type - the media type
        Returns:
        true if this resource produces the given media type for the given method
      • signature

        public ApiSignature signature()
        Return the signature of this resource.
        Returns:
        the signature
      • doHead

        public void doHead​(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           IOException
        Overrides:
        doHead in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doGet

        public void doGet​(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse resp)
                   throws javax.servlet.ServletException,
                          IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doPost

        public void doPost​(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doPut

        public void doPut​(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse resp)
                   throws javax.servlet.ServletException,
                          IOException
        Overrides:
        doPut in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doDelete

        public void doDelete​(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doDelete in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doOptions

        public void doOptions​(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException
        Overrides:
        doOptions in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doTrace

        public void doTrace​(javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse resp)
                     throws javax.servlet.ServletException,
                            IOException
        Overrides:
        doTrace in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException