Hi All,

I tried to deploy multiple travelocity applications samples by renaming the
web application directory. But it didn't work. The reason for this behavior
is in code level we check the web application context path contains
travelocity.com. So if I renamed the web application to
travelovitysample.com, it won't work as the initial travelocity.property
configuration not getting loaded. I think it's better to add this.

Code :

if(servletContextEvent.getServletContext().getContextPath().contains("travelocity.com"))
{
    properties.load(servletContextEvent.getServletContext().
            getResourceAsStream("/WEB-INF/classes/travelocity.properties"));
} else 
if(servletContextEvent.getServletContext().getContextPath().contains("avis.com"))
{
    properties.load(servletContextEvent.getServletContext().
            getResourceAsStream("/WEB-INF/classes/avis.properties"));
}

Then I have added an else statement which will switch to
travelocity.properties file in its own web application path.

if(servletContextEvent.getServletContext().getContextPath().contains("travelocity.com"))
{
    properties.load(servletContextEvent.getServletContext().
            getResourceAsStream("/WEB-INF/classes/travelocity.properties"));
} else 
if(servletContextEvent.getServletContext().getContextPath().contains("avis.com"))
{
    properties.load(servletContextEvent.getServletContext().
            getResourceAsStream("/WEB-INF/classes/avis.properties"));
} else {
    try {
        properties.load(servletContextEvent.getServletContext().
                getResourceAsStream("/WEB-INF/classes/travelocity.properties"));
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Error while loading the default
configuration in /WEB-INF/classes/travelocity.properties", e);
    }
}

Thanks,
Harsha
-- 
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: +94775505618
Blog:harshcreationz.blogspot.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to