Accessing the Web Context - The Java EE 6 Tutorial (original) (raw)
The context in which web components execute is an object that implements theServletContext interface. You retrieve the web context by using the getServletContext method. The web context provides methods for accessing
- Initialization parameters
- Resources associated with the web context
- Object-valued attributes
- Logging capabilities
The counter’s access methods are synchronized to prevent incompatible operations by servlets that are running concurrently. A filter retrieves the counter object by using the context’sgetAttribute method. The incremented value of the counter is recorded in the log.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices