Class WebAppClassLoading
Class loading
of web application:
- Protected (a.k.a. System) classes are classes typically provided by the JVM, that cannot be replaced by the web application, and they are always loaded via the environment or system classloader. They are visible but protected.
- Hidden (a.k.a. Server) classes are those used to implement the Server and are not made available to the
web application. They are hidden from the web application
ClassLoader
.
These protections are set to reasonable defaults DEFAULT_PROTECTED_CLASSES
and DEFAULT_HIDDEN_CLASSES
,
which may be programmatically configured and will affect the defaults applied to all web applications in the same JVM.
The defaults applied by a specific Server
can be configured using addProtectedClasses(Server, String...)
and
addHiddenClasses(Server, String...)
. Alternately the Server
attributes PROTECTED_CLASSES_ATTRIBUTE
and HIDDEN_CLASSES_ATTRIBUTE
may be used to direct set a ClassMatcher
to use for all web applications
within the server instance.
The defaults applied by a specific Environment
can be configured using addProtectedClasses(Environment, String...)
and
addHiddenClasses(Environment, String...)
. Alternately the Environment
attributes PROTECTED_CLASSES_ATTRIBUTE
and HIDDEN_CLASSES_ATTRIBUTE
may be used to direct set a ClassMatcher
to use for all web applications
within the server instance.
Ultimately, the configurations set by this class only affects the defaults applied to each web application
Context
and the ClassMatcher
fields of the web applications
can be directly access to configure a specific context.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ClassMatcher
The default hidden (server) classes used by a web application, which can be applied to theClassMatcher
s created bygetHiddenClasses(Environment)
.static final ClassMatcher
The default protected (system) classes used by a web application, which will be applied to theClassMatcher
s created bygetProtectedClasses(Environment)
.static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addHiddenClasses
(String... patterns) Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.static void
addHiddenClasses
(Server server, String... patterns) Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.static void
addHiddenClasses
(Attributes attributes, String... patterns) Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.static void
addHiddenClasses
(Environment environment, String... patterns) Add a hidden (server) Class pattern to use for all ee9 WebAppContexts.static void
addProtectedClasses
(String... patterns) Add a protected (system) Class pattern to use for all WebAppContexts.static void
addProtectedClasses
(Server server, String... patterns) Add a protected (system) Class pattern to use for all WebAppContexts of a givenServer
.static void
addProtectedClasses
(Attributes attributes, String... patterns) Add a protected (system) Class pattern to use for all WebAppContexts of a givenServer
.static void
addProtectedClasses
(Environment environment, String... patterns) Add a protected (system) Class pattern to use for WebAppContexts of a given environment.static ClassMatcher
getHiddenClasses
(Server server) Get the default hidden (server) classes for aServer
static ClassMatcher
getHiddenClasses
(Environment environment) Get the default hidden (server) classes for anEnvironment
static ClassMatcher
getProtectedClasses
(Server server) Get the default protected (system) classes for aServer
static ClassMatcher
getProtectedClasses
(Environment environment) Get the default protected (system) classes for anEnvironment
-
Field Details
-
PROTECTED_CLASSES_ATTRIBUTE
- See Also:
-
HIDDEN_CLASSES_ATTRIBUTE
- See Also:
-
DEFAULT_PROTECTED_CLASSES
The default protected (system) classes used by a web application, which will be applied to theClassMatcher
s created bygetProtectedClasses(Environment)
. -
DEFAULT_HIDDEN_CLASSES
The default hidden (server) classes used by a web application, which can be applied to theClassMatcher
s created bygetHiddenClasses(Environment)
.
-
-
Constructor Details
-
WebAppClassLoading
public WebAppClassLoading()
-
-
Method Details
-
getProtectedClasses
Get the default protected (system) classes for aServer
-
getProtectedClasses
Get the default protected (system) classes for anEnvironment
- Parameters:
environment
- TheServer
for the defaults- Returns:
- The default protected (system) classes for the
Environment
, which will be theDEFAULT_PROTECTED_CLASSES
if not previously configured.
-
addProtectedClasses
Add a protected (system) Class pattern to use for all WebAppContexts.- Parameters:
patterns
- the patterns to use
-
addProtectedClasses
Add a protected (system) Class pattern to use for all WebAppContexts of a givenServer
.- Parameters:
attributes
- TheAttributes
instance to add classes topatterns
- the patterns to use
-
addProtectedClasses
Add a protected (system) Class pattern to use for all WebAppContexts of a givenServer
.- Parameters:
server
- TheServer
instance to add classes topatterns
- the patterns to use
-
addProtectedClasses
Add a protected (system) Class pattern to use for WebAppContexts of a given environment.- Parameters:
environment
- TheEnvironment
instance to add classes topatterns
- the patterns to use
-
getHiddenClasses
Get the default hidden (server) classes for aServer
-
getHiddenClasses
Get the default hidden (server) classes for anEnvironment
- Parameters:
environment
- TheServer
for the defaults- Returns:
- The default hidden (server) classes for the
Environment
, which will beDEFAULT_PROTECTED_CLASSES
if not previously configured.
-
addHiddenClasses
Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.- Parameters:
patterns
- the patterns to use
-
addHiddenClasses
Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.- Parameters:
attributes
- TheAttributes
instance to add classes topatterns
- the patterns to use
-
addHiddenClasses
Add a hidden (server) Class pattern to use for all WebAppContexts of a givenServer
.- Parameters:
server
- TheServer
instance to add classes topatterns
- the patterns to use
-
addHiddenClasses
Add a hidden (server) Class pattern to use for all ee9 WebAppContexts.- Parameters:
environment
- TheEnvironment
instance to add classes topatterns
- the patterns to use
-