You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by David Morin <mo...@gmail.com> on 2018/07/26 16:25:13 UTC

Knox: how to create a custom dispatch class

​Hello,

I've just read in detail the Knox dev guide. First of all, congrats ! Great
job for the doc !
But I face to an issue with logsearch on my HDP cluster.
This is a HDP 2.6.5 with Knox 0.12.0
I've created some XML files. These files are in PJs.
But I face to some 403 requests. In fact, some urls have been "urlencoded"
twice:

Rewrote URL:
http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
**%3A**...
direction: IN
via implicit rule: LOGSEARCH/logsearch/inbound
to URL:
http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**&startIndex=0...

Thus, we've got the string "q=%3A" replaced by "q=%253A"

How can I resolve this issue ?
I've written a custom dispatch class and reference it in the service.xml
but my class seems to be ignored.

<dispatch
classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>

I've put my Jar that contains this class in the ext directory. Thus, it
should be in the classpath.

Thanks in advance
Regards,
David

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Hello,

pach available here: https://issues.apache.org/jira/browse/KNOX-1400

Le mer. 1 août 2018 à 15:20, Sandeep Moré <mo...@gmail.com> a écrit :

> Great, thanks David !
> Will it possible for you to create a .patch file ? also, do you know if
> this works for Knox 1.1.0 ?
>
> Best,
> Sandeep
>
> On Wed, Aug 1, 2018 at 5:16 AM David Morin <mo...@gmail.com>
> wrote:
>
>> Hi,
>>
>> Just for share.
>> Here after the Jira with the workaround to implement Logsearch with Knox:
>>  https://issues.apache.org/jira/browse/KNOX-1400
>>
>>
>> Le mer. 1 août 2018 à 01:15, Sandeep Moré <mo...@gmail.com> a
>> écrit :
>>
>>> Great !
>>> If you stumbled across bugs in logsearch, file a JIRA and a patch if you
>>> got it to work, that would be really helpful for the community !
>>> Looking at the Knox services, I don't see it being implemented, I think
>>> there were few emails on the mailing list about Grafana.
>>>
>>> Best,
>>> Sandeep
>>>
>>> On Tue, Jul 31, 2018 at 6:39 PM David Morin <mo...@gmail.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> Thanks for your help.
>>>> Concerning Logsearch it's quite done. I'll share my work soon. On my
>>>> github at the beginning.
>>>> Now, I'm going to implement grafana with Knox
>>>> Does this feature has already been done ?
>>>>
>>>> Le jeu. 26 juil. 2018 à 21:47, David Morin <mo...@gmail.com>
>>>> a écrit :
>>>>
>>>>> Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for
>>>>> me too.
>>>>> In waiting a patch or a workaround, if you have a jar with an example
>>>>> of Dispatch class it would be great.
>>>>> Thanks
>>>>>
>>>>> Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
>>>>> écrit :
>>>>>
>>>>>> Great, thanks !
>>>>>>
>>>>>> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Yes, I will do that and share here.
>>>>>>>
>>>>>>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hello Dhruv,
>>>>>>>>
>>>>>>>> Can you open a JIRA for this issue, let's track it and try to get
>>>>>>>> it fixed !
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> This is the similar issue we were facing when we tried
>>>>>>>>> implementing grafana with knox, it is encoded twice in grafana as well, I
>>>>>>>>> tried using “PassAllHeadersNoEncodingDispatch”
>>>>>>>>> But it didnt worked for me. We will have to write a custom
>>>>>>>>> dispatch class.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Dhruv
>>>>>>>>>
>>>>>>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <
>>>>>>>>> moresandeep@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>>>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>>>>>>
>>>>>>>>>> You can try putting the jar file under the lib directory and see
>>>>>>>>>> if it works, I should work given all the other jars are found there. There
>>>>>>>>>> is also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>>>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>>>>>>> dispatch.
>>>>>>>>>>
>>>>>>>>>> Best,
>>>>>>>>>> Sandeep
>>>>>>>>>>
>>>>>>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <
>>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Thanks Sandeep
>>>>>>>>>>> You're right. I have to delete the directory from deployments
>>>>>>>>>>> and restart knox.
>>>>>>>>>>> In fact my Xml files are well taken into account.
>>>>>>>>>>> But my problem is more related to the fact that I face to the
>>>>>>>>>>> double urlencode and my custom dispatch class seems to be ignored.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <
>>>>>>>>>>> moresandeep@gmail.com> a écrit :
>>>>>>>>>>>
>>>>>>>>>>>> Hello David,
>>>>>>>>>>>>
>>>>>>>>>>>> This should have worked, if you turn the debug log on you can
>>>>>>>>>>>> see what dispatch Knox is trying to use.
>>>>>>>>>>>> Also, if the changes are in service.xml then we need to touch
>>>>>>>>>>>> the topology file so that Knox reloads it, I am thinking this could be an
>>>>>>>>>>>> issue.
>>>>>>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>>>>>>> restarting Knox.
>>>>>>>>>>>>
>>>>>>>>>>>> Best,
>>>>>>>>>>>> Sandeep
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>>>>>>> congrats ! Great job for the doc !
>>>>>>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>>>>>>> "urlencoded" twice:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Rewrote URL:
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>>>>>>> **%3A**...
>>>>>>>>>>>>> direction: IN
>>>>>>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>>>>>>> to URL:
>>>>>>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>>>>>>> &startIndex=0...
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>>>>>>
>>>>>>>>>>>>> How can I resolve this issue ?
>>>>>>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>>>>>>
>>>>>>>>>>>>> <dispatch
>>>>>>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks in advance
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> David
>>>>>>>>>>>>>
>>>>>>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
Great, thanks David !
Will it possible for you to create a .patch file ? also, do you know if
this works for Knox 1.1.0 ?

