Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×

Submission + - Web Container vs Web Server vs Application Server (blogspot.com)

anij_java writes: "

Web Container / Servlet Container / Servlet Engine :

  • In J2EE Architecture, a web container(also known as servlet container or servlet engine), is used to manage the components like servlets , JSP.
  • It provides a runtime environment to the components of J2EE.
  • When ever web server receive a request it forward it to web container which deals with it by instantiating, initializing and invoking Servlets and JSP pages. So,basically it controls the whole life cycle of servlet and JSP.
  • It is a part of the web server.
  • Example: Apache Tomcat.

Web Server / HTTP Server :

  • It is a server which is capable of handling HTTP request send by a client and respond back with a HTTP respond .
  • Example: Apache Web Server.

Application Server / App Server :

  • It can handle all application operations between users and an organization's back end business applications or databases.
  • It's for complex transaction-based application.
  • It is frequently viewed as part of a three-tier application, where top-most tier is Presentation tier(GUI layer), then the Logic tier(an Application Server) and Data tier(consist of database server).
  • Example: IBM — WebSphere Application Server.
"

Java

Submission + - J2EE: SERVLET: What is Servlet Interface? (blogspot.in)

anij_java writes: "Interface javax.servlet.Servlet is that interface which defines the ServletLife Cycle methods. So, all servlets must implement this interface, either directly or by extending a class which implements this interface. Instead of directly implementing the Servlet Interface, a servlet can also extend Class GenericServlet (which implements Servlet Interface), or can extend HttpServlet Class (which extends the GenericServlet class).

Methods of Interface Servlet:

        init(ServletConfig config) : Called by the Web Container to initialize a servlet. Here, config is a ServletConfig object containing the servlet's configuration and initialization parameters

        service(ServletRequest req, ServletResponse res) : Called by the Web Container to allow a servlet to respond to a request. Here, req is the ServletRequest object that contains the client's request and res is the ServletResponse object that contains the servlet's response.

        destroy() : Called by the Web Container to clean up a servlet’s service.

        getServletConfig() : Return a ServletConfig object, which contain the initialization parameter and startup configuration of a servlet.

        getServletInfo() : Returns a string containing the details of a servlet, like author, version and copyright."

Java

Submission + - J2EE: SERVLET: Class GenericServlet vs Class HttpServlet (blogspot.in)

anij_java writes: "Class GenericServlet :

                                        It is an abstract class which defines a generic and protocol independent servlet. Here, protocol independent means, by default, it doesn’t contain inherent support for any particular type of protocol, but it can be extended to provide implementation of any protocol.

                                        Class GenericServlet implements Interface Servlet and Interface ServletConfig and it belongs to javax.servlet package.

                                        It offers simpler version of the servlet life cycle methods init() and destroy() and the methods of ServletConfig. That’s why, it makes writing a servlet easier.

                                        Here, the method service(ServletRequest req, ServletResponse res) is abstract, so the subclasses must override it. And this is also the reason why the GenericServlet is an abstract class.

Class HttpServlet :

                It is also an abstract class which defines HTTP prototype dependent servlet. That means we need to extend it to write a HTTP servlet for the use of the web.

                Class HttpServlet is a subclass of Class GenericServlet and it belongs to javax.servlet.http package.

                As it’s an abstract class, a subclass of it must override at least 1 method, generally one of these doGet(), doPost(), doPut(), doDelete(), init(), destroy(), getServletInfo().

                Class HttpServlet has two service() methods — one is public void service(ServletRequest req, ServletResponse res) which dispatches client request to protected void service(ServletRequest req, ServletResponse resp) which again dispaches the request to the doXXX methods (like doGet(), doPost(), etc.)."

Slashdot Top Deals

Those who can, do; those who can't, write. Those who can't write work for the Bell Labs Record.

Working...