Hi Dilli,
The existing model for configuration of a filter relies upon the
deployment step to copy any config required by a filter out of either
global or topology config into filter init params at deployment time.
The "hook" point for this is in the API
gateway-spi/src/main/java/org/apache/hadoop/gateway/deploy/ProviderDeploymentContributor.java
specifically the method contributeFilter().
This method ends up being called whenever a ServiceDeploymentContributor
adds a filter via DeploymentContext.contributeFilter.
So take a look at TempletetonDeploymentContributor.contributeService
it calls DeploymentContext.contributeFilter
this indirectly ends up calling
DispatchDeploymentContributor.contributeFilter
In this method you can interogate the DeploymentContext where you can
find both the global config gateway-core/site.xml) via getGatewayConfig
and the topology config (e.g. sample.xml) via getTopology().
From that filter init params could be added like this.
@Override
public void contributeFilter( DeploymentContext context, Provider
provider, Service service, ResourceDescriptor resource,
List<FilterParamDescriptor> params ) {
FilterDescriptor filter = resource.addFilter().name( getName()
).role( getRole() ).impl( HttpClientDispatch.class );
if( context.getGatewayConfig().isHadoopKerberosSecured() ) {
filter.param().name("kerberos").value("true");
}
}
I don't currently see a way to access GatewayConfig at request
processing time. It looks like it would be fairly easy to add as a
ServletContext attribute. This would be done in
GatewayServer.internalDeploy where the WebAppContext.setAttribute() is
setup. It could then be read by each filter in Filter.init() via
FilterConfig.getServletContext().getAttribute();
Kevin.
--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender immediately
and delete it from your system. Thank You.