Best,
Sandeep

On Wed, Aug 1, 2018 at 5:16 AM David Morin <mo...@gmail.com>
wrote:

> Hi,
>
> Just for share.
> Here after the Jira with the workaround to implement Logsearch with Knox:
> https://issues.apache.org/jira/browse/KNOX-1400
>
>
> Le mer. 1 août 2018 à 01:15, Sandeep Moré <mo...@gmail.com> a
> écrit :
>
>> Great !
>> If you stumbled across bugs in logsearch, file a JIRA and a patch if you
>> got it to work, that would be really helpful for the community !
>> Looking at the Knox services, I don't see it being implemented, I think
>> there were few emails on the mailing list about Grafana.
>>
>> Best,
>> Sandeep
>>
>> On Tue, Jul 31, 2018 at 6:39 PM David Morin <mo...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> Thanks for your help.
>>> Concerning Logsearch it's quite done. I'll share my work soon. On my
>>> github at the beginning.
>>> Now, I'm going to implement grafana with Knox
>>> Does this feature has already been done ?
>>>
>>> Le jeu. 26 juil. 2018 à 21:47, David Morin <mo...@gmail.com>
>>> a écrit :
>>>
>>>> Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for
>>>> me too.
>>>> In waiting a patch or a workaround, if you have a jar with an example
>>>> of Dispatch class it would be great.
>>>> Thanks
>>>>
>>>> Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
>>>> écrit :
>>>>
>>>>> Great, thanks !
>>>>>
>>>>> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Yes, I will do that and share here.
>>>>>>
>>>>>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello Dhruv,
>>>>>>>
>>>>>>> Can you open a JIRA for this issue, let's track it and try to get it
>>>>>>> fixed !
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> This is the similar issue we were facing when we tried implementing
>>>>>>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>>>>>>> “PassAllHeadersNoEncodingDispatch”
>>>>>>>> But it didnt worked for me. We will have to write a custom dispatch
>>>>>>>> class.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Dhruv
>>>>>>>>
>>>>>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <
>>>>>>>> moresandeep@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>>>>>
>>>>>>>>> You can try putting the jar file under the lib directory and see
>>>>>>>>> if it works, I should work given all the other jars are found there. There
>>>>>>>>> is also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>>>>>> dispatch.
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Sandeep
>>>>>>>>>
>>>>>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <
>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Thanks Sandeep
>>>>>>>>>> You're right. I have to delete the directory from deployments and
>>>>>>>>>> restart knox.
>>>>>>>>>> In fact my Xml files are well taken into account.
>>>>>>>>>> But my problem is more related to the fact that I face to the
>>>>>>>>>> double urlencode and my custom dispatch class seems to be ignored.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <
>>>>>>>>>> moresandeep@gmail.com> a écrit :
>>>>>>>>>>
>>>>>>>>>>> Hello David,
>>>>>>>>>>>
>>>>>>>>>>> This should have worked, if you turn the debug log on you can
>>>>>>>>>>> see what dispatch Knox is trying to use.
>>>>>>>>>>> Also, if the changes are in service.xml then we need to touch
>>>>>>>>>>> the topology file so that Knox reloads it, I am thinking this could be an
>>>>>>>>>>> issue.
>>>>>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>>>>>> restarting Knox.
>>>>>>>>>>>
>>>>>>>>>>> Best,
>>>>>>>>>>> Sandeep
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>>>>>> congrats ! Great job for the doc !
>>>>>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>>>>>> "urlencoded" twice:
>>>>>>>>>>>>
>>>>>>>>>>>> Rewrote URL:
>>>>>>>>>>>>
>>>>>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>>>>>> **%3A**...
>>>>>>>>>>>> direction: IN
>>>>>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>>>>>> to URL:
>>>>>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>>>>>> &startIndex=0...
>>>>>>>>>>>>
>>>>>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>>>>>
>>>>>>>>>>>> How can I resolve this issue ?
>>>>>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>>>>>
>>>>>>>>>>>> <dispatch
>>>>>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>>>>>
>>>>>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks in advance
>>>>>>>>>>>> Regards,
>>>>>>>>>>>> David
>>>>>>>>>>>>
>>>>>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Hi,

Just for share.
Here after the Jira with the workaround to implement Logsearch with Knox:
https://issues.apache.org/jira/browse/KNOX-1400


Le mer. 1 août 2018 à 01:15, Sandeep Moré <mo...@gmail.com> a écrit :

