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());
}
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);
}
}
Aggregations