how to add session id using URLConnection


I am trying to upload an image to a server using server url. For this i am using java.net api. After sending request , it is returning a response that shows session invalid. I am getting the session id from that server but unable to add it. How can i add session id using HttpURLConnection while sending request to server. Is their any way to solve this?


Session ID is stored in a cookie, in JavaEE its name is jsessionid, and you add it like that:

httpURLConnection.setRequestProperty(
    "Cookie","JSESSIONID=" + your_session_id);



source - http://stackoverflow.com/questions/14979288/how-to-add-session-id-using-urlconnection







'Development > Java' 카테고리의 다른 글

java - file memory  (0) 2014.10.30
java - json-simple parse  (0) 2014.08.19
java - local host ip address  (0) 2014.02.13
java - HttpURLConnection  (0) 2014.02.07
java - 화폐 원 단위 콤마 표시  (2) 2013.10.02
Posted by linuxism
,