> Great !
> If you stumbled across bugs in logsearch, file a JIRA and a patch if you
> got it to work, that would be really helpful for the community !
> Looking at the Knox services, I don't see it being implemented, I think
> there were few emails on the mailing list about Grafana.
>
> Best,
> Sandeep
>
> On Tue, Jul 31, 2018 at 6:39 PM David Morin <mo...@gmail.com>
> wrote:
>
>> Hello,
>>
>> Thanks for your help.
>> Concerning Logsearch it's quite done. I'll share my work soon. On my
>> github at the beginning.
>> Now, I'm going to implement grafana with Knox
>> Does this feature has already been done ?
>>
>> Le jeu. 26 juil. 2018 à 21:47, David Morin <mo...@gmail.com> a
>> écrit :
>>
>>> Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for me
>>> too.
>>> In waiting a patch or a workaround, if you have a jar with an example
>>> of Dispatch class it would be great.
>>> Thanks
>>>
>>> Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
>>> écrit :
>>>
>>>> Great, thanks !
>>>>
>>>> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com>
>>>> wrote:
>>>>
>>>>> Yes, I will do that and share here.
>>>>>
>>>>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello Dhruv,
>>>>>>
>>>>>> Can you open a JIRA for this issue, let's track it and try to get it
>>>>>> fixed !
>>>>>>
>>>>>>
>>>>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> This is the similar issue we were facing when we tried implementing
>>>>>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>>>>>> “PassAllHeadersNoEncodingDispatch”
>>>>>>> But it didnt worked for me. We will have to write a custom dispatch
>>>>>>> class.
>>>>>>>
>>>>>>> Regards
>>>>>>> Dhruv
>>>>>>>
>>>>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>>>>
>>>>>>>> You can try putting the jar file under the lib directory and see if
>>>>>>>> it works, I should work given all the other jars are found there. There is
>>>>>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>>>>> dispatch.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Sandeep
>>>>>>>>
>>>>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <
>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Thanks Sandeep
>>>>>>>>> You're right. I have to delete the directory from deployments and
>>>>>>>>> restart knox.
>>>>>>>>> In fact my Xml files are well taken into account.
>>>>>>>>> But my problem is more related to the fact that I face to the
>>>>>>>>> double urlencode and my custom dispatch class seems to be ignored.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com>
>>>>>>>>> a écrit :
>>>>>>>>>
>>>>>>>>>> Hello David,
>>>>>>>>>>
>>>>>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>>>>>> what dispatch Knox is trying to use.
>>>>>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>>>>>> issue.
>>>>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>>>>> restarting Knox.
>>>>>>>>>>
>>>>>>>>>> Best,
>>>>>>>>>> Sandeep
>>>>>>>>>>
>>>>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>>>>> congrats ! Great job for the doc !
>>>>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>>>>> "urlencoded" twice:
>>>>>>>>>>>
>>>>>>>>>>> Rewrote URL:
>>>>>>>>>>>
>>>>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>>>>> **%3A**...
>>>>>>>>>>> direction: IN
>>>>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>>>>> to URL:
>>>>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>>>>> &startIndex=0...
>>>>>>>>>>>
>>>>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>>>>
>>>>>>>>>>> How can I resolve this issue ?
>>>>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>>>>
>>>>>>>>>>> <dispatch
>>>>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>>>>
>>>>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>>>>
>>>>>>>>>>> Thanks in advance
>>>>>>>>>>> Regards,
>>>>>>>>>>> David
>>>>>>>>>>>
>>>>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
Great !
If you stumbled across bugs in logsearch, file a JIRA and a patch if you
got it to work, that would be really helpful for the community !
Looking at the Knox services, I don't see it being implemented, I think
there were few emails on the mailing list about Grafana.

Best,
Sandeep

On Tue, Jul 31, 2018 at 6:39 PM David Morin <mo...@gmail.com>
wrote:

> Hello,
>
> Thanks for your help.
> Concerning Logsearch it's quite done. I'll share my work soon. On my
> github at the beginning.
> Now, I'm going to implement grafana with Knox
> Does this feature has already been done ?
>
> Le jeu. 26 juil. 2018 à 21:47, David Morin <mo...@gmail.com> a
> écrit :
>
>> Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for me
>> too.
>> In waiting a patch or a workaround, if you have a jar with an example of
>> Dispatch class it would be great.
>> Thanks
>>
>> Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
>> écrit :
>>
>>> Great, thanks !
>>>
>>> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com> wrote:
>>>
>>>> Yes, I will do that and share here.
>>>>
>>>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hello Dhruv,
>>>>>
>>>>> Can you open a JIRA for this issue, let's track it and try to get it
>>>>> fixed !
>>>>>
>>>>>
>>>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> This is the similar issue we were facing when we tried implementing
>>>>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>>>>> “PassAllHeadersNoEncodingDispatch”
>>>>>> But it didnt worked for me. We will have to write a custom dispatch
>>>>>> class.
>>>>>>
>>>>>> Regards
>>>>>> Dhruv
>>>>>>
>>>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>>>
>>>>>>> You can try putting the jar file under the lib directory and see if
>>>>>>> it works, I should work given all the other jars are found there. There is
>>>>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>>>> dispatch.
>>>>>>>
>>>>>>> Best,
>>>>>>> Sandeep
>>>>>>>
>>>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <
>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>
>>>>>>>> Thanks Sandeep
>>>>>>>> You're right. I have to delete the directory from deployments and
>>>>>>>> restart knox.
>>>>>>>> In fact my Xml files are well taken into account.
>>>>>>>> But my problem is more related to the fact that I face to the
>>>>>>>> double urlencode and my custom dispatch class seems to be ignored.
>>>>>>>>
>>>>>>>>
>>>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com>
>>>>>>>> a écrit :
>>>>>>>>
>>>>>>>>> Hello David,
>>>>>>>>>
>>>>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>>>>> what dispatch Knox is trying to use.
>>>>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>>>>> issue.
>>>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>>>> restarting Knox.
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Sandeep
>>>>>>>>>
>>>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>>>> congrats ! Great job for the doc !
>>>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>>>> "urlencoded" twice:
>>>>>>>>>>
>>>>>>>>>> Rewrote URL:
>>>>>>>>>>
>>>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>>>> **%3A**...
>>>>>>>>>> direction: IN
>>>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>>>> to URL:
>>>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>>>> &startIndex=0...
>>>>>>>>>>
>>>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>>>
>>>>>>>>>> How can I resolve this issue ?
>>>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>>>
>>>>>>>>>> <dispatch
>>>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>>>
>>>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>>>
>>>>>>>>>> Thanks in advance
>>>>>>>>>> Regards,
>>>>>>>>>> David
>>>>>>>>>>
>>>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Hello,

