java - Redirect using HTTPS connection Response -
created new https connection , executed method call on connection url.
instead of sending 301 (30x) redirect received response xhtml page data inturn when handled in browser submitted automatically , sent redirected page, how handle same in java code?
here response data
<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <body onload="document.forms[0].submit()"> <noscript><p><strong>note:</strong> since browser not support javascript, must press continue button once proceed.</p></noscript> <form action="https://localhost:8083/login" method="post"> <div> <input type="hidden" name="relaystate" value=""/> <input type="hidden" name="responsedata" value=""/> </div> <noscript> <div> <input type="submit" value="continue"/> </div> </noscript> </form> </body> </html>
fyi: need send http/https request url in form action attribute. i'm not planning open html in browser.
could provide connection code? generic approach,you can set setinstancefollowredirect(false) httpurlconnection, redirects don't go through , can handle them manually. here example: http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/
Comments
Post a Comment