tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <>
Subject RE: [PATCH] Apache2 mod_jk2
Date Tue, 04 Jun 2002 18:04:10 GMT
> -----Original Message-----
> From: [] 
> Sent: 30. svibanj 2002 16:56
> To: Mladen Turk
> Cc: 'Ignacio J. Ortega'
> Subject: RE: [PATCH] Apache2 mod_jk2
> On Thu, 30 May 2002, Mladen Turk wrote:
> > For start I would like to implement the Apache2 servlet input and 
> > output filter. And yes, my general idea is to make that 
> something like 
> > mod_perl, to allow writing apache modules using java.
> > The second thing is IMO beyond tomcat scope, probably a whole new
> > project.
> :-)
> I can't say how happy I am to find there are other people 
> interested in 
> 'writing apache modules in java' or mixing apache modules and 
> java servlets.
> That was one of the reasons for me getting involved with 
> jserv and tomcat ( many years ago ). After few years I still 
> didn't get this to work - so again, be warned, it's not going 
> to be easy !
> If you want to start with Apache2 ( C ) based servlet i/o 
> filters, I sugest you start with something like a compression 
> filter, that can be a proof of concept.
> I assume you'll need extra callbacks in mod_jk. Probably some 
> special java-side filter that will be configured in web.xml 
> and will communicate directly with mod_jk, telling it to add 
> the right filter. At least that's what I would do, but as I 
> said my results so far are a failure ( I 
> can claim lack of time, or underestimating the complexity :-).
> In any case, it may be a good idea moving this discussion to 
> tomcat-dev. Let me know if/how I can help ( if I can't do it 
> at least I can try to help :-).
> Costin

Well, I've put that on paper (look at the attachment), and something
'crude' could be finished relatively quickly :)
I was planning to use the existing mod_jk2 and make the needed

There will be four classes dealing with particular Apache hook 
1. Handler
2. Input Filter
3. Output Filter
4. Protocol

Each of the hooks will have unlimited (well, if you have unlimited
memory) numbers of unique named modules.
So, something like in httpd.conf for handlers:

JavaHandler someHandler "/home/somehandler.jar"
JavaHandler anotherHandler "/home/anotherhandler.jar"
<Location /some-handler>
    SetJavaHandler someHandler

<Files *.jsxx>
    SetJavaHandler anotherHandler

1. The directive JavaHandler will load the handlers in the handlers
2. The per-directory SetJavaHandler will associate the location with
particular handler
3. On first invocation will create the JVM and call the Initialize
method from someHandler class
4. AjkHandler will load the callbacks from mod_jk2.
5. rock'n'roll

Each module will be ran inside its own JVM for now, this can be wrapped
with the JVM pool, and using the inactive one.
I've done that for my experimental Mozilla JavaScript module for
js_runtime (suppose it can be done with JVM too).

All that is for the pure Java modules without Tomcat at all.
It can be used inside the Tomcat itself, but only using jni or writing
new protocol stack (something like RPC), but I'm not sure what would be
the purpose of that. I'll be glad to hear some thoughts on that.

Comments will be more then welcome.


View raw message