> -----Original Message----- > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 04, 2002 10:29 PM > To: Struts Developers List > Subject: Re: Servlet 2.3 filter > > > > > On Thu, 4 Apr 2002, Struts-dev Newsgroup wrote: > > > Date: Thu, 4 Apr 2002 18:55:01 -0800 > > From: Struts-dev Newsgroup <[EMAIL PROTECTED]> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: Re: Servlet 2.3 filter > > > > Subject: Re: Servlet 2.3 filter > > From: Bill Wohler <[EMAIL PROTECTED]> > > === > > "Craig R. McClanahan" <[EMAIL PROTECTED]> writes: > > > - It's commonly necessary to generate slightly > different HTML for > > > different user agents, to deal with the inevitable > differences. > > > One approach is to build the knowledge of these > differences into > > > every tag that renders HTML. A different approach would be to > > > generate some agent-neutral rendering of the output > in XML, and then > > > apply an agent-specific transformation in a response wrapper. > > > > Oh yeah, that would be nice. The "different user agents" > applies to > > web browsers and phone browsers alike. I currently maintain two > > trees since the HTML and WML is so different. Within the > phone side, > > there are large differences in some widgets which I plan > to hide in > > custom tags (normally, I keep markup out of tags). > However, what you > > suggest would be preferable. > > > > I'm also planning on using filters to do "resource switching" and > > I'm not sure yet how this will work. A given page > "foo.jsp" might be > > found in any number of places depending on: > > > > - the variant in use (companyA, companyB, etc.) > > - the user's locale (en_US, etc.) > > - the markup (HTML, WML, etc.) > > > > I was planning on creating a servlet filter which would intercept > > the request with the virtual page (foo.jsp), find the appropriate > > page, and forward the request with the actual page > > (companyA/en_US/HTML/foo.jsp). > > > > Thoughts? > > > > One potential gotcha, especially if you like MVC > architectures like the one Struts advocates -- filters are > only invoked on the original request, not on > RequestDispatcher.forward() methods. In retrospect, that > probably wasn't the best approach for *our* purposes, but we > have to live with it for now.
If that wasn't true, though, you wouldn't be able to map a filter to /* right? -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>