• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Could use another pair of eyes...

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic