I have an application and i saw that by url i can get logged and redirect. First i do http://test/servlet?user=xxx?password=xxx, then i can write every page i want into that application like http://test/grapgycs, where i needed to be loged in. (logging uses POST)
I need do that from Java (a servlet which shoul log me in and redirect). I'm trying something like
URL urlRequestDetail = new URL(url);
HttpURLConnection urlConnectionRequestDetail = (HttpURLConnection)urlRequestDetail.openConnection();
OutputStreamWriter outRequestDetail = new OutputStreamWriter(urlConnectionRequestDetail.getOutputStream());
After that i'm trying this but servlet dont redirect.
String site = http://test/grapgycs
This doesnt work.
Whats wrong ????
What does this question have to do with Java Web Start?
Your post is an incomplete mess. You do a login through a servlet. Okay, but how is the logged in state maintained? If it is by setting some property in the session, the problem is likely there. URLConnection is not a browser, it does not maintain and send a jSESSIONID cookie. you have to do that yourself.
Im trying obtaining the JIDSESSION by
and in the response
res.setHeader("SET-COOKIE", "JSESSIONID=" + urlcache + "; HttpOnly");
But this doesnt work.
... so you are doing it wrong and you need to Google around a bit more to figure out how to properly do it :/
Make your life easier: use Apache HttpClient in stead of URLConnection to send requests. If anything, it has proper documentation and example programs: