最近这几天一直在尝试写J2ME的程序。先是一直碰到了Nokia出来 “应用程序错误” 的问题,搜索到的原因是内存不够,可我感觉我用的内存并不多呀。 而且就算我怎么GC法都还是出现,最后被我发现的问题,竟然是那个equalsIgnoreCase. 我的是S60的系统,可没有一个JME说明不能用equalsIgnoreCase,而且摸拟器里面一切正常。 OK这问题解决了,接着又来一个问题,出现了一个莫名奇妙的问题,就是我怎么也无法解析多重Set-Cookies的HEADER。然后搜索了一下,发现竟然是如下:

plank Offline

Registered User

 

Posts: 2

Join Date: Sep 2006

 

Multiple Set-Cookie support. - 2006-09-20, 20:45


Hi,
I’d like to suggest / request that Nokia phones and SDK implement support for multiple Set-Cookie headers in J2ME. That is, more than one Set-Cookie header in a single http response.

For example, take this valid HTTP response

HTTP/1.1 200 OK
Date: Wed, 20 Sep 2006 18:26:38 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Set-Cookie: cooki1=mycookie1
Set-Cookie: cooki2=mycookie2
Content-Length: 1786
Connection: close
Content-Type: text/html; charset=ISO-8859-1

On a nokia device, there is no way to access cooki1 - you can only get to the second (or last) one.

It does work correctly on devices from other vendor. (motorola, samsung, lg, blackberry)

A couple of other references to this problem:

http://discussion.forum.nokia.com/fo…p/t-57257.html
http://discussion.forum.nokia.com/fo…ght=Set-Cookie
http://discussion.forum.nokia.com/fo…ght=Set-Cookie

 

Reply With Quote

原来这是可恶S60的一个BUG,害我调试了半天,怎么找不出个所以然,真被这种J2ME的平台错误害惨了。可想而知,要Write Once, Run Everywhere, 就目前的半调子技能水平,Java的路还远着呢,明天想办法看看直接使用Socket能否解决这些问题,可要命的是,用的还是中国移动的CMWAP,还要多加一层的难度。