Adam Prime wrote:
Sudheer Puppala wrote:
Hi
I am java/flex programmer since 1yrs and a little bit of perl. I
have a requirement of write a
handler at apache http server side using perl.
Scenario:
1. My flex application request for a particular file to the apache
server.
2. The server upon receiving a request look for the mime type of the
file. If that file mime type is video/flv or .flv I should write a
handler
for that.
3. The handler should be in a position to call a java class. where I
will
decrypt the fille and send it back to the flex application.
Here my request is how can I write my own handler? where can I write
it? and
as I am not a perl programmer, I am not getting the solution for that. So
could any one help me with an example.
I'd start here:
http://perl.apache.org/docs/2.0/user/handlers/intro.html
to get the headers (including the content-type) from the incoming request:
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_in_
to run Java code you can look at:
http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod
--- OR (alternatively) -----
"Behind" your Apache httpd server, you can run an Apache Tomcat server,
which is a Java servlet engine specialised for that.
Your front-end Apache module can, if necessary, forward a request to the
back-end Tomcat server. The back-end Tomcat server runs the request
(and the Java application). The result comes back to your front-end
mod_perl module, which returns it to the client.
Schematically :
A) If the request is entirely processed by the mod_perl handler in Apache :
in) Client --> Apache httpd --> mod_perl handler
out) Client <-- Apache httpd <-- mod_perl handler
B) If the request requires a processing by a Java application :
in) Client --> Apache httpd --> mod_perl handler --> Tomcat --> Java app
out) Client <-- Apache httpd <-- mod_perl handler <-- Tomcat <-- Java app
One of the basic Perl mottos is : There Is More Than One Way To Do It