Simple as pie, actually. Created the Wrapper class, no-op'd the encodeUrl/encodeURL and put it into the Filter that was already setup to handle all incoming requests ... piece of cake :)
Sweet!
Here's the wrapper code:
public class StripSessionIdWrapper extends HttpServletResponseWrapper { public StripSessionIdWrapper(HttpServletResponse response) { super(response); } public String encodeUrl(String url) { return url; } public String encodeURL(String url) { return url; } }
and here's the couple lines I have in my Filter:
StripSessionIdWrapper wrapper = new StripSessionIdWrapper((HttpServletResponse)response);
and then, instead of passing "response" to the chain.doFilter, I pass "wrapper"
Nice ... clean, I like it. Kris Schneider wrote:
First, check out a tutorial on Servlet 2.3 filters. One at:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets8.html
Essentially, it'll boil down to creating two classes: a filter (implements javax.servlet.Filter) and a response wrapper (extends javax.servlet.http.HttpServletResponseWrapper). Then, you'll need to add <filter> and <filter-mapping> elements to web.xml.
How would you determine if a request originated from your search engine? User-Agent header? Specific request parameter?
Quoting Brice Ruth <[EMAIL PROTECTED]>:
Kris,
Thanks for the response. I saw that I could do the opposite :) - no help there. I'd be really interested in pursuing your second suggestion. Ideally, I'd see setting up a filter that processes every incoming request and determines if its originating from our search engine, if so, then no-op those methods, otherwise leave everything as is ...
How exactly would I go about doing what you suggest? I've only been doing Java/Servlet stuff for about a year or so, and that mostly via JSP/Struts/etc. - so I'm no expert when it comes to this.
Kris Schneider wrote:
NAFAIK, but that's by no means definitive. I *do* know that you canconfigure a
TC context (or default context) to do the opposite. In other words, turnoff
cookies and only use rewriting.--
Hm, what if you create a filter to wrap the response with an HttpServletResponseWrapper that no-ops encodeUrl and encodeURL?
Quoting Brice Ruth <[EMAIL PROTECTED]>:
Is there any way to disable URL rewriting (with jsessionid) in Tomcat or via struts-config.xml or anything? I'm about at my wits end with this jsessionid thing - now our search engine which indexes by crawling the site (and doesn't support cookies) can't index properly because of the jsessionid property ... and frankly, I'm not really caring at this point if the 3-5% of visitors to our site can't use sessions (there's practically no functionality that depends on it anyway - mainly a performance improvement, where it is being used). I'd like to leave sessions via cookies enabled, but disable URL rewriting for sessions.
--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]