2828import com .microsoft .azure .management .appservice .JavaVersion ;
2929import com .microsoft .azure .management .appservice .OperatingSystem ;
3030import com .microsoft .azure .management .appservice .PublishingProfile ;
31+ import com .microsoft .azure .management .appservice .RuntimeStack ;
3132import com .microsoft .azure .management .appservice .WebApp ;
3233import com .microsoft .azure .management .appservice .WebContainer ;
3334import com .microsoft .azure .management .resources .ResourceGroup ;
5253import java .net .HttpURLConnection ;
5354import java .net .URI ;
5455import java .net .URL ;
56+ import java .util .Arrays ;
57+ import java .util .List ;
5558
56- /**
57- * Created by vlashch on 1/19/17.
58- */
5959public class WebAppUtils {
6060
6161 public static final String TYPE_WAR = "war" ;
@@ -406,7 +406,12 @@ public static String getJavaRuntime(@NotNull final WebApp webApp) {
406406 webContainer = versions [0 ].toLowerCase ();
407407 final String webContainerVersion = versions [1 ];
408408 final String jreVersion = versions [2 ];
409- if (webContainer .contains ("tomcat" )) {
409+ final boolean isJavaLinuxRuntimeWithWebContainer = getAllJavaLinuxRuntimeStacks ()
410+ .stream ()
411+ .map (r -> r .stack ())
412+ .filter (w -> !w .equalsIgnoreCase ("java" ))
413+ .anyMatch (w -> w .equalsIgnoreCase (webContainer ));
414+ if (isJavaLinuxRuntimeWithWebContainer ) {
410415 // TOMCAT|8.5-jre8 -> Tomcat 8.5 (JRE8)
411416 return String .format ("%s %s (%s)" , StringUtils .capitalize (webContainer ), webContainerVersion , jreVersion .toUpperCase ());
412417 } else {
@@ -417,4 +422,12 @@ public static String getJavaRuntime(@NotNull final WebApp webApp) {
417422 return DEFAULT_VALUE_WHEN_VERSION_INVALID ;
418423 }
419424 }
425+
426+ public static List <RuntimeStack > getAllJavaLinuxRuntimeStacks () {
427+ return Arrays .asList (new RuntimeStack []{
428+ RuntimeStack .TOMCAT_8_5_JRE8 ,
429+ RuntimeStack .TOMCAT_9_0_JRE8 ,
430+ RuntimeStack .WILDFLY_14_JRE8 ,
431+ RuntimeStack .JAVA_8_JRE8 });
432+ }
420433}
0 commit comments