How can I parse the raw cookie string.
It must return the javax.servlet.http.Cookie object.
The raw cookie like this:
Set-Cookie: BAIDUID=66AA214F9A534411A339CE5E60D36E28:FG=1; expires=Sun, 05-Aug-42 06:41:06 GMT; path=/; domain=.baidu.com
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t understand what is the difficulty you face – What have you tried ?
String[] pairs = String.split(";")will give you an array of name-value pairs.pair.subString(0, pair.indexOf(':') + 1)will give you the namepair.subString(pair.indexOf(':') + 1, pair.length - (pair.indexOf(':') + 1))will give you the valuepair.indexOf(':')into a variable and reuse