def do_POST(req, resp)
      # Split the path into piece
      path = req.path[1..-1].split('/')

      # We don't want to cache catflap login page so set response headers.
      # Chrome and FF respect the no-store, while IE respects no-cache.
      resp['Cache-Control'] = 'no-cache, no-store'
      resp['Pragma'] = 'no-cache' # Legacy
      resp['Expires'] = '-1' # Microsoft advises this for older IE browsers.

      response_class = CfRestService.const_get 'CfRestService'

      raise "#{response_class} not a Class" unless response_class.is_a?(Class)

      raise HTTPStatus::NotFound unless path[1]

      response_method = path[1].to_sym
      # Make sure the method exists in the class
      raise HTTPStatus::NotFound unless response_class
                                        .respond_to? response_method

      if :sync == response_method
        resp.body = response_class.send response_method, req, resp, @cf
      end

      if :knock == response_method
        resp.body = response_class.send response_method, req, resp, @cf
      end

      # Remaining path segments get passed in as arguments to the method
      if path.length > 2
        resp.body = response_class.send response_method, req, resp,
                                        @cf, path[1..-1]
      else
        resp.body = response_class.send response_method, req, resp, @cf
      end
      raise HTTPStatus::OK
    end
def do_POST(req, resp)
      # Split the path into piece
      path = req.path[1..-1].split('/')

      # We don't want to cache catflap login page so set response headers.
      # Chrome and FF respect the no-store, while IE respects no-cache.
      resp['Cache-Control'] = 'no-cache, no-store'
      resp['Pragma'] = 'no-cache' # Legacy
      resp['Expires'] = '-1' # Microsoft advises this for older IE browsers.

      response_class = CfRestService.const_get 'CfRestService'

      raise "#{response_class} not a Class" unless response_class.is_a?(Class)

      raise HTTPStatus::NotFound unless path[1]

      response_method = path[1].to_sym
      # Make sure the method exists in the class
      raise HTTPStatus::NotFound unless response_class
                                        .respond_to? response_method

      if :sync == response_method
        resp.body = response_class.send response_method, req, resp, @cf
      end

      if :knock == response_method
        resp.body = response_class.send response_method, req, resp, @cf
      end

      # Remaining path segments get passed in as arguments to the method
      if path.length > 2
        resp.body = response_class.send response_method, req, resp,
                                        @cf, path[1..-1]
      else
        resp.body = response_class.send response_method, req, resp, @cf
      end
      raise HTTPStatus::OK
    end
Initializer to construct a new CfApiServlet object.
 @param [HTTPServer] server a WEBrick HTTP server object.
 @param [Catflap] cf a fully instantiated Catflap object.
 @return void
 Implementation of HTTPServlet::AbstractServlet method to handle GET
 method requests.
 @param [HTTPRequest] req a WEBrick::HTTPRequest object.
 @param [HTTPResponse] resp a WEBrick::HTTPResponse object.
 @return void
 rubocop:disable Style/MethodName