org.wso2.carbon.webapp.mgt.utils
Class WebAppUtils

java.lang.Object
  extended by org.wso2.carbon.webapp.mgt.utils.WebAppUtils

public class WebAppUtils
extends Object


Field Summary
static List<String> appBases
           
static List<String> vhostNames
           
 
Constructor Summary
WebAppUtils()
           
 
Method Summary
static String checkJaxApplication(WebApplication webApplication)
          This util method is used to check if the given application is a Jax-RS/WS app
static Map<String,WebApplicationsHolder> getAllWebappHolders(org.apache.axis2.context.ConfigurationContext configurationContext)
           
static String getAppbase(String hostName)
          This util method will return appbase value of matching host name from catalina-server.xml
static String getDefaultHost()
           
static WebApplicationsHolder getDefaultWebappHolder(org.apache.axis2.context.ConfigurationContext configurationContext)
           
static String getMatchingHostName(String filePath)
           
static String 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)
static String getWebappDir(String webappFilePath)
          This util method is used to return base dir name of webapp.
static String getWebappDirPath(String webappFilePath)
          This util method is used to return file path of base dir.
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
static String getWebappKey(File webappFile)
          This will return a key with pair hostname:webappFileName
static String getWebappName(String webappFilePath)
           
static boolean validateWebappFileName(String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vhostNames

public static List<String> vhostNames

appBases

public static List<String> appBases
Constructor Detail

WebAppUtils

public WebAppUtils()
Method Detail

checkJaxApplication

public static String checkJaxApplication(WebApplication webApplication)
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

public static boolean validateWebappFileName(String filename)

getWebappDirPath

public static String getWebappDirPath(String webappFilePath)
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

public static String getMatchingHostName(String filePath)
Parameters:
filePath - web app base dir path
Returns:
virtual host name for web app dir

getWebappKey

public static String getWebappKey(File webappFile)
This will return a key with pair hostname:webappFileName

Parameters:
webappFile - web application file
Returns:
:

getAppbase

public static String getAppbase(String hostName)
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 webapp
configurationContext - ConfigurationContext instance
Returns:
relevant webapplication holder

getWebappDir

public static String getWebappDir(String webappFilePath)
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

public static String getWebappName(String webappFilePath)
Parameters:
webappFilePath - path to webapp
Returns:
web application name

getDefaultWebappHolder

public static WebApplicationsHolder getDefaultWebappHolder(org.apache.axis2.context.ConfigurationContext configurationContext)

getDefaultHost

public static String getDefaultHost()
Returns:
default host of engine element

getServerConfigHostName

public static String 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


Copyright © 2015 WSO2. All rights reserved.