As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<% URL url1 = new URL("http://localhost:8080/share/page"); HttpURLConnection conn = (HttpURLConnection) url1.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestProperty("SsoUserHeader", "admin"); for (int i = 0;; i++) { String headerName = conn.getHeaderFieldKey(i); String headerValue = conn.getHeaderField(i); System.out.println(headerName + "==="); System.out.println(headerValue); if (headerName == null && headerValue == null) { break; } } String sessionValue = conn.getHeaderField("Set-Cookie").substring(0,conn.getHeaderField("Set-Cookie").indexOf(";")); conn.setRequestProperty("Set-Cookie", sessionValue); conn.connect(); BufferedReader dis = new BufferedReader( new InputStreamReader( conn.getInputStream())); String myString; while ((myString = dis.readLine()) != null) { System.out.println(myString); } conn.setInstanceFollowRedirects(false); int responseCode = conn.getResponseCode(); System.out.println( responseCode ); String location = conn.getHeaderField( "Location" ); System.out.println( location ); String urlstring = conn.getHeaderField("Location"); response.sendRedirect(urlstring); %>
null=== HTTP/1.1 302 Found Server=== Apache-Coyote/1.1 Set-Cookie=== JSESSIONID=7BBDB706EB1006133932EBC11074DB18; Path=/share/; HttpOnly Cache-Control=== no-cache Location=== http://localhost:8080/share/page/user/admin/dashboard Content-Type=== text/html;charset=utf-8 Content-Language=== en-US Content-Length=== 0 Date=== Thu, 18 Apr 2013 07:01:52 GMT null=== null 302 http://localhost:8080/share/page/user/admin/dashboard