Class WebAppClassLoading

java.lang.Object
org.eclipse.jetty.ee.WebAppClassLoading

public class WebAppClassLoading extends Object
Common attributes and methods for configuring the 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

    Fields
    Modifier and Type
    Field
    Description
    static final org.eclipse.jetty.util.ClassMatcher
    The default hidden (server) classes used by a web application, which can be applied to the ClassMatchers created by getHiddenClasses(Environment).
    static final org.eclipse.jetty.util.ClassMatcher
    The default protected (system) classes used by a web application, which will be applied to the ClassMatchers created by getProtectedClasses(Environment).
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addHiddenClasses(String... patterns)
    Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
    static void
    addHiddenClasses(org.eclipse.jetty.server.Server server, String... patterns)
    Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
    static void
    addHiddenClasses(org.eclipse.jetty.util.Attributes attributes, String... patterns)
    Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
    static void
    addHiddenClasses(org.eclipse.jetty.util.component.Environment environment, String... patterns)
    Add a hidden (server) Class pattern to use for all ee9 WebAppContexts.
    static void
    Add a protected (system) Class pattern to use for all WebAppContexts.
    static void
    addProtectedClasses(org.eclipse.jetty.server.Server server, String... patterns)
    Add a protected (system) Class pattern to use for all WebAppContexts of a given Server.
    static void
    addProtectedClasses(org.eclipse.jetty.util.Attributes attributes, String... patterns)
    Add a protected (system) Class pattern to use for all WebAppContexts of a given Server.
    static void
    addProtectedClasses(org.eclipse.jetty.util.component.Environment environment, String... patterns)
    Add a protected (system) Class pattern to use for WebAppContexts of a given environment.
    static org.eclipse.jetty.util.ClassMatcher
    getHiddenClasses(org.eclipse.jetty.server.Server server)
    Get the default hidden (server) classes for a Server
    static org.eclipse.jetty.util.ClassMatcher
    getHiddenClasses(org.eclipse.jetty.util.component.Environment environment)
    Get the default hidden (server) classes for an Environment
    static org.eclipse.jetty.util.ClassMatcher
    getProtectedClasses(org.eclipse.jetty.server.Server server)
    Get the default protected (system) classes for a Server
    static org.eclipse.jetty.util.ClassMatcher
    getProtectedClasses(org.eclipse.jetty.util.component.Environment environment)
    Get the default protected (system) classes for an Environment

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PROTECTED_CLASSES_ATTRIBUTE

      public static final String PROTECTED_CLASSES_ATTRIBUTE
      See Also:
    • HIDDEN_CLASSES_ATTRIBUTE

      public static final String HIDDEN_CLASSES_ATTRIBUTE
      See Also:
    • DEFAULT_PROTECTED_CLASSES

      public static final org.eclipse.jetty.util.ClassMatcher DEFAULT_PROTECTED_CLASSES
      The default protected (system) classes used by a web application, which will be applied to the ClassMatchers created by getProtectedClasses(Environment).
    • DEFAULT_HIDDEN_CLASSES

      public static final org.eclipse.jetty.util.ClassMatcher DEFAULT_HIDDEN_CLASSES
      The default hidden (server) classes used by a web application, which can be applied to the ClassMatchers created by getHiddenClasses(Environment).
  • Constructor Details

    • WebAppClassLoading

      public WebAppClassLoading()
  • Method Details

    • getProtectedClasses

      public static org.eclipse.jetty.util.ClassMatcher getProtectedClasses(org.eclipse.jetty.server.Server server)
      Get the default protected (system) classes for a Server
      Parameters:
      server - The Server for the defaults
      Returns:
      The default protected (system) classes for the Server, which will be empty if not previously configured.
    • getProtectedClasses

      public static org.eclipse.jetty.util.ClassMatcher getProtectedClasses(org.eclipse.jetty.util.component.Environment environment)
      Get the default protected (system) classes for an Environment
      Parameters:
      environment - The Server for the defaults
      Returns:
      The default protected (system) classes for the Environment, which will be the DEFAULT_PROTECTED_CLASSES if not previously configured.
    • addProtectedClasses

      public static void addProtectedClasses(String... patterns)
      Add a protected (system) Class pattern to use for all WebAppContexts.
      Parameters:
      patterns - the patterns to use
    • addProtectedClasses

      public static void addProtectedClasses(org.eclipse.jetty.util.Attributes attributes, String... patterns)
      Add a protected (system) Class pattern to use for all WebAppContexts of a given Server.
      Parameters:
      attributes - The Attributes instance to add classes to
      patterns - the patterns to use
    • addProtectedClasses

      public static void addProtectedClasses(org.eclipse.jetty.server.Server server, String... patterns)
      Add a protected (system) Class pattern to use for all WebAppContexts of a given Server.
      Parameters:
      server - The Server instance to add classes to
      patterns - the patterns to use
    • addProtectedClasses

      public static void addProtectedClasses(org.eclipse.jetty.util.component.Environment environment, String... patterns)
      Add a protected (system) Class pattern to use for WebAppContexts of a given environment.
      Parameters:
      environment - The Environment instance to add classes to
      patterns - the patterns to use
    • getHiddenClasses

      public static org.eclipse.jetty.util.ClassMatcher getHiddenClasses(org.eclipse.jetty.server.Server server)
      Get the default hidden (server) classes for a Server
      Parameters:
      server - The Server for the defaults
      Returns:
      The default hidden (server) classes for the Server, which will be empty if not previously configured.
    • getHiddenClasses

      public static org.eclipse.jetty.util.ClassMatcher getHiddenClasses(org.eclipse.jetty.util.component.Environment environment)
      Get the default hidden (server) classes for an Environment
      Parameters:
      environment - The Server for the defaults
      Returns:
      The default hidden (server) classes for the Environment, which will be DEFAULT_PROTECTED_CLASSES if not previously configured.
    • addHiddenClasses

      public static void addHiddenClasses(String... patterns)
      Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
      Parameters:
      patterns - the patterns to use
    • addHiddenClasses

      public static void addHiddenClasses(org.eclipse.jetty.util.Attributes attributes, String... patterns)
      Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
      Parameters:
      attributes - The Attributes instance to add classes to
      patterns - the patterns to use
    • addHiddenClasses

      public static void addHiddenClasses(org.eclipse.jetty.server.Server server, String... patterns)
      Add a hidden (server) Class pattern to use for all WebAppContexts of a given Server.
      Parameters:
      server - The Server instance to add classes to
      patterns - the patterns to use
    • addHiddenClasses

      public static void addHiddenClasses(org.eclipse.jetty.util.component.Environment environment, String... patterns)
      Add a hidden (server) Class pattern to use for all ee9 WebAppContexts.
      Parameters:
      environment - The Environment instance to add classes to
      patterns - the patterns to use