All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oncore.Main

java.lang.Object
   |
   +----javax.servlet.GenericServlet
           |
           +----javax.servlet.http.HttpServlet
                   |
                   +----oncore.Main

public class Main
extends HttpServlet
Main servlet in the program. This handles almost all ( except the one which request student information ) the requests. Any servicing of query needs the user to have been authenticated before. Since HTTP is stateless the state of authentication is maintained by cookies ( cookies are handled by the class HttpServlet by itself, so that we need not write any code to do that ). All the data which may depend on the context is read from configuration file.


Constructor Index

 o Main()

Method Index

 o doGet(HttpServletRequest, HttpServletResponse)
Method which will get called when a user tries to access the servlet for the first time.
 o doPost(HttpServletRequest, HttpServletResponse)
Method which gets called every time use submits some query.
 o getServletInfo()
 o init(ServletConfig)
Method which does initialisation stuff in the Servlet.

Constructors

 o Main
 public Main()

Methods

 o init
 public void init(ServletConfig cfg) throws ServletException
Method which does initialisation stuff in the Servlet. This gets hajjaar things as startup parameters ( please refer he props file for details ) and create a new Configuration object to initialize all the fields of Configuration.

Parameters:
cfg - This is ServletConfig object passed to the method by servlet engine. This contains all initArgs.
Throws: ServletException
Thrown when kernel ( servlet ? ) panic ( ie fatal error ;-) occurs in initialisation.
Overrides:
init in class GenericServlet
 o doGet
 public void doGet(HttpServletRequest req,
                   HttpServletResponse res) throws ServletException, IOException
Method which will get called when a user tries to access the servlet for the first time. This method gets invoked when the browser sends http request of the form GET http://.../servlet/Main HTTP/1.1. This method just sends back the login page.

Parameters:
req - The request from user which requests initial page.
res - The response to be submitted to user.
Throws: ServletException
thrown when some problem with servlet engine.
Throws: IOException
thrown when socket I/O goes wrong.
Overrides:
doGet in class HttpServlet
 o doPost
 public void doPost(HttpServletRequest req,
                    HttpServletResponse res) throws ServletException, IOException
Method which gets called every time use submits some query. Servlet engine will automatically invoke this method whenever the browser submits the HTTP request in the format: POST http://.../servlet/Main HTTP/1.1 Very crucial method since this method decides to whom control should be transferred.

Parameters:
req - The request submitted to the servlet engine.
res - The response to be submitted to the user.
Throws: ServletException
Thrown when some fatal error occurs with the servlet.
Throws: IOException
Thrown when error in socket I/O occurs.
Overrides:
doPost in class HttpServlet
 o getServletInfo
 public String getServletInfo()
Overrides:
getServletInfo in class GenericServlet

All Packages  Class Hierarchy  This Package  Previous  Next  Index