Java™ Servlet 3.0 API
Package Diagram Example
An example of UML 2.5 package diagram representing most important interfaces and classes of Java™ Servlet 3.0 API. This API is described in Java Servlet Specification Version 3.0 and is a required (part of) API of the Java Platform, Enterprise Edition (“Java EE”), version 6.
Application Programming Interface (API) is a common programming term which is usually defined as a set of interfaces, classes and some rules specifying how some client of the API could (re)use the services and/or resources provided by the software component implementing that API.
Note, UML 2.5 does not provide notation or a stereotype to support modeling of APIs. On the diagram below Servlet API is notated as a package stereotyped as «API», which is not a standard UML stereotype.
A servlet is a Java class directly or indirectly implementing Servlet interface of the Java Servlet API. Java EE documentation usually refers to servlets as web components. Life cycle of servlets is managed by a web container. The web container is provided as a part of a web server or Java EE application server.
Java Servlet 3.0 API consists of four packages:
- javax.servlet,
- javax.servlet.http,
- javax.servlet.annotation, and
- javax.servlet.descriptor.
The javax.servlet package contains a number of interfaces and classes (both abstract and concrete) that describe and define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container.
The javax.servlet.http is package containing API interfaces and classes specialized for the servlets supporting HTTP protocol and corresponding runtime environment.
UML package diagram representing major interfaces and classes of Java™ Servlet 3.0 API.
The javax.servlet.annotation package contains a number of annotations that allow to declare servlets, filters, listeners and specify the metadata for the declared component by using those annotations. (Annotation in Java is a special kind of interface.)
The javax.servlet.descriptor package provides interfaces allowing programmatic access to a web application’s configuration information from the web.xml and web-fragment.xml descriptors.
Two abstract classes in the Java Servlet API that implement the Servlet interface are GenericServlet and HttpServlet. The HttpServlet is usually extended by developers to implement application specific servlets supporting HTTP protocol.