setting Cookie: JSESSIONID on client request manually
HttpPost httppost = new HttpPost(postData);
CookieStore cookieStore = new BasicCookieStore();
BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", getSessionId());
//cookie.setDomain("your domain");
cookie.setPath("/");
cookieStore.addCookie(cookie);
client.setCookieStore(cookieStore);
response = client.execute(httppost);
See also this Java: How to make a HTTP browsing session and this Apache HttpClient 4.0.3 - how do I set cookie with sessionID for POST request
Why is httpclient is refreshing the jsession id for every request?
Found the answer on the same day I posted this question.. thought of sharing..
The answer is very simple.. For some reasons the authentication wasn't successful, hence the new jsessionId was created. Replaced "httpClient.getCredentialsProvider().setCredentials()" with "BasicNameValuePair" and it worked :)
Related Topics
What Is the Java Equivalent of Sscanf for Parsing Values from a String Using a Known Pattern
Using Spring Resttemplate in Generic Method with Generic Parameter
Accessing Kotlin Extension Functions from Java
How to Change the Color of Specific Words in a Jtextpane
Spring Boot Actuator Application Won't Start on Ubuntu Vps
What Is the Java Equivalent of Sscanf for Parsing Values from a String Using a Known Pattern
Auto Resizing the Jtable Column Widths
Collision Detection Between Two Images in Java
Scanner Class Skips Over Whitespace
How to Ignore Certain Elements When Comparing Xml
Writing in the Beginning of a Text File Java
No Idea Annotations Attached to the Jdk 1.8 (C:\...), Some Issues Will Not Be Found
Copy Directory from a Jar File
Java String Concatenation with + Operator
Getting Java.Lang.Reflect.Invocationtargetexception While Adding a Button to Layout