Class ServletOperationSet<E extends Enum<?>,​O extends Enum<?>>

  • Direct Known Subclasses:
    PackageServlet.PackageOperationSet

    public class ServletOperationSet<E extends Enum<?>,​O extends Enum<?>>
    extends Object
    A set of operation for the implementation of one servlet based on different operations. This set manages the operation for the servlet and is a delegate for the servlet interface methods.
    • Constructor Detail

      • ServletOperationSet

        public ServletOperationSet​(E defaultExtension)
    • Method Detail

      • getOperation

        public ServletOperation getOperation​(org.apache.sling.api.SlingHttpServletRequest request,
                                             ServletOperationSet.Method method)
        Retrieves the servlet operation requested for the used HTTP method. Looks in the selectors for a operation and gives their implementation in the extensions context.
        Parameters:
        request - the servlet request
        method - the requested HTTP method
        Returns:
        the operation or 'null', if the requested combination of selector and extension has no implementation for the given HTTP method
      • getResource

        protected ResourceHandle getResource​(org.apache.sling.api.SlingHttpServletRequest request)
        the extension hook if the resource is not simply build by the suffix
      • doGet

        protected void doGet​(org.apache.sling.api.SlingHttpServletRequest request,
                             org.apache.sling.api.SlingHttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • doPost

        protected void doPost​(org.apache.sling.api.SlingHttpServletRequest request,
                              org.apache.sling.api.SlingHttpServletResponse response)
                       throws javax.servlet.ServletException,
                              IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • doPut

        protected void doPut​(org.apache.sling.api.SlingHttpServletRequest request,
                             org.apache.sling.api.SlingHttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • doDelete

        protected void doDelete​(org.apache.sling.api.SlingHttpServletRequest request,
                                org.apache.sling.api.SlingHttpServletResponse response)
                         throws javax.servlet.ServletException,
                                IOException
        Throws:
        javax.servlet.ServletException
        IOException
      • sendInvalidOperation

        public void sendInvalidOperation​(org.apache.sling.api.SlingHttpServletRequest request,
                                         org.apache.sling.api.SlingHttpServletResponse response,
                                         ServletOperationSet.Method method)
                                  throws IOException
        Throws:
        IOException