aw at ice-sa
Nov 20, 2010, 9:43 AM
Post #3 of 6
Ryan Gies wrote:
Re: Mod-jk worker not being called after calling Perl handler
[In reply to]
> Have you tried returning Apache2::Const::DECLINED instead?
> On 11/20/2010 12:09 AM, Mohit Anchlia wrote:
>> I am trying to look at how handlers work so I created a very simple
>> perl handler that just return "OK". And I added an entry "PerlModule"
>> and the "PerlHandler". I also was able to build mod_perl2.so. When I
>> do a GET request with handler ON I see that Handler gets called but
>> then the call is not going further to the mod-jk worker. Can someone
>> please tell me what might be going on? I thought OK will continue down
>> the cycle.
Ryan's answer above is correct, but here is a tad more information :
After Apache has done a lot of other things already, it looks for a handler to actually
generate the response for the client.
There can only be one of those of course, because only one response can be sent to the client.
So the first response handler which is called and which responds "OK" wins : Apache will
not call another one after that.
In your case, mod_jk and mod_perl are both response handlers (and, in the case of
mod_perl, it is in fact your own handler module, which is like a sub-handler of mod_perl).
For some reason, the mod_perl handler gets called first, before mod_jk.
And it returns OK.
So Apache never calls mod_jk.
If you want mod_jk to have a go, you must thus, in your own handler, return "DECLINED".
Then Apache will try mod_jk.
By the way, mod_jk could also return DECLINED.
(For example, if you have a "JkUnMount /*.txt" directive, and the URL happens to match that.)
In that case, Apache will call the next possible response handler. If they all return
DECLINED, then finally Apache will call its own default response handler. That is the one
that will look for the requested file on the disk, and send it as a response if it finds it.
For a response handler, returning DECLINED is like saying to Apache : "well, I had a
second look at this URL, and this is definitely not for me, find someone else".
Of course, in a mod_perl handler you can cheat, that's part of the fun.
You can do something with the URL, and then still return DECLINED.
Apache will then think that you have done nothing, and call the next handler.