简体   繁体   English

Glassfish-同一应用程序的不同参数值

[英]Glassfish - Different parameter value for the same application

I have an application that requires some external parameters to do it's job. 我有一个需要一些外部参数才能完成工作的应用程序。 At this moment I'm passing this parameters as JVM parameters and reading then through System.getProperty() . 目前,我将此参数作为JVM参数传递,然后通过System.getProperty()读取。 Now, my application will be used by two different clients, and I want to pass different values depending on which client is accessing. 现在,我的应用程序将由两个不同的客户端使用,并且我想根据访问哪个客户端来传递不同的值。 I know that I can do that by creating two domains, but I would really like to have them using the same port, and app name. 我知道我可以通过创建两个域来做到这一点,但是我真的很想让它们使用相同的端口和应用程序名称。 Ex: 例如:

http://client1.myurl.com:8080/app

http://client2.myurl.com:8080/app

I have already created two Virtual-Servers, but I can't find out how I can pass different parameters to the app depending on which Virtual-Server is calling it. 我已经创建了两个虚拟服务器,但是我无法确定如何根据调用哪个虚拟服务器将不同的参数传递给应用程序。

I have found a solution for the problem. 我找到了解决该问题的方法。 I just needed to deploy the application twice with the same context-root but with a different name, binding each to a specific Virtual-Server. 我只需要使用相同的上下文根但使用不同的名称来部署应用程序两次,并将每个应用程序绑定到特定的虚拟服务器。

In this scenario two applications folder will be created on domain/applications, allowing me to have two versions of the same app but with a different properties file. 在这种情况下,将在域/应用程序上创建两个应用程序文件夹,这使我可以拥有同一应用程序的两个版本,但具有不同的属性文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM