Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Jakarta.commons.httpclient  session handling

Posted on 2004-08-25
7
Medium Priority
?
297 Views
Last Modified: 2008-01-09

I am using jakarta.commons.httpclient to login and perform some operations in a website.

Basically I need to login, and then perform 2 post requests.
However, since I am performing the requests one at a time, and although I can login the next requests get me redirected to a "Not logged in" page.

I noticed that from the login I receive a cookie called JSESSIONID (don't really know if the name is set by HttpClient() or the site itself).

Perhaps I need to send the session id with the next requests?

If so, how can I do it?
0
Comment
Question by:b_loco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
7 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 60 total points
ID: 11896890
It's always better to observe what a 'real browser' is doing on the site. Use a proxy such as

http://www.xk72.com/charles/download.html

then you can simulate (in theory) easily
0
 
LVL 92

Expert Comment

by:objects
ID: 11897968
> Perhaps I need to send the session id with the next requests?

You pretty surely need to.
I'd suggest passing the recieved cookie with the next request.
0
 
LVL 2

Author Comment

by:b_loco
ID: 11929348
Hi

Sorry for the late reply...

I've made some progress but got stuck again now...

I've got 5 requests to do: 2 concern the login and the following 3 concern the desired operations.

On the first two, I get 2 cookies:
JSESSIONID=somestring
lastRequest=/somepage###someid

On the last requests I get:
JSESSIONID=sameStringAsAbove
lastRequest=INVALID_REQUEST###sameIdAsAbove

Funny is that with charles (thanks CEHJ) I see that besides these two cookies there is always another one called loginState that is either false or true. I don't seem to get this last cookie...

Any clue on the INVALID_REQUEST or the missing cookie?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Accepted Solution

by:
objects earned 90 total points
ID: 11929361
are you passing the cookies back with the response?
although could be anything, sites do this sort of thing to stop people doing exactly what you are trying to do :)
0
 
LVL 2

Author Comment

by:b_loco
ID: 12254492
As probably there was no obvious way of going around my problem I will split the points according to the number of responses
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12256756
8-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question