tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfc <jfc...@btopenworld.com>
Subject Re: altering the request URI in a filter
Date Tue, 03 Sep 2002 22:28:24 GMT
Martin Cooper wrote:

>OK, I'm confused now. Your original question was about how you could alter
>the request URI in a filter. Now, however, you seem to be asking about how
>you can alter the request URI in a Struts Action class or in your own
>version of the Struts RequestProcessor. What are you really trying to do?
>
>If you want to modify what the request object looks like to everyone, using
>a filter, my previous answer applies: Write a request wrapper which returns
>a different value than the original from methods such as getRequestURI().
>
>If you want to do something inside of Struts, you'll have to make do with
>the RequestDispatcher, as someone else suggested.
>
>--
>Martin Cooper
>
>
>>-----Original Message-----
>>From: jfc [mailto:jfc100@btopenworld.com]
>>Sent: Tuesday, September 03, 2002 6:26 AM
>>To: Tomcat Users List
>>Subject: Re: altering the request URI in a filter
>>
>>
>>Martin Cooper wrote:
>>
>>>>-----Original Message-----
>>>>From: jfc [mailto:jfc100@btopenworld.com]
>>>>Sent: Monday, September 02, 2002 1:51 AM
>>>>To: Tomcat Users List
>>>>Subject: Re: altering the request URI in a filter
>>>>
>>>>
>>>[snip]
>>>
>>>>Hi,
>>>>
>>>>Thanks for the reply. How can I actually set the new value/s on the 
>>>>request? I don't see any setter methods or any fields which 
>>>>can be used 
>>>>to hold the new value.
>>>>
>>>>The only setters I can see are setAttribute and setRequest.
>>>>
>>>Since you're the one implementing the wrapper class, you can 
>>>
>>choose to add
>>
>>>whatever methods you see fit.
>>>
>>>--
>>>Martin Cooper
>>>
>>>
>>>>jfc
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:   
>>>><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>>For additional commands, e-mail: 
>>>><mailto:tomcat-user-help@jakarta.apache.org>
>>>>
>>>>
>>>
>>>--
>>>To unsubscribe, e-mail:   
>>>
>><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>
>>>For additional commands, e-mail: 
>>>
>><mailto:tomcat-user-help@jakarta.apache.org>
>>
>>>
>>Hi Martin,
>>
>>If I create a request wrapper, I can add whatever state and 
>>accessor or 
>>other methods which may be useful to some other process that 
>>knows that 
>>they are there. What I am really asking is this:
>>
>>Because I am using struts, I have a ActionServlet and a request 
>>processor which based on the request's stored URI, locates a mapping 
>>which is defined in struts-config.xml and this mapping directs to a 
>>handler (my action class). I want to be able to change the 
>>URI (the one 
>>which the framework uses to locate the mapping) so that a different 
>>mapping will be selected.
>>
>>So I'm not talking about adding specific behaviour or state to the 
>>request - I want to access the existing state and modify it 
>>and have the 
>>framework go about it's usual business of doing the delegating to my 
>>action etc (based on the updated state).
>>
>>It is possible to override the ActionServlet and/or the request 
>>processor in struts which may or may not be neccessary - depending on 
>>what can be achieved from a filter.
>>
>>So I want to know where I could alter the request URI with 
>>this change 
>>being visible to what ever processes the request to select the struts 
>>mapping.
>>
>>
>>cheers
>>jfc
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   
>><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: 
>><mailto:tomcat-user-help@jakarta.apache.org>
>>
>>
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
>
>
I see now what you were saying. This would work just as well.

Thanks.

jfc



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message