Search in sources :

Example 16 with GlassFishValve

use of org.glassfish.web.valve.GlassFishValve in project Payara by payara.

the class ValveBase method createObjectName.

public ObjectName createObjectName(String domain, ObjectName parent) throws MalformedObjectNameException {
    Container container = this.getContainer();
    if (container == null || !(container instanceof ContainerBase))
        return null;
    ContainerBase containerBase = (ContainerBase) container;
    Pipeline pipe = containerBase.getPipeline();
    GlassFishValve[] valves = pipe.getValves();
    /* Compute the "parent name" part */
    String parentName = "";
    if (container instanceof Engine) {
    } else if (container instanceof Host) {
        parentName = ",host=" + container.getName();
    } else if (container instanceof Context) {
        String path = ((Context) container).getPath();
        if (path.length() < 1) {
            path = "/";
        }
        Host host = (Host) container.getParent();
        parentName = ",path=" + path + ",host=" + host.getName();
    } else if (container instanceof Wrapper) {
        Context ctx = (Context) container.getParent();
        String path = ctx.getPath();
        if (path.length() < 1) {
            path = "/";
        }
        Host host = (Host) ctx.getParent();
        parentName = ",servlet=" + container.getName() + ",path=" + path + ",host=" + host.getName();
    }
    if (log.isLoggable(Level.FINE)) {
        log.log(Level.FINE, "valve parent=" + parentName + " " + parent);
    }
    String className = this.getClass().getName();
    int period = className.lastIndexOf('.');
    if (period >= 0)
        className = className.substring(period + 1);
    int seq = 0;
    for (int i = 0; i < valves.length; i++) {
        // Find other valves with the same name
        if (valves[i] == this) {
            break;
        }
        if (valves[i] != null && valves[i].getClass() == this.getClass()) {
            if (log.isLoggable(Level.FINE)) {
                log.log(Level.FINE, "Duplicate " + valves[i] + " " + this + " " + container);
            }
            seq++;
        }
    }
    String ext = "";
    if (seq > 0) {
        ext = ",seq=" + seq;
    }
    ObjectName objectName = new ObjectName(domain + ":type=Valve,name=" + className + ext + parentName);
    if (log.isLoggable(Level.FINE)) {
        log.log(Level.FINE, "valve objectname = " + objectName);
    }
    return objectName;
}
Also used : ContainerBase(org.apache.catalina.core.ContainerBase) GlassFishValve(org.glassfish.web.valve.GlassFishValve) ObjectName(javax.management.ObjectName)

Aggregations

GlassFishValve (org.glassfish.web.valve.GlassFishValve)16 SecurityConstraint (org.apache.catalina.deploy.SecurityConstraint)3 Method (java.lang.reflect.Method)2 ServletException (javax.servlet.ServletException)2 ContainerBase (org.apache.catalina.core.ContainerBase)2 LoginConfig (org.apache.catalina.deploy.LoginConfig)2 ProxyHandler (com.sun.appserv.ProxyHandler)1 Config (com.sun.enterprise.config.serverbeans.Config)1 SecurityService (com.sun.enterprise.config.serverbeans.SecurityService)1 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)1 LoginConfiguration (com.sun.enterprise.deployment.web.LoginConfiguration)1 SecurityConstraint (com.sun.enterprise.deployment.web.SecurityConstraint)1 UserDataConstraint (com.sun.enterprise.deployment.web.UserDataConstraint)1 WebResourceCollection (com.sun.enterprise.deployment.web.WebResourceCollection)1 RealmInitializer (com.sun.enterprise.security.integration.RealmInitializer)1 GlassFishSingleSignOn (com.sun.enterprise.security.web.GlassFishSingleSignOn)1 LoginConfigDecorator (com.sun.enterprise.web.deploy.LoginConfigDecorator)1 IOException (java.io.IOException)1 String (java.lang.String)1 CertificateException (java.security.cert.CertificateException)1