Thanks for your help.
Concerning Logsearch it's quite done. I'll share my work soon. On my github
at the beginning.
Now, I'm going to implement grafana with Knox
Does this feature has already been done ?

Le jeu. 26 juil. 2018 à 21:47, David Morin <mo...@gmail.com> a
écrit :

> Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for me
> too.
> In waiting a patch or a workaround, if you have a jar with an example of
> Dispatch class it would be great.
> Thanks
>
> Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
> écrit :
>
>> Great, thanks !
>>
>> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com> wrote:
>>
>>> Yes, I will do that and share here.
>>>
>>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>>> wrote:
>>>
>>>> Hello Dhruv,
>>>>
>>>> Can you open a JIRA for this issue, let's track it and try to get it
>>>> fixed !
>>>>
>>>>
>>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> This is the similar issue we were facing when we tried implementing
>>>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>>>> “PassAllHeadersNoEncodingDispatch”
>>>>> But it didnt worked for me. We will have to write a custom dispatch
>>>>> class.
>>>>>
>>>>> Regards
>>>>> Dhruv
>>>>>
>>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>>
>>>>>> You can try putting the jar file under the lib directory and see if
>>>>>> it works, I should work given all the other jars are found there. There is
>>>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>>> dispatch.
>>>>>>
>>>>>> Best,
>>>>>> Sandeep
>>>>>>
>>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <
>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>
>>>>>>> Thanks Sandeep
>>>>>>> You're right. I have to delete the directory from deployments and
>>>>>>> restart knox.
>>>>>>> In fact my Xml files are well taken into account.
>>>>>>> But my problem is more related to the fact that I face to the double
>>>>>>> urlencode and my custom dispatch class seems to be ignored.
>>>>>>>
>>>>>>>
>>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com>
>>>>>>> a écrit :
>>>>>>>
>>>>>>>> Hello David,
>>>>>>>>
>>>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>>>> what dispatch Knox is trying to use.
>>>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>>>> issue.
>>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>>> restarting Knox.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> Sandeep
>>>>>>>>
>>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> ​Hello,
>>>>>>>>>
>>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>>> congrats ! Great job for the doc !
>>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>>> "urlencoded" twice:
>>>>>>>>>
>>>>>>>>> Rewrote URL:
>>>>>>>>>
>>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>>> **%3A**...
>>>>>>>>> direction: IN
>>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>>> to URL:
>>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>>> &startIndex=0...
>>>>>>>>>
>>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>>
>>>>>>>>> How can I resolve this issue ?
>>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>>
>>>>>>>>> <dispatch
>>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>>
>>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>>
>>>>>>>>> Thanks in advance
>>>>>>>>> Regards,
>>>>>>>>> David
>>>>>>>>>
>>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Yes, I tried PassAllHeadersNoEncodingDispatch but it didn't work for me too.
In waiting a patch or a workaround, if you have a jar with an example of
Dispatch class it would be great.
Thanks

Le jeu. 26 juil. 2018 à 20:41, Sandeep Moré <mo...@gmail.com> a
écrit :

> Great, thanks !
>
> On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com> wrote:
>
>> Yes, I will do that and share here.
>>
>> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
>> wrote:
>>
>>> Hello Dhruv,
>>>
>>> Can you open a JIRA for this issue, let's track it and try to get it
>>> fixed !
>>>
>>>
>>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> This is the similar issue we were facing when we tried implementing
>>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>>> “PassAllHeadersNoEncodingDispatch”
>>>> But it didnt worked for me. We will have to write a custom dispatch
>>>> class.
>>>>
>>>> Regards
>>>> Dhruv
>>>>
>>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>>> wrote:
>>>>
>>>>> That's weird, if Knox is not picking up the custom dispatch and
>>>>> picking up the XML than are you getting a ClassNotFoundException ?
>>>>>
>>>>> You can try putting the jar file under the lib directory and see if it
>>>>> works, I should work given all the other jars are found there. There is
>>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>>> dispatch.
>>>>>
>>>>> Best,
>>>>> Sandeep
>>>>>
>>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Thanks Sandeep
>>>>>> You're right. I have to delete the directory from deployments and
>>>>>> restart knox.
>>>>>> In fact my Xml files are well taken into account.
>>>>>> But my problem is more related to the fact that I face to the double
>>>>>> urlencode and my custom dispatch class seems to be ignored.
>>>>>>
>>>>>>
>>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com>
>>>>>> a écrit :
>>>>>>
>>>>>>> Hello David,
>>>>>>>
>>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>>> what dispatch Knox is trying to use.
>>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>>> issue.
>>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>>> restarting Knox.
>>>>>>>
>>>>>>> Best,
>>>>>>> Sandeep
>>>>>>>
>>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>>
>>>>>>>> ​Hello,
>>>>>>>>
>>>>>>>> I've just read in detail the Knox dev guide. First of all,
>>>>>>>> congrats ! Great job for the doc !
>>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>>> "urlencoded" twice:
>>>>>>>>
>>>>>>>> Rewrote URL:
>>>>>>>>
>>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>>> **%3A**...
>>>>>>>> direction: IN
>>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>>> to URL:
>>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>>> &startIndex=0...
>>>>>>>>
>>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>>
>>>>>>>> How can I resolve this issue ?
>>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>>
>>>>>>>> <dispatch
>>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>>
>>>>>>>> I've put my Jar that contains this class in the ext directory.
>>>>>>>> Thus, it should be in the classpath.
>>>>>>>>
>>>>>>>> Thanks in advance
>>>>>>>> Regards,
>>>>>>>> David
>>>>>>>>
>>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
Great, thanks !

