It is possible to use component-plugin
elements
in order to dynamically disable one or several portal containers. In
the example below, we disable the portal container named
foo
:
<external-component-plugins>
<!-- The full qualified name of the PortalContainerConfig -->
<target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
<component-plugin>
<!-- The name of the plugin -->
<name>Disable a PortalContainer</name>
<!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
<set-method>registerDisablePlugin</set-method>
<!-- The full qualified name of the PortalContainerDefinitionDisablePlugin -->
<type>org.exoplatform.container.definition.PortalContainerDefinitionDisablePlugin</type>
<init-params>
<!-- The list of the name of the portal containers to disable -->
<values-param>
<name>names</name>
<value>foo</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
All the value of the parameters marked with a (*) can be set via System properties and also via variables loaded by the PropertyConfigurator. For example in GateIn by default, it would be all the variables defined in the file configuration.properties.
To prevent any accesses to a web application corresponding to
PortalContainer
that has been disabled, you need to
make sure that the following Http Filter (or a sub class of it) has
been added to your web.xml in first position as below:
<filter>
<filter-name>PortalContainerFilter</filter-name>
<filter-class>org.exoplatform.container.web.PortalContainerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PortalContainerFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
It is only possible to disable a portal container when at least one PortalContainerDefinition has been registered.