Search in sources :

Example 6 with HttpConnectorAddress

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;
}
Also used : HttpConnectorAddress(com.sun.enterprise.admin.util.HttpConnectorAddress)

Aggregations

HttpConnectorAddress (com.sun.enterprise.admin.util.HttpConnectorAddress)6 AuthenticationInfo (com.sun.enterprise.admin.util.AuthenticationInfo)2 CachedCommandModel (com.sun.enterprise.admin.util.CachedCommandModel)2 SSLException (javax.net.ssl.SSLException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ConnectException (java.net.ConnectException)1 HttpURLConnection (java.net.HttpURLConnection)1 MalformedURLException (java.net.MalformedURLException)1 SocketException (java.net.SocketException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 JsonObject (javax.json.JsonObject)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 AuthenticationException (org.glassfish.api.admin.AuthenticationException)1 CommandException (org.glassfish.api.admin.CommandException)1