You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bourgon, Jean-Francois" <jb...@nrcan.gc.ca> on 2005/08/09 14:44:16 UTC

Using with URL encoding of sessionid

Hi,

I recently moved my web application from Struts 1.2.4 to 1.2.7.

Since this, the <html:link> tag doesn't behave as before because it doesn't
encode sessionid in url specified as href property when session cookies are
disabled.

I compared TagUtils class source code between Struts 1.2.4 and 1.2.7 and
found that an extra condition have been added in computeURLWithCharEncoding
method to avoid url encoding of link with href property. See sample code
below.

In Struts 1.2.4
        // Perform URL rewriting to include our session ID (if any)
        if (pageContext.getSession() != null) {
            HttpServletResponse response = (HttpServletResponse)
pageContext.getResponse();
            if (redirect) {
                return (response.encodeRedirectURL(url.toString()));
            } else {
                return (response.encodeURL(url.toString()));
            }
        } else {
            return (url.toString());
        }

and Struts 1.2.7
        // Perform URL rewriting to include our session ID (if any)
        // but only if url is not an external URL
        if (( href == null ) && ( pageContext.getSession() != null )) {
            HttpServletResponse response = (HttpServletResponse)
pageContext.getResponse();
            if (redirect) {
                return (response.encodeRedirectURL(url.toString()));
            } else {
                return (response.encodeURL(url.toString()));
            }
        } else {
            return (url.toString());
        }

Then, I only want to know if this is a correct behaviour, because this is
not in concordance with the Struts documentation. As I know, we should be
able to use something similar to <html:link href="index.jsp">Main
Page</html:link> and benefit of URL rewriting to preserve session when
cookies are disabled.

Thanks


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