How to write a handler

How to write a handler

am 31.07.2009 13:11:27 von Sudheer Puppala

--000325574c1642da21046ffe7bca
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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.


Thanks
Sudheer Puppala

--000325574c1642da21046ffe7bca
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi


=A0 I am java/flex programmer since 1yrs and a little bit of perl. I hav=
e a requirement of write a
handler at apache http server side using perl=
..


Scenario:



=A0 1. My flex application request for a particular file to the apac=
he
=A0 server.
=A0 2. The server upon receiving a request look for th=
e mime type of the


=A0 file. If that file mime type is video/flv or .flv I should write a h=
andler
=A0 for that.


=A0 3. The handler should be in a position to call a java class. where I=
will


=A0 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 fo=
r that. So
could any one help me with an example.



Thanks
Sudheer Puppala



--000325574c1642da21046ffe7bca--

Re: How to write a handler

am 31.07.2009 14:51:27 von Adam Prime

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

Hopefully that should point you in the right direction.

Adam

Re: How to write a handler

am 31.07.2009 15:50:18 von aw

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