Parsing cookie headers in J2ME / BlackBerry apps

When using HttpConnection in a BlackBerry app, you often get HTTP cookies in response headers. Unfortunately, there are no built-in APIs to help parse cookie headers.

Has anyone found a third-party library to help with parsing cookie headers into a more useful data object? Creating some custom code that just parses the name and value of the cookie is not too complicated, but I would also like to consider other fields in the cookie, such as expiration and domain fields.

+3
source share
2 answers

Just to keep track of this topic - I just ended up writing my own code to process and save cookies. I think sometimes there simply isn’t an open library, ready and waiting!

+2
source

There's a very easy way to store and retrieve cookies using RMS in J2ME, just follow this post http://www.java-samples.com/showtutorial.php?tutorialid=741 . I tried and it works even when using the html component in LWUIT. I created a package that you can import into your LWUIT project, but it has many problems when used in Blackberry applications. Just use the class as is, it works great.

+1
source

Source: https://habr.com/ru/post/1731085/


All Articles