Package org.wso2.carbon.webapp.mgt.utils
Class WebAppUtils
java.lang.Object
org.wso2.carbon.webapp.mgt.utils.WebAppUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckJaxApplication(WebApplication webApplication) This util method is used to check if the given application is a Jax-RS/WS appstatic StringgenerateMetaFileDirName(String webappFilePath, org.apache.axis2.context.ConfigurationContext configurationContext) static Map<String, WebApplicationsHolder> getAllWebappHolders(org.apache.axis2.context.ConfigurationContext configurationContext) static StringgetAppbase(String hostName) This util method will return appbase value of matching host name from catalina-server.xmlstatic Stringstatic WebApplicationsHoldergetDefaultWebappHolder(org.apache.axis2.context.ConfigurationContext configurationContext) static org.apache.catalina.Hoststatic StringgetMatchingHostName(String filePath) static org.apache.catalina.HostgetMatchingVirtualHost(String baseDir) static StringThis will read "HostName" value from carbon.xml and will return default host (from catalina-server.xml) if the value is null (or not defined)static StringgetWebappDir(String webappFilePath) This util method is used to return base dir name of webapp.static StringgetWebappDirPath(String webappFilePath) This util method is used to return file path of base dir.static WebApplicationsHoldergetWebappHolder(String webappFilePath, org.apache.axis2.context.ConfigurationContext configurationContext) This util method will return the web application holder of the given web app filestatic StringgetWebappKey(File webappFile) This will return a key with pair hostname:webappFileNamestatic StringgetWebappName(String webappFilePath) static StringgetWebappResourcePath(WebApplication webApplication) Returns the registry path for the webappstatic booleanCheck whether the shared environment class loader is disabled.static booleanisWebappUploadedToVirtualAppBase(String webAppBaseDir, String appBase) static booleanvalidateWebappFileName(String filename)
-
Field Details
-
vhostNames
-
appBases
-
-
Constructor Details
-
WebAppUtils
public WebAppUtils()
-
-
Method Details
-
checkJaxApplication
This util method is used to check if the given application is a Jax-RS/WS app- Parameters:
webApplication- application object- Returns:
- relevant servlet mapping of the cxf servlet if its a Jax-RS/WS application. Null, if its not a Jax-RS/WS application.
-
validateWebappFileName
-
getWebappDirPath
This util method is used to return file path of base dir. eg: for input "/deployment/server/webapps/calenda.war" will return "/deployment/server/webapps"- Parameters:
webappFilePath- path to webapp- Returns:
- absolute path to base dir
-
getMatchingHostName
- Parameters:
filePath- web app base dir path- Returns:
- virtual host name for web app dir
-
getMatchingVirtualHost
- Parameters:
baseDir- web application directory path- Returns:
- host name that matches the directory path
-
isWebappUploadedToVirtualAppBase
- Parameters:
webAppBaseDir- path to the webappappBase- virtual host path- Returns:
- true if Webapp is uploaded to Virtual Host, else false
-
getHost
public static org.apache.catalina.Host getHost(String webappFilePath) throws org.wso2.carbon.tomcat.CarbonTomcatException - Parameters:
webappFilePath- Webapp path- Returns:
- virtualHost if webapp is uploaded to Virtual Host else defaultHost
- Throws:
org.wso2.carbon.tomcat.CarbonTomcatException
-
getWebappKey
This will return a key with pair hostname:webappFileName- Parameters:
webappFile- web application file- Returns:
:invalid input: '<'webapp-name>
-
getVhostNames
- Returns:
- List of virtual hosts
-
getAppbase
This util method will return appbase value of matching host name from catalina-server.xml- Parameters:
hostName- hostname of Host element- Returns:
- relevant appBase for the host
-
getAllWebappHolders
public static Map<String,WebApplicationsHolder> getAllWebappHolders(org.apache.axis2.context.ConfigurationContext configurationContext) - Parameters:
configurationContext- ConfigurationContext instance- Returns:
- list of web application holders
-
getWebappHolder
public static WebApplicationsHolder getWebappHolder(String webappFilePath, org.apache.axis2.context.ConfigurationContext configurationContext) This util method will return the web application holder of the given web app file- Parameters:
webappFilePath- AbsolutePath of webappconfigurationContext- ConfigurationContext instance- Returns:
- relevant webapplication holder
-
getWebappDir
This util method is used to return base dir name of webapp. eg: for input "/deployment/server/webapps/calenda.war" will return "webapps"- Parameters:
webappFilePath- path to web app- Returns:
- parent dir of web application
-
getWebappName
- Parameters:
webappFilePath- path to webapp- Returns:
- web application name
-
getDefaultWebappHolder
public static WebApplicationsHolder getDefaultWebappHolder(org.apache.axis2.context.ConfigurationContext configurationContext) -
getDefaultHost
- Returns:
- default host of engine element
-
getServerConfigHostName
This will read "HostName" value from carbon.xml and will return default host (from catalina-server.xml) if the value is null (or not defined)- Returns:
- host name read from carbon.xml
-
getAppBases
-
generateMetaFileDirName
-
getWebappResourcePath
Returns the registry path for the webapp- Parameters:
webApplication- WebApplication instance- Returns:
-