Oh, I didn't realize that you could use a RequestDispatcher within a Filter, but
now that I look at the Filter documentation again, I don't see any reason why 
not. Thanks, that's a good idea.
That also explains why my original subject line was "using a Filter to rewrite the
URL" -  I initially attempted to write a Filter which examined the request path
and took appropriate action but I could never work out how to then "forward" 
(all the Filter documentation talks about chaining instead). It never occured to me
to use a RequestDispatcher to do that, which is where you came in.

Thanks again for clarifying everything.

Stephen.


 

 "Cox, Charlie" <[EMAIL PROTECTED]> wrote:You can use a servlet or a filter. Filter 
mappings can overlap servlet
mappings if you need them to. You can map all requests, or you can only map
the specific paths for which you will use forward(). You probably want a
filter if you are going to map all requests.

glad to help :-)

Charlie


> -----Original Message-----
> From: Stephen Riek [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 25, 2002 12:47 PM
> To: Tomcat Users List
> Subject: RE: help with multilingual JSP sites pls. using a Filter to
> rewri te the URL ?
> 
> 
> 
> Thanks Charlie.
> Genius. Another simple solution saves the day. 
> I presume you also mean that I should map all incoming requests to a
> servlet that then examines the PathInfo and issues the 
> requestDispatcher.
> Magnificent solution. Thank you indeed.
> Stephen.
> "Cox, Charlie" wrote:use 
> request.gePathInfo() to get the path. Then parse the string and use
> RequestDispatcher.forward("/products/Toys/index.jsp?myparam="+
> langString).
> The forward() will not be subject to further filter processing.
> 
> Charlie
> 
> > -----Original Message-----
> > From: Stephen Riek [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, November 25, 2002 11:27 AM
> > To: Tomcat Users List
> > Subject: Re: help with multilingual JSP sites pls. using a Filter to
> > rewrite the URL ?
> > 
> > 
> > 
> > Sorry, I'm not making myself clear here. My JSPs do exactly 
> > as you suggest 
> > so that I have one JSP serving up French and English pages, 
> > depending on 
> > the language that the user selected on my site.
> > Here is the problem explained very simply. I have a sitemap 
> > as follows:
> > /en
> > --> /Products
> > --> Toys/index.jsp
> > --> Decoration/index.jsp
> > /fr
> > --> /Products
> > --> /Toys/index.jsp
> > --> /Decoration/index.jsp
> > 
> > As you can see, this is braindead. If I wish the 
> > functionality of the English section 
> > of the site to be the same as that of the French part of the 
> > site, then any change
> > to a JSP in the 'en' part must be repeated within the 'fr' 
> > site. This is not 
> > scalable and is tedious. 
> > 
> > Instead, it would be much better if I had one site structure 
> > which served up the
> > whole site.
> > 
> > /Products
> > --> /Toys/index.jsp
> > --> /Decoration/index.jsp
> > 
> > Any changes to functionality only have to be made in one 
> > place and both the
> > french viewers and english viewers will experience the same 
> > user experience, 
> > just in different languages. (I use the properties files as 
> > you suggest to 
> > serve up different languages).
> > 
> > The problem however is "how does /Products/Toys/index.jsp" 
> > know whether
> > the user is viewing in English or French ? The easy way would 
> > be to have the
> > user select a language on entering the site and then store 
> > the language 
> > preference in a cookie which I check before serving up pages. 
> > However, 
> > users may access the site from a search engine or from direct 
> > URLs due to
> > promotions. I would like a request for 
> > /en/Products/Toys/index.jsp to be 
> > sent to /Products/Toys/index.jsp but with a 'lang' parameter 
> > set to 'en'. 
> > Likewise for the french part of the site. 
> > 
> > Surely somebody has had to encounter this sort of problem in 
> > dealing with
> > pan-European sites ?
> > 
> > Stephen.




---------------------------------
With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs

Reply via email to