You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karl Stenerud <ka...@zergsoft.com> on 2005/03/23 09:46:35 UTC

Applying HttpServletResponse.encodeURL to a mailto url

I'm running Tomcat 5.0.16 under Java 1.4.2_05.

I have a general url encoding setup to encode any urls it finds before serializing the dom.
It does this by calling the HttpServletResponse encodeURL() on all anchor hrefs and form actions.
The problem is that when it comes to a url such as:
    mailto:subscribe@localhost?subject=subscribe to the mailing list&body=Subscribe to the mailing list

Tomcat tries to add a jsessionid:
    mailto:subscribe@localhost;jsessionid=CB3CAC6C29BE579847BCDDE48CF0670D?subject=subscribe%20to%20the%20mailing%20list&body=Subscribe%20to%20the%20mailing%20list

I would have thought that Tomcat's encoder would leave the url alone if it's a mailto, since there'd be no reason to preserve a session through email.
If I click on the resulting link, my mail program assumes that I'm sending mail to subscribe@localhost;jsessionid=CB3CAC6C29BE579847BCDDE48CF0670D
and this of course causes the mail server to choke.

Is this a bug in Tomcat, or should I be setting something to make it behave differently for mailto urls?

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