I'm trying to grab the current session ID and the request parameter map from the current request and serialize them into a base64 string to pass to a PHP application. Problem is, I keep running into the following exception everytime I try to serialize anything imlementing the Map interface:
java.io.NotSerializableException: org.apache.coyote.tomcat5.CoyoteWriter
If you're passing this to PHP, I'm guessing that you don't want to use serialization. (Unless PHP can de-serialize Java objects and I didn't know...)
I think you want to do your own type of 'serialization', something like this:
Map parameters = ...; StringBuffer sb = new StringBuffer(); for(Iterator i=parameters.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry)i.next();
ab.append(entry.getKey()) .append('=') .append(entry.getValue());
if(i.hasNext()) sb.append(','); }
// send sb (or sb.toString()) to PHP
Hope that helps, -chris
signature.asc
Description: OpenPGP digital signature