You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by Kevin Minder <ke...@hortonworks.com> on 2013/10/01 03:11:18 UTC

Examples of propagating config from service deployment contributor to filter

Hey Dilli,

To see how a deployment contributor passes params into the deployment 
take a look at the contributeDataNodeResource method of
gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java 
method
in particular the lines below.

     params = new ArrayList<FilterParamDescriptor>();
     params.add( fileResource.createFilterParam().
         name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( 
getQualifiedName() + "/inbound/datanode" ) );
     addRewriteFilter( context, service, fileResource, params );

This ends up calling the deployment contributor for the provider.  A 
good example of this is the contributeFilter method of
gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteDeploymentContributor.java
This method simply passes the params into filter init params in the 
gateway.xml descriptor.

You can also look at
gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
that is adding a filter init parameter depending upon a configuration 
parameter.  I don't think that HttpClientDispatch is currently using 
that value BTW.

Finally you can see how the filter init params are accessed between 
these two classes.
gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilter.java
gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequest.java

Hope this saves you some time if you haven't already figured all of this 
out.

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.

Re: Examples of propagating config from service deployment contributor to filter

Posted by Dilli Arumugam <da...@hortonworks.com>.
Thanks Kevin.
This information would help in investigating and fixing
KNOX-174: support service specific cap for buffering request entities for
replay against WWW-authenticate challenge
Dilli


On Mon, Sep 30, 2013 at 6:11 PM, Kevin Minder
<ke...@hortonworks.com>wrote:

> Hey Dilli,
>
> To see how a deployment contributor passes params into the deployment take
> a look at the contributeDataNodeResource method of
> gateway-service-webhdfs/src/**main/java/org/apache/hadoop/**gateway/hdfs/*
> *WebHdfsDeploymentContributor.**java method
> in particular the lines below.
>
>     params = new ArrayList<**FilterParamDescriptor>();
>     params.add( fileResource.**createFilterParam().
>         name( UrlRewriteServletFilter.**REQUEST_URL_RULE_PARAM ).value(
> getQualifiedName() + "/inbound/datanode" ) );
>     addRewriteFilter( context, service, fileResource, params );
>
> This ends up calling the deployment contributor for the provider.  A good
> example of this is the contributeFilter method of
> gateway-provider-rewrite/src/**main/java/org/apache/hadoop/**
> gateway/filter/rewrite/impl/**UrlRewriteDeploymentContributo**r.java
> This method simply passes the params into filter init params in the
> gateway.xml descriptor.
>
> You can also look at
> gateway-server/src/main/java/**org/apache/hadoop/gateway/**deploy/impl/**
> DispatchDeploymentContributor.**java
> that is adding a filter init parameter depending upon a configuration
> parameter.  I don't think that HttpClientDispatch is currently using that
> value BTW.
>
> Finally you can see how the filter init params are accessed between these
> two classes.
> gateway-provider-rewrite/src/**main/java/org/apache/hadoop/**
> gateway/filter/rewrite/api/**UrlRewriteServletFilter.java
> gateway-provider-rewrite/src/**main/java/org/apache/hadoop/**
> gateway/filter/rewrite/impl/**UrlRewriteRequest.java
>
> Hope this saves you some time if you haven't already figured all of this
> out.
>
> 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.