The jakarta.servlet package contains a number of classes and interfaces 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.
Interface Summary Interface Description AsyncContextProvides the context for asynchronous request handling AsyncListenerListener for events associated with an
FilterA filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. FilterChainA FilterChain is an object provided by the servlet container to the developer giving a view into the invocation chain of a filtered request for a resource. FilterConfigA filter configuration object used by a servlet container to pass information to a filter during initialization. FilterRegistrationInterface through which a Filter may be further configured. FilterRegistration.DynamicInterface through which a Filter registered via one of the addFilter methods on ServletContext may be further configured. ReadListenerReceives notification of read events when using non-blocking IO. RegistrationCommon interface for the registration of Filters and Servlets. Registration.DynamicInterface through which a Servlet or Filter registered via one of the addServlet or addFilter methods, respectively, on ServletContext may be further configured. RequestDispatcherDefines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server. ServletDefines methods that all servlets must implement. ServletConfigA servlet configuration object used by a servlet container to pass information to a servlet during initialization. ServletContainerInitializerServletContainerInitializers (SCIs) are registered via an entry in the file META-INF/services/jakarta.servlet.ServletContainerInitializer that must be included in the JAR file that contains the SCI implementation. ServletContextDefines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file. ServletContextAttributeListenerImplementations of this interface receive notifications of changes to the attribute list on the servlet context of a web application. ServletContextListenerImplementations of this interface receive notifications about changes to the servlet context of the web application they are part of. ServletRegistrationInterface through which a Servlet may be further configured. ServletRegistration.DynamicInterface through which a Servlet registered via one of the addServlet methods on ServletContext may be further configured. ServletRequestDefines an object to provide client request information to a servlet. ServletRequestAttributeListenerA ServletRequestAttributeListener can be implemented by the developer interested in being notified of request attribute changes. ServletRequestListenerA ServletRequestListener can be implemented by the developer interested in being notified of requests coming in and out of scope in a web component. ServletResponseDefines an object to assist a servlet in sending a response to the client. SessionCookieConfigConfigures the session cookies used by the web application associated with the ServletContext from which this SessionCookieConfig was obtained. SingleThreadModel Deprecated.As of Java Servlet API 2.4, with no direct replacement. WriteListenerReceives notification of write events when using non-blocking IO.
Class Summary Class Description AsyncEventUsed to pass data to the methods of
GenericFilterProvides a base class that implements the Filter and FilterConfig interfaces to reduce boilerplate when writing new filters. GenericServletDefines a generic, protocol-independent servlet. HttpConstraintElementEquivalent of
HttpConstraintfor programmatic configuration of security constraints.
HttpMethodConstraintElementProgrammatic equivalent of a security constraint defined for a single HTTP method. MultipartConfigElementThe programmatic equivalent of
MultipartConfigused to configure multi-part handling for a Servlet when registering a Servlet via code.
ServletContextAttributeEventThis is the event class for notifications about changes to the attributes of the servlet context of a web application. ServletContextEventThis is the event class for notifications about changes to the servlet context of a web application. ServletInputStreamProvides an input stream for reading binary data from a client request, including an efficient
readLinemethod for reading data one line at a time.
ServletOutputStreamProvides an output stream for sending binary data to the client. ServletRequestAttributeEventThis is the event class for notifications of changes to the attributes of the servlet request in an application. ServletRequestEventEvents of this kind indicate lifecycle events for a ServletRequest. ServletRequestWrapperProvides a convenient implementation of the ServletRequest interface that can be subclassed by developers wishing to adapt the request to a Servlet. ServletResponseWrapperProvides a convenient implementation of the ServletResponse interface that can be subclassed by developers wishing to adapt the response from a Servlet. ServletSecurityElementThe programmatic equivalent of
ServletSecurityused to configre security constraints for a Servlet.
Enum Summary Enum Description DispatcherTypeEnumeration of dispatcher types. SessionTrackingModeDefines the permitted options for configuring the session tracking mode.
Exception Summary Exception Description ServletExceptionDefines a general exception a servlet can throw when it encounters difficulty. UnavailableExceptionDefines an exception that a servlet or filter throws to indicate that it is permanently or temporarily unavailable.