On Thu, Jul 26, 2018 at 2:33 PM Dhruv Goyal <77...@gmail.com> wrote:

> Yes, I will do that and share here.
>
> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
> wrote:
>
>> Hello Dhruv,
>>
>> Can you open a JIRA for this issue, let's track it and try to get it
>> fixed !
>>
>>
>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> This is the similar issue we were facing when we tried implementing
>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>> “PassAllHeadersNoEncodingDispatch”
>>> But it didnt worked for me. We will have to write a custom dispatch
>>> class.
>>>
>>> Regards
>>> Dhruv
>>>
>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>> wrote:
>>>
>>>> That's weird, if Knox is not picking up the custom dispatch and picking
>>>> up the XML than are you getting a ClassNotFoundException ?
>>>>
>>>> You can try putting the jar file under the lib directory and see if it
>>>> works, I should work given all the other jars are found there. There is
>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>> dispatch.
>>>>
>>>> Best,
>>>> Sandeep
>>>>
>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks Sandeep
>>>>> You're right. I have to delete the directory from deployments and
>>>>> restart knox.
>>>>> In fact my Xml files are well taken into account.
>>>>> But my problem is more related to the fact that I face to the double
>>>>> urlencode and my custom dispatch class seems to be ignored.
>>>>>
>>>>>
>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
>>>>> écrit :
>>>>>
>>>>>> Hello David,
>>>>>>
>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>> what dispatch Knox is trying to use.
>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>> issue.
>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>> restarting Knox.
>>>>>>
>>>>>> Best,
>>>>>> Sandeep
>>>>>>
>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>
>>>>>>> ​Hello,
>>>>>>>
>>>>>>> I've just read in detail the Knox dev guide. First of all, congrats
>>>>>>> ! Great job for the doc !
>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>> "urlencoded" twice:
>>>>>>>
>>>>>>> Rewrote URL:
>>>>>>>
>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>> **%3A**...
>>>>>>> direction: IN
>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>> to URL:
>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>> &startIndex=0...
>>>>>>>
>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>
>>>>>>> How can I resolve this issue ?
>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>
>>>>>>> <dispatch
>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>
>>>>>>> I've put my Jar that contains this class in the ext directory. Thus,
>>>>>>> it should be in the classpath.
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>> Regards,
>>>>>>> David
>>>>>>>
>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Thanks for your help.

Concerning the problem with my dispatch class, here after my custom
dispatch class I've packaged in a jar and then I've put in the ext
directory.
At first step, this is just a class to check that it is taken into account
but it does not seem to be the case.

I've already created a Jira: https://issues.apache.org/jira/browse/KNOX-1400
If you prefer do not hesitate to close it and create a new one.

public class LogsearchDispatch
  extends DefaultDispatch
{
  private static Logger log =
LoggerFactory.getLogger(LogsearchDispatch.class);

  static
  {
    log.info("Static LogsearchDispatch");
  }

  public LogsearchDispatch()
  {
    log.info("LogsearchDispatch");
  }

  @Override
  public void init()
  {
    super.init();
    log.info("Init LogsearchDispatch");
  }

  @Override
  public URI getDispatchUrl(HttpServletRequest request)
  {
    String base = request.getRequestURI();
    log.info("base: " + base);
    StringBuffer str = new StringBuffer();
    try
    {
      str.append(URLDecoder.decode(base, "UTF-8"));
    }
    catch (UnsupportedEncodingException e)
    {
      str.append(base);
    }
    String query = request.getQueryString();
    if (query != null)
    {
      str.append('?');
      str.append(query);
    }
    URI uri = URI.create(str.toString());
    return uri;
  }
}

Le jeu. 26 juil. 2018 à 20:33, Dhruv Goyal <77...@gmail.com> a écrit :

