• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could use another pair of eyes...

 
David Ondzes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing to write my first J2ME application. Its job is to login into ESPN's fantasy website via https, use a POST operation to send my username and password, remember a few cookies and follow a redirection to my "home" page where I want to read the html-text and parse it. I have this app working just fine with J2SE but as I am quickly discovering, J2ME is very different.
My POST looks to be working just fine, because it returns a status of 200 and I am getting cookies in the reply. Something must be wrong with the redirection. If anyone is willing to look at my small app (5 files, 400 lines) I would REALL appreciate it.
BTW - I am using the HttpConnectionHelper class from Sun's examples to follow the redirection; I modified it to work with cookies.
Thanks in advance
David
 
Nancy Lehrer
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David:
I have had very mixed results with POST to various different web servers. I believe the problem is related to a web server's ability to handle Http 1.1 "chunked" messages.
In my application, I use POST to send data to and from our server, but since I can control both the sending and receiving side, we use DataInputStreams to encode the body of the message.
Have you tried using GET. If the query string is not too long, it might work fine.
Nancy
 
David Ondzes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found my problem. It was the my lack of understanding how cookies worked. For each cookie I received I was doing
con.setRequestProperty("cookie", cookie[i]);
Bur after reading http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-wireless.html
I realized that I need to send all the cookies concatenated and seperated by semicolons as one string. I also need to strip off the optional part of the cookies and send just the NV pairs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic