List of usage examples for javax.servlet ServletRegistration getInitParameter
public String getInitParameter(String name);
From source file:org.wso2.carbon.webapp.mgt.WebApplication.java
public WebApplication(TomcatGenericWebappsDeployer tomcatGenericWebappsDeployer, Context context, File webappFile) {/*from w w w .ja va2 s . c o m*/ this.tomcatGenericWebappsDeployer = tomcatGenericWebappsDeployer; this.context = context; this.hostName = WebAppUtils.getMatchingHostName(WebAppUtils.getWebappDirPath(webappFile.getAbsolutePath())); setWebappFile(webappFile); setLastModifiedTime(webappFile.lastModified()); String versionString = context.getName(); if (context.getName().startsWith("/t/")) { //remove tenant context versionString = versionString.substring(context.getName().lastIndexOf("/webapps/") + 9); } else if (context.getName().startsWith("/")) { versionString = versionString.substring(1); } if (versionString.contains("/")) { versionString = versionString.substring(versionString.indexOf("/")); setVersion(versionString); } else { setVersion(WebappsConstants.DEFAULT_VERSION); } //Some of the information in context will not be available if the webapp is not started.. ex. init-params. boolean isFaulty = checkFaultyWebappParam(context); if (isFaulty || !"STARTED".equalsIgnoreCase(context.getStateName())) { return; } String serviceListPathParamName = "service-list-path"; String serviceListPathParam = context.getServletContext().getInitParameter(serviceListPathParamName); if ("".equals(serviceListPathParam) || serviceListPathParam == null) { Map<String, ? extends ServletRegistration> servletRegs = context.getServletContext() .getServletRegistrations(); for (ServletRegistration servletReg : servletRegs.values()) { serviceListPathParam = servletReg.getInitParameter(serviceListPathParamName); if (!"".equals(serviceListPathParam) || serviceListPathParam != null) { break; } } } if ("".equals(serviceListPathParam) || serviceListPathParam == null) { serviceListPathParam = "/services"; } else { serviceListPathParam = ""; } setServiceListPath(serviceListPathParam); }