> Yes, I will do that and share here.
>
> On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com>
> wrote:
>
>> Hello Dhruv,
>>
>> Can you open a JIRA for this issue, let's track it and try to get it
>> fixed !
>>
>>
>> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> This is the similar issue we were facing when we tried implementing
>>> grafana with knox, it is encoded twice in grafana as well, I tried using
>>> “PassAllHeadersNoEncodingDispatch”
>>> But it didnt worked for me. We will have to write a custom dispatch
>>> class.
>>>
>>> Regards
>>> Dhruv
>>>
>>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>>> wrote:
>>>
>>>> That's weird, if Knox is not picking up the custom dispatch and picking
>>>> up the XML than are you getting a ClassNotFoundException ?
>>>>
>>>> You can try putting the jar file under the lib directory and see if it
>>>> works, I should work given all the other jars are found there. There is
>>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>>> dispatch.
>>>>
>>>> Best,
>>>> Sandeep
>>>>
>>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks Sandeep
>>>>> You're right. I have to delete the directory from deployments and
>>>>> restart knox.
>>>>> In fact my Xml files are well taken into account.
>>>>> But my problem is more related to the fact that I face to the double
>>>>> urlencode and my custom dispatch class seems to be ignored.
>>>>>
>>>>>
>>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
>>>>> écrit :
>>>>>
>>>>>> Hello David,
>>>>>>
>>>>>> This should have worked, if you turn the debug log on you can see
>>>>>> what dispatch Knox is trying to use.
>>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>>> issue.
>>>>>> If it still does not work, try clearing the deployments dir and
>>>>>> restarting Knox.
>>>>>>
>>>>>> Best,
>>>>>> Sandeep
>>>>>>
>>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>>
>>>>>>> ​Hello,
>>>>>>>
>>>>>>> I've just read in detail the Knox dev guide. First of all, congrats
>>>>>>> ! Great job for the doc !
>>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>>> I've created some XML files. These files are in PJs.
>>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>>> "urlencoded" twice:
>>>>>>>
>>>>>>> Rewrote URL:
>>>>>>>
>>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>>> **%3A**...
>>>>>>> direction: IN
>>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>>> to URL:
>>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>>> &startIndex=0...
>>>>>>>
>>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>>
>>>>>>> How can I resolve this issue ?
>>>>>>> I've written a custom dispatch class and reference it in the
>>>>>>> service.xml but my class seems to be ignored.
>>>>>>>
>>>>>>> <dispatch
>>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>>
>>>>>>> I've put my Jar that contains this class in the ext directory. Thus,
>>>>>>> it should be in the classpath.
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>> Regards,
>>>>>>> David
>>>>>>>
>>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Dhruv Goyal <77...@gmail.com>.
Yes, I will do that and share here.

On Fri, 27 Jul 2018 at 12:01 AM, Sandeep Moré <mo...@gmail.com> wrote:

> Hello Dhruv,
>
> Can you open a JIRA for this issue, let's track it and try to get it fixed
> !
>
>
> On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com> wrote:
>
>> Hi,
>>
>> This is the similar issue we were facing when we tried implementing
>> grafana with knox, it is encoded twice in grafana as well, I tried using
>> “PassAllHeadersNoEncodingDispatch”
>> But it didnt worked for me. We will have to write a custom dispatch class.
>>
>> Regards
>> Dhruv
>>
>> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
>> wrote:
>>
>>> That's weird, if Knox is not picking up the custom dispatch and picking
>>> up the XML than are you getting a ClassNotFoundException ?
>>>
>>> You can try putting the jar file under the lib directory and see if it
>>> works, I should work given all the other jars are found there. There is
>>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>>> use, I believe 0.12.0 has it, that way you don't have to write custom
>>> dispatch.
>>>
>>> Best,
>>> Sandeep
>>>
>>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
>>> wrote:
>>>
>>>> Thanks Sandeep
>>>> You're right. I have to delete the directory from deployments and
>>>> restart knox.
>>>> In fact my Xml files are well taken into account.
>>>> But my problem is more related to the fact that I face to the double
>>>> urlencode and my custom dispatch class seems to be ignored.
>>>>
>>>>
>>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
>>>> écrit :
>>>>
>>>>> Hello David,
>>>>>
>>>>> This should have worked, if you turn the debug log on you can see what
>>>>> dispatch Knox is trying to use.
>>>>> Also, if the changes are in service.xml then we need to touch the
>>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>>> issue.
>>>>> If it still does not work, try clearing the deployments dir and
>>>>> restarting Knox.
>>>>>
>>>>> Best,
>>>>> Sandeep
>>>>>
>>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <
>>>>> morin.david.bzh@gmail.com> wrote:
>>>>>
>>>>>> ​Hello,
>>>>>>
>>>>>> I've just read in detail the Knox dev guide. First of all, congrats
>>>>>> ! Great job for the doc !
>>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>>> I've created some XML files. These files are in PJs.
>>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>>> "urlencoded" twice:
>>>>>>
>>>>>> Rewrote URL:
>>>>>>
>>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>>> **%3A**...
>>>>>> direction: IN
>>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>>> to URL:
>>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>>> &startIndex=0...
>>>>>>
>>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>>
>>>>>> How can I resolve this issue ?
>>>>>> I've written a custom dispatch class and reference it in the
>>>>>> service.xml but my class seems to be ignored.
>>>>>>
>>>>>> <dispatch
>>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>>
>>>>>> I've put my Jar that contains this class in the ext directory. Thus,
>>>>>> it should be in the classpath.
>>>>>>
>>>>>> Thanks in advance
>>>>>> Regards,
>>>>>> David
>>>>>>
>>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
Hello Dhruv,

Can you open a JIRA for this issue, let's track it and try to get it fixed !

On Thu, Jul 26, 2018 at 2:26 PM Dhruv Goyal <77...@gmail.com> wrote:

