You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by masukomi <ma...@masukomi.org> on 2001/12/04 23:44:26 UTC

need to modify incoming get and post BEFORE sent on to servlets

I need to write a little app that will catch all incoming GETs and POSTs check where 
they are going, and alter it if it matches a cached alias (which could be updated by 
any servlet that wanted to send it a message with new info). 

I would like to write this so that it can work on anyones system not just with my 
other servlets. 

i would like to result to work like this

-tomcat gets a request
-get string is analized and maybe modified
-tomcat ships it off to whatever page or servlet should process it as if the url 
  had never been modified. 

I'm hoping there is a way to do this without actually modifying tomcat or having to 
use "Location:" redirects but I haven't seen anything. And "Context" assumes you 
know what should handle it. Preferably this would be a simple black box that anyone 
can install with a public method that allows other apps to notify it about new or 
modified aliases. This way it can store aliases in a db or a flat file or change any 
aspect of how the aliases are managed or cached without people needing to alter 
their apps.  

basically I'm wondering where my code needs to go to acheive this and where i shoudl 
go to find info on that (if it's not obvious). 

-kate





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: need to modify incoming get and post BEFORE sent on to servlets

Posted by "Craig R. McClanahan" <cr...@apache.org>.
*** PLEASE *** ask user questions like this on the TOMCAT-USER list
instead of here!


On Tue, 4 Dec 2001, masukomi wrote:

> Date: Tue, 4 Dec 2001 17:44:26 -0500 (EST)
> From: masukomi <ma...@masukomi.org>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: tomcat-dev@jakarta.apache.org
> Subject: need to modify incoming get and post BEFORE sent on to servlets
>
> I need to write a little app that will catch all incoming GETs and
> POSTs check where they are going, and alter it if it matches a cached
> alias (which could be updated by any servlet that wanted to send it a
> message with new info).
>
> I would like to write this so that it can work on anyones system not
> just with my other servlets.
>
> i would like to result to work like this
>
> -tomcat gets a request
> -get string is analized and maybe modified
> -tomcat ships it off to whatever page or servlet should process it as if the url
>   had never been modified.
>
> I'm hoping there is a way to do this without actually modifying tomcat
> or having to use "Location:" redirects but I haven't seen anything.
> And "Context" assumes you know what should handle it. Preferably this
> would be a simple black box that anyone can install with a public
> method that allows other apps to notify it about new or modified
> aliases. This way it can store aliases in a db or a flat file or
> change any aspect of how the aliases are managed or cached without
> people needing to alter their apps.
>
> basically I'm wondering where my code needs to go to acheive this and
> where i shoudl go to find info on that (if it's not obvious).
>
> -kate
>

In a Servlet 2.3 based environment (like Tomcat 4), this kind of thing can
be done with a Filter.  Otherwise, you're going to be stuck with
Tomcat-specific extensions (a RequestInterceptor for 3.x or a Valve for
4.x).

Craig McClanahan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>