Skip to content

Commit a204cf5

Browse files
committed
ZSTD-4759 [Roman] Can't deploy to HTTPS vhost
1 parent d7e7b28 commit a204cf5

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

zendserver-sdk-java/org.zend.sdk/sdklib/org/zend/sdklib/application/ZendApplication.java

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -291,37 +291,42 @@ public ApplicationInfo deploy(String path, String basePath,
291291
deleteFile(getTempFile(path));
292292
File zendPackage = createPackage(path);
293293
try {
294-
if (zendPackage != null) {
295-
String baseUrl = resolveBaseUrl(new File(path), basePath,
296-
defaultServer, vhostURL);
297-
WebApiClient client = getClient(targetId);
298-
if (appName == null) {
299-
String[] segments = baseUrl.split("/");
300-
appName = segments.length > 0 ? segments[segments.length - 1]
301-
: null;
302-
}
303-
notifier.statusChanged(new BasicStatus(StatusCode.STARTING,
304-
"Deploying", "Deploying application to the target...",
305-
-1));
306-
boolean vhost = vhostURL != null;
307-
// Update parameters for Zend Server version >= 6.2.0 base on
308-
// virtual hosts
309-
IZendTarget target = getTargetById(targetId);
310-
if (target != null) {
311-
ZendServerVersion version = ZendServerVersion.byName(target
312-
.getProperty(IZendTarget.SERVER_VERSION));
313-
if (version.compareTo(v6_2_0) >= 0) {
314-
VhostInfo virtualHost = getVirtualHost(targetId,
315-
baseUrl);
316-
if (virtualHost != null) {
317-
defaultServer = virtualHost.isDefaultVhost();
318-
vhost = false;
319-
} else {
320-
vhost = true;
321-
defaultServer = false;
322-
}
294+
WebApiClient client = getClient(targetId);
295+
String baseUrl = resolveBaseUrl(new File(path), basePath,
296+
defaultServer, vhostURL);
297+
if (appName == null) {
298+
String[] segments = baseUrl.split("/");
299+
appName = segments.length > 0 ? segments[segments.length - 1]
300+
: null;
301+
}
302+
notifier.statusChanged(new BasicStatus(StatusCode.STARTING,
303+
"Deploying", "Deploying application to the target...", -1));
304+
boolean vhost = vhostURL != null;
305+
// Update parameters for Zend Server version >= 6.2.0 base on
306+
// virtual hosts
307+
IZendTarget target = getTargetById(targetId);
308+
if (target != null) {
309+
ZendServerVersion version = ZendServerVersion.byName(target
310+
.getProperty(IZendTarget.SERVER_VERSION));
311+
if (version.compareTo(v6_2_0) >= 0) {
312+
VhostInfo virtualHost = getVirtualHost(targetId, baseUrl);
313+
if (virtualHost != null) {
314+
defaultServer = virtualHost.isDefaultVhost();
315+
vhost = false;
316+
} else {
317+
vhost = true;
318+
defaultServer = false;
323319
}
324320
}
321+
}
322+
if (vhost && baseUrl.startsWith("https://")) {
323+
notifier.statusChanged(new BasicStatus(
324+
StatusCode.ERROR,
325+
"Deployment Error",
326+
"Specified virtual host does not exist. HTTPS or SSL secure virtual hosts may only be created using Zend Server GUI."));
327+
return null;
328+
}
329+
if (zendPackage != null) {
325330
ApplicationInfo result = client.applicationDeploy(
326331
new NamedInputStream(zendPackage), baseUrl,
327332
ignoreFailures, userParams, appName, vhost,

0 commit comments

Comments
 (0)