use of com.sun.enterprise.admin.util.HttpConnectorAddress in project Payara by payara.
the class RemoteRestAdminCommand method followRedirection.
/**
* Creates a new HttpConnectorAddress corresponding to the location to which
* an earlier request was redirected.
* <p>
* If the new protocol is https then the HttpConnectorAddress secure setting
* is turned on.
* @param originalAddr the address which has been redirected elsewhere
* @param redirection the location to which the attempted connection was redirected
* @return connector address for the new location
* @throws MalformedURLException
*/
private HttpConnectorAddress followRedirection(final HttpConnectorAddress originalAddr, final String redirection) throws MalformedURLException {
final URL url = new URL(redirection);
final boolean useSecure = (url.getProtocol().equalsIgnoreCase("https"));
HttpConnectorAddress hca = new HttpConnectorAddress(url.getHost(), url.getPort(), useSecure, originalAddr.getPath(), originalAddr.getSSLSocketFactory());
hca.setInteractive(interactive);
return hca;
}
Aggregations