Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Intercepting and modifying response

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


rsharma51 at sapient

Jun 15, 2012, 7:12 AM

Post #1 of 5 (556 views)
Permalink
Intercepting and modifying response

All,

I need to intercept and modify the response that is coming from JBOSS to the Apache Web (httpd) server and being returned to the client.

Planning to use perl to edit the response using mod_perl. Does mod_perl allow this with no adverse effects? If yes, then how do we go about it?

Thanks,
Rommel.


aw at ice-sa

Jun 15, 2012, 7:49 AM

Post #2 of 5 (532 views)
Permalink
Re: Intercepting and modifying response [In reply to]

Rommel Sharma wrote:
> All,
>
> I need to intercept and modify the response that is coming from JBOSS to the Apache Web
(httpd) server and being returned to the client.
>

What is the connector module used between Apache httpd and JBOSS ? How is it configured ?
(more explicitly, how in the Apache httpd configuration, do you specify which requests
that have to be passed to JBOSS, an which not ?)

> Planning to use perl to edit the response using mod_perl. Does mod_perl allow this with
no adverse effects?

Define "adverse effects" ?
mod_perl may allow you to modify the JBOSS reponse, if it is possible to insert a mod_perl
handler in the right place to modify the response coming from JBOSS, before it is returned
to the client.

If yes, then how do we go about it?

Maybe by remembering first that you are on a support list manned by volunteers, where
being gracious helps getting answers.


torsten.foertsch at gmx

Jun 15, 2012, 9:29 AM

Post #3 of 5 (528 views)
Permalink
Re: Intercepting and modifying response [In reply to]

On 06/15/2012 04:12 PM, Rommel Sharma wrote:
> I need to intercept and modify the response that is coming from JBOSS to the Apache Web (httpd) server and being returned to the client.

Look for PerlOutputFilterHandler in the docs.

Torsten


rsharma51 at sapient

Jun 16, 2012, 6:22 AM

Post #4 of 5 (522 views)
Permalink
RE: Intercepting and modifying response [In reply to]

Hi André,

Thanks for the reply. Details are below.

Before that would like to mention - I am new to mod_perl usage and the setup is only on my dev machine where I am testing the scenario described.
Therefore looking for the right directions from the experienced users in this group. Sample code/reference to such would help very much.

> What is the connector module used between Apache httpd and JBOSS ? How is it configured ?
>(more explicitly, how in the Apache httpd configuration, do you specify which requests that have to be passed to JBOSS, an which not ?)

Using mod_jk setup. (JkMount).

> Define "adverse effects" ? mod_perl may allow you to modify the JBOSS response, if it is possible to insert a mod_perl
> handler in the right place to modify the response coming from JBOSS, before it is returned to the client.

By adverse effects I meant if I write a perl program that receives the response from the jboss server, that does some pattern matching and replaces a few strings from each response will it slow down the server significantly? Am I better off handling this in a servlet filter?

On mod_perl - some pointers to get started with such request intercepting will be great as I have not worked with it before.

Many thanks well in advance for the much needed inputs!

Rommel.

-----Original Message-----
From: André Warnier [mailto:aw [at] ice-sa]
Sent: Friday, June 15, 2012 8:19 PM
To: mod_perl list
Subject: Re: Intercepting and modifying response

Rommel Sharma wrote:
> All,
>
> I need to intercept and modify the response that is coming from JBOSS to the Apache Web
(httpd) server and being returned to the client.
>

What is the connector module used between Apache httpd and JBOSS ? How is it configured ?
(more explicitly, how in the Apache httpd configuration, do you specify which requests
that have to be passed to JBOSS, an which not ?)

> Planning to use perl to edit the response using mod_perl. Does mod_perl allow this with
no adverse effects?

Define "adverse effects" ?
mod_perl may allow you to modify the JBOSS reponse, if it is possible to insert a mod_perl
handler in the right place to modify the response coming from JBOSS, before it is returned
to the client.

If yes, then how do we go about it?

Maybe by remembering first that you are on a support list manned by volunteers, where
being gracious helps getting answers.


rsharma51 at sapient

Jun 22, 2012, 12:55 AM

Post #5 of 5 (475 views)
Permalink
RE: Intercepting and modifying response [In reply to]

Thanks All, using PerlOutputFilterHandler gives me the desired result for the pages in htdocs for the <Location ...> specification..
[using the inputs from this group and http://www.gossamer-threads.com/lists/modperl/modperl/104437].

Now I am noting that my earlier integration of Apache with JBoss where I am redirecting based on certain paths is not working. If I remove the output filter the jboss page shows, but when I put it (httpd.conf) the display of dynamic content from Jboss stops. E.g. in mod-jk.conf:

JkMount /jspweb/* node1

What am I missing here? Many thanks for your inputs in advance!

Thanks,
Rommel.
-----Original Message-----
From: Dr James A Smith [mailto:js5 [at] sanger]
Sent: Saturday, June 16, 2012 10:54 PM
To: Rommel Sharma
Cc: mod_perl list
Subject: Re: Intercepting and modifying response

On 16/06/2012 14:22, Rommel Sharma wrote:
> Hi André,
>
> Thanks for the reply. Details are below.
>
> Before that would like to mention - I am new to mod_perl usage and the setup is only on my dev machine where I am testing the scenario described.
> Therefore looking for the right directions from the experienced users in this group. Sample code/reference to such would help very much.
>
>> What is the connector module used between Apache httpd and JBOSS ? How is it configured ?
>> (more explicitly, how in the Apache httpd configuration, do you specify which requests that have to be passed to JBOSS, an which not ?)
>
> Using mod_jk setup. (JkMount).
>
>> Define "adverse effects" ? mod_perl may allow you to modify the JBOSS response, if it is possible to insert a mod_perl
>> handler in the right place to modify the response coming from JBOSS, before it is returned to the client.
>
> By adverse effects I meant if I write a perl program that receives the response from the jboss server, that does some pattern matching and replaces a few strings from each response will it slow down the server significantly? Am I better off handling this in a servlet filter?
>
> On mod_perl - some pointers to get started with such request intercepting will be great as I have not worked with it before.
>
> Many thanks well in advance for the much needed inputs!
>
> Rommel.
>
> -----Original Message-----
> From: André Warnier [mailto:aw [at] ice-sa]
> Sent: Friday, June 15, 2012 8:19 PM
> To: mod_perl list
> Subject: Re: Intercepting and modifying response
>
> Rommel Sharma wrote:
> > All,
> >
> > I need to intercept and modify the response that is coming from JBOSS to the Apache Web
> (httpd) server and being returned to the client.
> >
>
> What is the connector module used between Apache httpd and JBOSS ? How is it configured ?
> (more explicitly, how in the Apache httpd configuration, do you specify which requests
> that have to be passed to JBOSS, an which not ?)
>
> > Planning to use perl to edit the response using mod_perl. Does mod_perl allow this with
> no adverse effects?
>
> Define "adverse effects" ?
> mod_perl may allow you to modify the JBOSS reponse, if it is possible to insert a mod_perl
> handler in the right place to modify the response coming from JBOSS, before it is returned
> to the client.
>
> If yes, then how do we go about it?
>
> Maybe by remembering first that you are on a support list manned by volunteers, where
> being gracious helps getting answers.
>

As others have pointed out this works as you are using mod_jk, look at
OutputFilters - we use output filters to "wrap/template" a number of our
websites.

By using this method we are able to wrap, static content, output from
other mod_perl handlers, php scripts, ruby scripts, output from others
servers - tomcat servers behind mod_jk other perl servers using
mod_proxy... All with a common method... not seen any "adverse" effects
with performance..

James

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.