Class Container

java.lang.Object
com.opensymphony.module.sitemesh.util.Container

public final class Container extends Object
Utility for determining the Servlet Container the application is running in. Currently supported containers: Tomcat, Resin, Orion, OC4J, WebLogic, HPAS, JRun, Websphere.

Usage:

if (Container.get() == Container.TOMCAT) { .... }
Version:
$Revision: 1.2 $
Author:
Joe Walnes
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static Map
    A map containing classes that can be searched for, and which container they are typically found in.
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    private static int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    get()
    Get the current container.
    private static String
    searchForClosestClass(Map classMappings)
    Walk up the classloader hierachy and attempt to find a class in the classMappings Map that can be loaded.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Container

      public Container()
  • Method Details

    • get

      public static int get()
      Get the current container.
    • searchForClosestClass

      private static String searchForClosestClass(Map classMappings)
      Walk up the classloader hierachy and attempt to find a class in the classMappings Map that can be loaded.
      Returns:
      Name of the match class, or null if not found.