Class DbServlet

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    @WebServlet(asyncSupported=true)
    public class DbServlet
    extends javax.servlet.http.HttpServlet
    See Also:
    Serialized Form
    • Method Detail

      • init

        public void init​(javax.servlet.ServletConfig servletConfig)
                  throws javax.servlet.ServletException
        Called by the servlet container to indicate to a servlet that the servlet is being placed into service. The servlet container calls the init method exactly once after instantiating the servlet. The init method must complete successfully before the servlet can receive any requests. The servlet container cannot place the servlet into service if the init method
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Parameters:
        servletConfig - a servlet configuration object used by a servlet container to pass information to a servlet during initialization. Throws a ServletException Does not return within a time period defined by the Web server
        Throws:
        javax.servlet.ServletException
      • openInstance

        private void openInstance​(java.lang.String instanceName,
                                  java.util.List<java.lang.String> initList)
                           throws java.lang.Exception
        Open database connection instance
        Parameters:
        instanceDir -
        Throws:
        java.lang.Exception
      • destroy

        public void destroy()
        Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet container calls this method, it will not call the service method again on this servlet. This method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the servlet's current state in memory.
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class javax.servlet.GenericServlet
      • service

        protected void service​(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               java.io.IOException
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doOptions

        protected void doOptions​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
        Overrides:
        doOptions in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             java.io.IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doPost

        public void doPost​(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws javax.servlet.ServletException,
                           java.io.IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doDbRequest

        private void doDbRequest​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • getInstanceAndOperation

        private static java.lang.String[] getInstanceAndOperation​(javax.servlet.http.HttpServletRequest request)
        Extract instance name from request
        Parameters:
        request - - HttpServletRequest request
        Returns:
        - empty array if instance was not specified in URL - array with single element (instance name) if operation was not specified in URL - array with two elements (instance name and operation) if instance name and operation was specified in URL
      • authorizationError

        private static void authorizationError​(javax.servlet.http.HttpServletResponse response,
                                               java.lang.String message)
                                        throws java.io.IOException
        Parameters:
        response -
        message -
        Throws:
        java.io.IOException