> Hi,
>
> This is the similar issue we were facing when we tried implementing
> grafana with knox, it is encoded twice in grafana as well, I tried using
> “PassAllHeadersNoEncodingDispatch”
> But it didnt worked for me. We will have to write a custom dispatch class.
>
> Regards
> Dhruv
>
> On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com>
> wrote:
>
>> That's weird, if Knox is not picking up the custom dispatch and picking
>> up the XML than are you getting a ClassNotFoundException ?
>>
>> You can try putting the jar file under the lib directory and see if it
>> works, I should work given all the other jars are found there. There is
>> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
>> use, I believe 0.12.0 has it, that way you don't have to write custom
>> dispatch.
>>
>> Best,
>> Sandeep
>>
>> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
>> wrote:
>>
>>> Thanks Sandeep
>>> You're right. I have to delete the directory from deployments and
>>> restart knox.
>>> In fact my Xml files are well taken into account.
>>> But my problem is more related to the fact that I face to the double
>>> urlencode and my custom dispatch class seems to be ignored.
>>>
>>>
>>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
>>> écrit :
>>>
>>>> Hello David,
>>>>
>>>> This should have worked, if you turn the debug log on you can see what
>>>> dispatch Knox is trying to use.
>>>> Also, if the changes are in service.xml then we need to touch the
>>>> topology file so that Knox reloads it, I am thinking this could be an
>>>> issue.
>>>> If it still does not work, try clearing the deployments dir and
>>>> restarting Knox.
>>>>
>>>> Best,
>>>> Sandeep
>>>>
>>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <mo...@gmail.com>
>>>> wrote:
>>>>
>>>>> ​Hello,
>>>>>
>>>>> I've just read in detail the Knox dev guide. First of all, congrats !
>>>>> Great job for the doc !
>>>>> But I face to an issue with logsearch on my HDP cluster.
>>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>>> I've created some XML files. These files are in PJs.
>>>>> But I face to some 403 requests. In fact, some urls have been
>>>>> "urlencoded" twice:
>>>>>
>>>>> Rewrote URL:
>>>>>
>>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>>> **%3A**...
>>>>> direction: IN
>>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>>> to URL:
>>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>>> &startIndex=0...
>>>>>
>>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>>
>>>>> How can I resolve this issue ?
>>>>> I've written a custom dispatch class and reference it in the
>>>>> service.xml but my class seems to be ignored.
>>>>>
>>>>> <dispatch
>>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>>
>>>>> I've put my Jar that contains this class in the ext directory. Thus,
>>>>> it should be in the classpath.
>>>>>
>>>>> Thanks in advance
>>>>> Regards,
>>>>> David
>>>>>
>>>>>

Re: Knox: how to create a custom dispatch class

Posted by Dhruv Goyal <77...@gmail.com>.
Hi,

This is the similar issue we were facing when we tried implementing grafana
with knox, it is encoded twice in grafana as well, I tried using
“PassAllHeadersNoEncodingDispatch”
But it didnt worked for me. We will have to write a custom dispatch class.

Regards
Dhruv

On Thu, 26 Jul 2018 at 11:51 PM, Sandeep Moré <mo...@gmail.com> wrote:

> That's weird, if Knox is not picking up the custom dispatch and picking up
> the XML than are you getting a ClassNotFoundException ?
>
> You can try putting the jar file under the lib directory and see if it
> works, I should work given all the other jars are found there. There is
> also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
> use, I believe 0.12.0 has it, that way you don't have to write custom
> dispatch.
>
> Best,
> Sandeep
>
> On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
> wrote:
>
>> Thanks Sandeep
>> You're right. I have to delete the directory from deployments and restart
>> knox.
>> In fact my Xml files are well taken into account.
>> But my problem is more related to the fact that I face to the double
>> urlencode and my custom dispatch class seems to be ignored.
>>
>>
>> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
>> écrit :
>>
>>> Hello David,
>>>
>>> This should have worked, if you turn the debug log on you can see what
>>> dispatch Knox is trying to use.
>>> Also, if the changes are in service.xml then we need to touch the
>>> topology file so that Knox reloads it, I am thinking this could be an
>>> issue.
>>> If it still does not work, try clearing the deployments dir and
>>> restarting Knox.
>>>
>>> Best,
>>> Sandeep
>>>
>>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <mo...@gmail.com>
>>> wrote:
>>>
>>>> ​Hello,
>>>>
>>>> I've just read in detail the Knox dev guide. First of all, congrats !
>>>> Great job for the doc !
>>>> But I face to an issue with logsearch on my HDP cluster.
>>>> This is a HDP 2.6.5 with Knox 0.12.0
>>>> I've created some XML files. These files are in PJs.
>>>> But I face to some 403 requests. In fact, some urls have been
>>>> "urlencoded" twice:
>>>>
>>>> Rewrote URL:
>>>>
>>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>>> **%3A**...
>>>> direction: IN
>>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>>> to URL:
>>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>>> &startIndex=0...
>>>>
>>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>>
>>>> How can I resolve this issue ?
>>>> I've written a custom dispatch class and reference it in the
>>>> service.xml but my class seems to be ignored.
>>>>
>>>> <dispatch
>>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>>
>>>> I've put my Jar that contains this class in the ext directory. Thus, it
>>>> should be in the classpath.
>>>>
>>>> Thanks in advance
>>>> Regards,
>>>> David
>>>>
>>>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
That's weird, if Knox is not picking up the custom dispatch and picking up
the XML than are you getting a ClassNotFoundException ?

You can try putting the jar file under the lib directory and see if it
works, I should work given all the other jars are found there. There is
also a "PassAllHeadersNoEncodingDispatch"  dispatch that you can try to
use, I believe 0.12.0 has it, that way you don't have to write custom
dispatch.

Best,
Sandeep

On Thu, Jul 26, 2018 at 2:11 PM David Morin <mo...@gmail.com>
wrote:

