Fundamentals
-------------------------------------------------------------------------------------------------------------------
DataTypes                             Identifiers                        Literals                        JavaKeyords
Variable                                Arrays                                Operators                   TypeCasting
FlowControl                        Coding Standards           imports,package      mainMethod,args
Access Modifiers                var-argMethod               AbstructClass          GarbageCollection
InnerClass                            Interface                           Assertions                java execution flow
super,this
java.lang
-------------------------------------------------------------------------------------------------------------------
Class,Object Classes          Enum                                  String                          StringBuffer,StringBuilder
Cloneable,Comparable      Wrapper Classes           Math class                Autoboxing,Autounboxing
System class
OOPS
-------------------------------------------------------------------------------------------------------------------
class,object                          Encapsulation                 Abstraction              Inheritance
Method Overloading        Method Overriding      Constructors         
Collections
-------------------------------------------------------------------------------------------------------------------
All List Classes                   All Set Classes                   All Map Classes       Collections Class
Iterator,ListIterator        Comparator                        Generics                  Timer,TimerTask
StringTokenizer              Locale class
Exceptions
-------------------------------------------------------------------------------------------------------------------
DefaultException             Checked,UnChecked      try,catch,finally      throw , throws
Handler
Threads
-------------------------------------------------------------------------------------------------------------------
Thread Creation               Thread Class Methods      Synchronization     wait,notify,notifyAll
Daemon Threads              Thread group                     Thread Deadlock
java.io
-------------------------------------------------------------------------------------------------------------------
File                                         All Reader Classes          All Writer Classes       All Stream Classes
Serialization
Thursday, July 30, 2009
Wednesday, July 8, 2009
servlet-interface
In javax.servlet.Servlet Interface contains the following methods:
public void init (Servletconfig config) throws ServletException.
If it throws a servlet exception
If it doesn't return with in a time period defined by the web server.
public void service (servlet Request req, Servlet Response res) throws ServletException, IOException :
public void destroy() :
public servlet config getservletconfig() :
It returns servlet config object which contain initialization and start of information of the servlet object.
public string getServletInfo() :
It returns a string containing information about the servlet such as author version and copy right.
Sample servlet program by implement Servlet interface :
import javax.servlet.*;
import java.io.*;
class BasicServlet implements Servlet
{
public void init ()(Servlet config conf) throws ServletException
{
System.out.println (“input method”);
}
public void service (ServletRequest req, ServletResponse res) throws ServletException, IOException
{
System.out.println (“service method”);
}
public void destroy ()
{
System.out.println (“destroy method”);
}
public ServletConfig getServletConfig ()
{
return null;
}
public String getServletInfo ()
{
return null;
}
public String getServletInfo ()
{
return null;
}
}
public void init (Servletconfig config) throws ServletException.
- This method called by servlet container to indicate to a servlet that the servlet is being placed into the service.
- The init () method called by servlet container exactly once after instantiating the servlet.
- We can override init () method if we have initialization code like getting database connection.
- The servlet container can not place the servlet into service of the init () methods.
If it throws a servlet exception
If it doesn't return with in a time period defined by the web server.
public void service (servlet Request req, Servlet Response res) throws ServletException, IOException :
- Called by servlet container to allow to respond to the client request.
- It should be called after the servlet’s init()method completion
public void destroy() :
- The servlet container call the destroy () method before removing a servlet instance from service.
- This normally happens when the servlet container is shut down of the servlet container needs some free memory.
- This method is only called once all the thread with in the servlet service () method have exited.
- We can keep cleanup code inside destroy () method.
public servlet config getservletconfig() :
It returns servlet config object which contain initialization and start of information of the servlet object.
public string getServletInfo() :
It returns a string containing information about the servlet such as author version and copy right.
Sample servlet program by implement Servlet interface :
import javax.servlet.*;
import java.io.*;
class BasicServlet implements Servlet
{
public void init ()(Servlet config conf) throws ServletException
{
System.out.println (“input method”);
}
public void service (ServletRequest req, ServletResponse res) throws ServletException, IOException
{
System.out.println (“service method”);
}
public void destroy ()
{
System.out.println (“destroy method”);
}
public ServletConfig getServletConfig ()
{
return null;
}
public String getServletInfo ()
{
return null;
}
public String getServletInfo ()
{
return null;
}
}
Wednesday, July 1, 2009
javax servlet package
- Javax.servlet: It defines several basic classes and interfaces to build servlets from the scratch irrespective of any protocol.
- Javax.servlet.http: This package contain several more convenient classes and interfaces (which extends classes and interfaces of javax.servlet package) to build servlets specific to http. It also contain several extra utility classes and interfaces like cookies http session(interface for developing web applications efficiently.
This package contains the following important interfaces:
1.Servlet Interface: It defines several methods which must be implemented by every servlet in java either directly or indirectly.
- this is the interface which define life cycle methods of interface.
2.Servlet Request : The servlet Request object contain client information which can be used by servlet to generate response.
3.Servlet Response : servlet response object contain the response which can sent to the client . ex:servlet uses servlet response object it send response to the client.
4.Servlet config : it contains the configuration or deployment information of start up information of the servlet.Web container creates a separate servlet and pass configuration information to the server by using this object.
5.Servlet context : Servlet context in the object which can be used by servlet to communicate with web server.For every web application one servlet context object will create by using the servlet context object servlet can get servlet context object.
6. Request Dispatcher: This object can be used by servlet to redirect the requests for another web component (servlet/jsp). This interface contain forward and include methods.
7. Single Thread Model: This interface can be implementing by servlet to generate that it can process only one request at a time.This is the deprecated interface and there is no replacement control 2.4. version.It does not contain any methods. So this is a MARKER INTERFACE.
These packages contain the following important classes.
- GenericServlet: to implement Generic protocol independent servlets.
- ServletInputStream: provides an input stream for reading binary data from a client request.
- ServletOutputStream: provides an output stream for reading binary data from a client request.This package defined the following Exception
- ServletException: Defines a general Exception. A servlet can throw when it fare some difficulty whose processing client request.
- UnavailableException: Defines an Exception that a servlet throws to indicate that the servlet is unavailable permanently or temporally.