Implementation of PRePServlet

    First of all the init() method of the PRePServlet will be called from the servletrunner. There a new PRePHandler (providePRePHandler()) will be created as well as the ConnectionPool initialised (default values). You may specify (if you create a subclass) how many connections you will need for your servlet. The default size is 5.

    As soon as a request from the servletrunner arrives, the handle() method of the PRePServlet is called. This method handles the request and does everything from setting the PrintWriter to the login and finally output of the PRePFile. It is build out of different methods which all work over the PRePHandler. The PRePHandler is unique - unlike the PRePMain which is given to the PRePServlet at the beginning. It will be deleted after the handle() method finished.

    If the servletrunner closes, it calls the destroy() method of the PRePServlet class which itself calls the destroy() method of the PRePHandler class. The ConnectionPool will be destroyed and its connection closed one for one.

    Constructor:

    Methods:

    init(ServletConfig servletConfig)
    calls the method provideHandler() and the setDatabaseConnection() method

    handle(HttpServletRequest req, HttpServletResponse res)
    calls different methods to handle the servletrunner's request. It first will get a PRePMain object and create a new Instance object which will contain the PRePMain, the HttpServletRequest and the HttpServletResponse object.

    getPRePMain()
    gets a new PRePMain object

    setPrintWriter(Instance instance)
    gets the PrintWriter of the HttpServletRequest and calls the setPrintWriter() method of the PrePHandler class

    putPRePTags(Instance instance)
    calls the putPRePTags() method of the PRePHandler class

    setParams(Instance instance)
    calls the putField() method of the PRePHandler class for each incoming PRePTag of the HttpServletRequest

    setCookies(Instance instance)
    calls the putField() method of the PRePHandler class for each incoming cookie

    setContext(Instance instance)
    sets the context of the HttpServletResponse to a specified format (most likely "text/html")

    getNewCookies(Instance instance)
    will call the getNewCookies() method of the PRePHandler which returns an array of objects (cookies). Then it will provoke the putField() method for each cookie.

    loginOk(Instance instance)
    will call the loginOk() method of the PRePHandler class

    loginNotOk(Instance instance)
    will call the loginNotOk() method of the PRePHandler class

    finishHandle(Instance instance)
    will call the finishHandle() method of the PRePHandler class

    destroy()
    is automatically called by the servletrunner and calls the destroy() method of the PRePHandler

    Related sites:
Other information about PRePServlet
Back