You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "James, Stuart" <st...@cazenove.com> on 2001/11/05 18:24:11 UTC

cookies,

All,

I am currently upgrading my web application from tomcat 3.x to tomcat 4.x.

To extract cookies I have a helper function,

    public static String getCookie( javax.servlet.http.HttpServletRequest
request,  String strName, String strDefault)
    {        
        javax.servlet.http.Cookie cookies[] = request.getCookies();
        
        for( int nCk=0; nCk < cookies.length; nCk++ )
        {
            if( cookies[nCk].getName().compareTo(strName) == 0 )
            {
                return unescape( cookies[nCk].getValue().toString() );
            }                
        }
        return strDefault;
    }

   public static String unescape(String strIn) 
   {
	/* you get the idea.... */
   }
	

however, on tomcat 4.0 the unescape is already being performed, so the
string returned is decoded twice (and therefore corrupted).

what is the best way to get the decoded cookie value that will work on both
version of tomcat ?

Thanks in advance,
Stuart James.






___________________________________________________
Email Disclaimer

This communication is for the attention of the
named recipient only and should not be passed
on to any other person. Information relating to
any company or security, is for information
purposes only and should not be interpreted as
a solicitation or offer to buy or sell any security.
The information on which this communication is based
has been obtained from sources we believe to be reliable,
but we do not guarantee its accuracy or completeness.
All expressions of opinion are subject to change
without notice.  All e-mail messages, and associated attachments,
are subject to interception and monitoring for lawful business purposes.
___________________________________________________

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>