Deploying multiple travelocity applications by renaming the web application name

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Deploying multiple travelocity applications by renaming the web application name

Harsha Kumara-2
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
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploying multiple travelocity applications by renaming the web application name

Harsha Kumara-2
Created JIRA in [1] in a case of we going to add it.


On Sun, Aug 13, 2017 at 1:31 AM, Harsha Kumara <[hidden email]> wrote:
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: <a href="tel:+94%2077%20550%205618" value="+94775505618" target="_blank">+94775505618
Blog:harshcreationz.blogspot.com



--
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: +94775505618
Blog:harshcreationz.blogspot.com

_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Deploying multiple travelocity applications by renaming the web application name

Johann Nallathamby
Provided a fix for this issue: https://github.com/wso2/product-is/pull/1303. Please review and merge.

On Sun, Aug 13, 2017 at 1:33 AM, Harsha Kumara <[hidden email]> wrote:
Created JIRA in [1] in a case of we going to add it.


On Sun, Aug 13, 2017 at 1:31 AM, Harsha Kumara <[hidden email]> wrote:
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: <a href="tel:+94%2077%20550%205618" value="+94775505618" target="_blank">+94775505618
Blog:harshcreationz.blogspot.com



--
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: <a href="tel:+94%2077%20550%205618" value="+94775505618" target="_blank">+94775505618
Blog:harshcreationz.blogspot.com



--
Thanks & Regards,

Johann Dilantha Nallathamby
Senior Lead Solutions Engineer
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94777776950

_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev
Loading...