thanks for the good suggestion Chris - that is what exactly I am looking for.
I tried it and got part that involves reading the cookie from the Request and setting 
a request object (easy part though). I seem to have problems implementing the 
HttpServletResponseWrapper to collect the response from the resource and process it to 
add my cookie into it before returning it back to the tomcat.

Do you by any chance have any sample code on how to do that ? 
For some reason my response wrapper doesn't contain any data when I try to read the 
data after the chain.doFilter(req, myres) method. I am wondering if I am missing 
anything. 

I even went through the tutorial @ 
http://www.orionserver.com/tutorials/filters/3.html#stream-1 - but couldn't even get 
their working :-/

thanks for your help
-Praveem

Christopher Schultz <[EMAIL PROTECTED]> wrote:

>Tim,
>
>> With the functionality you desire, stay away from the Session classes as 
>> defined in the servlet API.
>
>I completely agree.
>
>> Instead, look into Filters and HttpServletRequestWrapper and 
>> HttpServletResponse wrapper.
>> 
>> Ideally, you'd create some helper classes which do the gets and sets on 
>> the servletrequests and responses. How they get instantiated is up to you.
>
>Yeah, the filter is the way to go. A Filter gets to execute both before 
>and after your "application" code handles the request.
>
>You can do some clever things like gather all the cookies from a request 
>that match a certain pattern (regexp), convert them to objects, and 
>shove them into request attribute (or perhaps a Map of name->value, with 
>the whole map in the request). Then, have your app code handle the request.
>
>After your app code executes, look for an attribute in the request 
>(since response objects, unfortunately for your, can't have attributes) 
>that should be converted back into cookies.
>
>Let me know if you need some sample code. This seems interesting enough 
>that I'd be willing to bang some simple stuff out for you :)
>
>-chris
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to