Results 1 to 2 of 2
  1. #1
    cloakbot is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Question Java: Handling cookies when logging in with POST

    0


    I'm having quite some trouble logging in to any site in Java. I'm using the default URLconnection POST request, but I'm unsure how to handle the cookies properly. I tried this guide: HOW-TO: Handling Cookies Using the java.net API But couldn't get it working. I've been trying basically for days now, and I really need help if anyone wants to help me.

    I'll probably be told that it's messy and that I should use a custom library meant for this stuff. I tried downloading one, but wasn't sure how to get it set up and working. I've been trying various things for hours now, and it just won't work. I'd rather do this with a standard URLconnection, but if anyone can help me get another library working that's better for this, that would be great, too.

    I would really appreciate if someone could post a working source that I could study. What I need is: POST login data to site -> Get and store the cookie from the site -> use cookie with next URLconnection requests to get logged-in version of the site.

    Can anyone help me with this? Would be EXTREMELY appreciated. It really does mean a lot. Sorry that my first post has to be one asking for help, but I really do need it. And yes, I've tried googling for hours, nothing's working out. As I said, any help would be so awesome.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    couldn't get it working
    How are you validating that the cookie is being set?
    Do you have a test server that will display what it receives?
    Can there be something else wrong?

Similar Threads

  1. Logging in with Java (cookies)
    By Supamagier in forum Advanced Java
    Replies: 0
    Last Post: 05-15-2009, 10:22 AM
  2. Exception handling and logging
    By jurka in forum New To Java
    Replies: 8
    Last Post: 09-03-2008, 07:07 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •