uCosminexus Application Server, API Reference Guide

[Contents][Index][Back][Next]

2.1.1 Scope of support for the annotations included in the javax.annotation package

This section describes the applicability of annotations of the javax.annotation package. The following sections describe the annotations that you can code in each component:

Organization of this subsection
(1) WAR file (Servlet 3.0 compliant)
(2) WAR file (Supported by Servlet 2.5)
(3) EJB-JAR File (EJB3.1/3.0 compliant)
(4) Library JAR file (Servlets or JSPs)
(5) Library JAR file (Enterprise Bean, exception class, or other classes)

(1) WAR file (Servlet 3.0 compliant)

The following table lists the annotations that you can code in a WAR file:

Table 2-1 Annotations (javax.annotation package) that can be coded in WAR file (Servlet 3.0 compliant)

Annotation name Servlet specifications JSP Specifications Exception Class ManagedBean(JSF) Other class
Servlet Servlet (API) Servlet filter Servlet filter (API) Event listener Event listener (API) JSPfile Tag handler Tag library event listener
Classic tag handler Simple tag handler
@PostConstruct Y -- Y -- Y -- -- Y Y N -- Y# --
@PreDestroy Y -- Y -- Y -- -- Y Y N -- Y# --
@Resource Y -- Y -- Y -- -- Y Y N -- Y --
@Resources Y -- Y -- Y -- -- Y Y N -- Y --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not supported by standard specifications.

#
Annotation depends on JSF. For the support scope, see the JSF specification document.

(2) WAR file (Supported by Servlet 2.5)

The following table lists the annotations that you can code in a WAR file.

Table 2-2 Annotations (javax.annotation package) that can be coded in a WAR file (Supported by Servlet 2.5)

Annotation name Servlet specifications JSP specifications Other class
Servlet Servlet filter Event listener JSP file Tag handler Tag library event listener
Classic tag handler Simple tag handler
@PostConstruct Y Y Y -- Y Y N --
@PreDestroy Y Y Y -- Y Y N --
@Resource Y Y Y -- Y Y N --
@Resources Y Y Y -- Y Y N --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(3) EJB-JAR File (EJB3.1/3.0 compliant)

The following table lists the annotations that you can code in an EJB-JAR file:

Table 2-3 Annotations (javax.annotation package) that can be coded in an EJB-JAR file (EJB3.1/3.0 compliant)

Annotation name Enterprise Bean Exception class Other class
Interface Session Bean Entity Bean Message-driven Bean Interceptor
Other than the default interceptor Default interceptor
@PostConstruct -- Y -- N Y Y -- --
@PreDestroy -- Y -- N Y Y -- --
@Resource -- Y -- N Y Y -- --
@Resources -- Y -- N Y Y -- --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(4) Library JAR file (Servlets or JSPs)

The following table lists the annotations that you can code in a servlet or a JSP of a library JAR file:

Table 2-4 Annotations (javax.annotation package) that can be coded in a library JAR file (Servlets or JSPs)

Annotation name Servlet specifications JSP specifications
Servlet Servlet (API) Servlet filter Servlet filter (API) Event listener Event listener (API) JSP file Tag handler Tag library event listener
Classic tag handler Simple tag handler
@PostConstruct -- -- Y -- Y -- -- Y Y N
@PreDestroy -- -- Y -- Y -- -- Y Y N
@Resource -- -- Y -- Y -- -- Y Y N
@Resources -- -- Y -- Y -- -- Y Y N

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.

(5) Library JAR file (Enterprise Bean, exception class, or other classes)

The following table lists the annotations that you can coded in the Enterprise Beans, exception classes, or the other classes of a library JAR file:

Table 2-5 Annotations (javax.annotation package) that can be coded in a library JAR file (Enterprise Beans, exception classes, or other classes)

Annotation name Enterprise Bean Exception class Other class
Interface Session Bean Entity Bean Message-driven Bean Interceptor
@PostConstruct -- -- -- N Y -- --
@PreDestroy -- -- -- N Y -- --
@Resource -- -- -- N Y -- --
@Resources -- -- -- N Y -- --

Legend:
Y: Supported.
N: Not supported by Application Server.
--: Not applicable.