I am so glad to solve this problem:
HttpPost httppost = new HttpPost(postData);
CookieStore cookieStore = new BasicCookieStore();
BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", getSessionId());
//cookie.setDomain("your domain");
cookie.setPath("https://stackoverflow.com/");
cookieStore.addCookie(cookie);
client.setCookieStore(cookieStore);
response = client.execute(httppost);
So Easy!
Related Contents:
- How can I get the cookies from HttpClient?
- Trusting all certificates using HttpClient over HTTPS
- What does %5B and %5D in POST requests stand for?
- Sending HTTP POST Request In Java
- Java – sending HTTP parameters via POST method easily
- HTTP POST using JSON in Java
- How can I get an HTTP response body as a string?
- Get the POST request body from HttpServletRequest
- Deprecated Java HttpClient – How hard can it be?
- HttpServletRequest get JSON POST data [duplicate]
- How to ignore SSL certificate errors in Apache HttpClient 4.0
- How do you remove a Cookie in a Java Servlet
- JsonParseException : Illegal unquoted character ((CTRL-CHAR, code 10)
- Getting request payload from POST request in Java servlet
- How do I make an http request using cookies on Android?
- What is the difference between CloseableHttpClient and HttpClient in Apache HttpClient API?
- How to POST JSON request using Apache HttpClient?
- POST request send JSON data Java HttpUrlConnection
- How to fix java.net.SocketException: Broken pipe?
- commons httpclient – Adding query string parameters to GET/POST request
- Error 415 Unsupported Media Type: POST not reaching REST if JSON, but it does if XML
- Do SOAP Web services support only “POST” http method
- Apache HttpClient making multipart form post
- How do you configure HttpOnly cookies in tomcat / java webapps?
- SameSite cookie in Java application
- HttpClient 4.0.1 – how to release connection? [duplicate]
- Create a simple HTTP server with Java?
- How to prevent hangs on SocketInputStream.socketRead0 in Java?
- Write in body request with HttpClient
- How to get HttpClient returning status code and response body?
- Apache HttpClient timeout
- How to retrieve raw post data from HttpServletRequest in java
- Exception : javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
- Automatic cookie handling with OkHttp 3
- How do Jersey-client and Apache HTTP Client compare?
- Best option for Session management in Java
- java – get cookie value by name in spring mvc
- HttpClient 4 – how to capture last redirect URL
- Session/cookie management in Apache JMeter
- Apache HttpComponents HttpClient timeout
- Invalid use of BasicClientConnManager: connection still allocated
- How to set TLS version on apache HttpClient
- How to get HTTP Response Code using Selenium WebDriver
- How to stop the task scheduled in java.util.Timer class
- When should I use a CompletionService over an ExecutorService?
- Eclipse: Java was started but returned error code=13 [duplicate]
- Didn’t find class “androidx.core.app.CoreComponentFactory”
- How do I convert an OutputStream to an InputStream?
- How to redirect in a servlet filter?
- Want to specify jar name and version both in build.gradle