Search in sources :

Example 1 with RemoteHostValve

use of org.apache.catalina.valves.RemoteHostValve in project tomcat70 by apache.

the class MBeanFactory method createRemoteHostValve.

/**
 * Create a new Remote Host Filter Valve.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 *
 * @deprecated  Will be removed in Tomcat 8.0.x. Replaced by {@link
 *              #createValve(String, String)}.
 */
@Deprecated
public String createRemoteHostValve(String parent) throws Exception {
    // Create a new RemoteHostValve instance
    RemoteHostValve valve = new RemoteHostValve();
    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    ContainerBase containerBase = getParentContainerFromParent(pname);
    containerBase.getPipeline().addValve(valve);
    ObjectName oname = valve.getObjectName();
    return (oname.toString());
}
Also used : ContainerBase(org.apache.catalina.core.ContainerBase) RemoteHostValve(org.apache.catalina.valves.RemoteHostValve) ObjectName(javax.management.ObjectName)

Example 2 with RemoteHostValve

use of org.apache.catalina.valves.RemoteHostValve in project Payara by payara.

the class VirtualServer method configureRemoteHostFilterValve.

void configureRemoteHostFilterValve(String allow, String deny) {
    RemoteHostValve remoteHostValve = null;
    if (allow != null || deny != null) {
        remoteHostValve = new RemoteHostValve();
    }
    if (allow != null) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, LogFacade.ALLOW_ACCESS, new Object[] { getID(), allow });
        }
        remoteHostValve.setAllow(allow);
    }
    if (deny != null) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, LogFacade.DENY_ACCESS, new Object[] { getID(), deny });
        }
        remoteHostValve.setDeny(deny);
    }
    if (remoteHostValve != null) {
        // Remove existing RemoteHostValve (if any), in case of a reconfig
        GlassFishValve[] valves = getValves();
        for (int i = 0; valves != null && i < valves.length; i++) {
            if (valves[i] instanceof RemoteHostValve) {
                removeValve(valves[i]);
                break;
            }
        }
        addValve((GlassFishValve) remoteHostValve);
    }
}
Also used : RemoteHostValve(org.apache.catalina.valves.RemoteHostValve) GlassFishValve(org.glassfish.web.valve.GlassFishValve)

Aggregations

RemoteHostValve (org.apache.catalina.valves.RemoteHostValve)2 ObjectName (javax.management.ObjectName)1 ContainerBase (org.apache.catalina.core.ContainerBase)1 GlassFishValve (org.glassfish.web.valve.GlassFishValve)1