> Thanks Sandeep
> You're right. I have to delete the directory from deployments and restart
> knox.
> In fact my Xml files are well taken into account.
> But my problem is more related to the fact that I face to the double
> urlencode and my custom dispatch class seems to be ignored.
>
>
> Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
> écrit :
>
>> Hello David,
>>
>> This should have worked, if you turn the debug log on you can see what
>> dispatch Knox is trying to use.
>> Also, if the changes are in service.xml then we need to touch the
>> topology file so that Knox reloads it, I am thinking this could be an
>> issue.
>> If it still does not work, try clearing the deployments dir and
>> restarting Knox.
>>
>> Best,
>> Sandeep
>>
>> On Thu, Jul 26, 2018 at 12:25 PM David Morin <mo...@gmail.com>
>> wrote:
>>
>>> ​Hello,
>>>
>>> I've just read in detail the Knox dev guide. First of all, congrats !
>>> Great job for the doc !
>>> But I face to an issue with logsearch on my HDP cluster.
>>> This is a HDP 2.6.5 with Knox 0.12.0
>>> I've created some XML files. These files are in PJs.
>>> But I face to some 403 requests. In fact, some urls have been
>>> "urlencoded" twice:
>>>
>>> Rewrote URL:
>>>
>>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>>> **%3A**...
>>> direction: IN
>>> via implicit rule: LOGSEARCH/logsearch/inbound
>>> to URL:
>>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>>> &startIndex=0...
>>>
>>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>>
>>> How can I resolve this issue ?
>>> I've written a custom dispatch class and reference it in the service.xml
>>> but my class seems to be ignored.
>>>
>>> <dispatch
>>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>>
>>> I've put my Jar that contains this class in the ext directory. Thus, it
>>> should be in the classpath.
>>>
>>> Thanks in advance
>>> Regards,
>>> David
>>>
>>>

Re: Knox: how to create a custom dispatch class

Posted by David Morin <mo...@gmail.com>.
Thanks Sandeep
You're right. I have to delete the directory from deployments and restart
knox.
In fact my Xml files are well taken into account.
But my problem is more related to the fact that I face to the double
urlencode and my custom dispatch class seems to be ignored.


Le jeu. 26 juil. 2018 à 19:59, Sandeep Moré <mo...@gmail.com> a
écrit :

> Hello David,
>
> This should have worked, if you turn the debug log on you can see what
> dispatch Knox is trying to use.
> Also, if the changes are in service.xml then we need to touch the topology
> file so that Knox reloads it, I am thinking this could be an issue.
> If it still does not work, try clearing the deployments dir and restarting
> Knox.
>
> Best,
> Sandeep
>
> On Thu, Jul 26, 2018 at 12:25 PM David Morin <mo...@gmail.com>
> wrote:
>
>> ​Hello,
>>
>> I've just read in detail the Knox dev guide. First of all, congrats !
>> Great job for the doc !
>> But I face to an issue with logsearch on my HDP cluster.
>> This is a HDP 2.6.5 with Knox 0.12.0
>> I've created some XML files. These files are in PJs.
>> But I face to some 403 requests. In fact, some urls have been
>> "urlencoded" twice:
>>
>> Rewrote URL:
>>
>> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
>> **%3A**...
>> direction: IN
>> via implicit rule: LOGSEARCH/logsearch/inbound
>> to URL:
>> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**
>> &startIndex=0...
>>
>> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>>
>> How can I resolve this issue ?
>> I've written a custom dispatch class and reference it in the service.xml
>> but my class seems to be ignored.
>>
>> <dispatch
>> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>>
>> I've put my Jar that contains this class in the ext directory. Thus, it
>> should be in the classpath.
>>
>> Thanks in advance
>> Regards,
>> David
>>
>>

Re: Knox: how to create a custom dispatch class

Posted by Sandeep Moré <mo...@gmail.com>.
Hello David,

This should have worked, if you turn the debug log on you can see what
dispatch Knox is trying to use.
Also, if the changes are in service.xml then we need to touch the topology
file so that Knox reloads it, I am thinking this could be an issue.
If it still does not work, try clearing the deployments dir and restarting
Knox.

Best,
Sandeep

On Thu, Jul 26, 2018 at 12:25 PM David Morin <mo...@gmail.com>
wrote:

> ​Hello,
>
> I've just read in detail the Knox dev guide. First of all, congrats !
> Great job for the doc !
> But I face to an issue with logsearch on my HDP cluster.
> This is a HDP 2.6.5 with Knox 0.12.0
> I've created some XML files. These files are in PJs.
> But I face to some 403 requests. In fact, some urls have been "urlencoded"
> twice:
>
> Rewrote URL:
>
> http://XXX:80/gateway/default/logsearch/api/v1/service/logs/histogram?page=0&pageSize=999999999&startIndex=0&q=
> **%3A**...
> direction: IN
> via implicit rule: LOGSEARCH/logsearch/inbound
> to URL:
> http://XXX:61888/api/v1/service/logs/histogram?q=**%253A**&startIndex=0...
>
> Thus, we've got the string "q=%3A" replaced by "q=%253A"
>
> How can I resolve this issue ?
> I've written a custom dispatch class and reference it in the service.xml
> but my class seems to be ignored.
>
> <dispatch
> classname="org.apache.hadoop.gateway.logsearch.LogsearchDispatch"/>
>
> I've put my Jar that contains this class in the ext directory. Thus, it
> should be in the classpath.
>
> Thanks in advance
> Regards,
> David
>
>