Hi, I’m trying to configure a jruby on rails app on tomcat and
jruby-rack
and I found an issue that I don’t understand.
The problem is that I have two more filters defined into my web.xml and
I
want that RackFilter will be executed the second one, so, the order I’ve
declared them and their mappings in the file is this:
- MyFilter1
- RackFilter
- MyFilter2
But, when I start tomcat, the order that it executes filters’ chain is
this:
- RackFilter
- MyFilter2
- MyFilter1
No matters where I’ll declare RackFilter and it’s mapping but it’s
always
executed first.
By the way, I’ve read this in the jruby-rack wiki:
The application can also be configured to dispatch through a servlet
instead of a filter if it suits your environment better.
But I can’t find any example of how to do it so because the
DefaultServletDispatcher needs a ServletRackContext to be initilized and
I
can’t define it in the web.xml
Any help will be really appreciated.
Cheers
On Wed, Jun 24, 2009 at 8:28 AM, David C.
[email protected]wrote:
But, when I start tomcat, the order that it executes filters’ chain is
this:
- RackFilter
- MyFilter2
- MyFilter1
No matters where I’ll declare RackFilter and it’s mapping but it’s always
executed first.
That’s odd. Can you share how you define the filters in web.xml?
can’t define it in the web.xml
Sure, there’s a servlet org.jruby.rack.RackServlet, just go ahead and
use it
instead of RackFilter in web.xml like you would any servlet with
and elements.
By the way, thanks for working on Tomcat-Rails – looking forward to
trying
it out.
/Nick
Thank you Nick,
it works fine with the RackServlet, I hadn’t seen it.
But the behavior with the filter is actually annoying. I’m using two
different versions of tomcat, 6.0.18 standalone and 6.0.20 embedded and
the
behavior is the same. These are my filter defs, the last one there is
just
to test the order:
> OpenSessionInView
> /*
>
>
On Wed, Jun 24, 2009 at 10:58 AM, David C.
[email protected]wrote:
Thank you Nick,
it works fine with the RackServlet, I hadn’t seen it.
But the behavior with the filter is actually annoying. I’m using two
different versions of tomcat, 6.0.18 standalone and 6.0.20 embedded and the
behavior is the same. These are my filter defs, the last one there is just
to test the order:
Was that the actual order of elements in web.xml? The only suggestion I
have
is to order them like ( filter* filter-mapping* servlet*
servlet-mapping* ).
I’ve seen that some containers are sensitive to the order in which the
elements appear.
/Nick