What is the glassfish alternative for context.xml

I use to configure the web application in context.xml, including resorces jdbc and application configuration options.

As for glass fish, what is considered the standard place to store application configuration information?

We used it to store in a file context.xmlas follows:

<Resource
url="jdbc:mysql://localhost:3306/db?useUnicode=true&amp;characterEncoding=utf8"
username="username"
name="jdbc/db"
password="secret"
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
maxActive="5" maxIdle="2" maxWait="10000"
removeAbandoned="true"
type="javax.sql.DataSource"
/>

<Parameter name="application.url" value="http://localhost:8080/News/" override="false"/>
<Parameter name="smtp.server" value="smtp.example.com" override="false"/>
<Parameter name="smtp.port" value="25" override="false"/>
<Parameter name="smtp.from.address" value="admin@example.com" override="false"/>
<Parameter name="smtp.from.name" value="Site administrator" override="false"/>
<Parameter name="list.name" value="DEV" override="false"/>
<Parameter name="temporary.folder" value="/tmp" override="false"/>
<Parameter name="authentication.type" value="LDAP" override="false"/>
+5
source share
5 answers

Rejects the answer that there is no alternative to the section in tomcats context.xml.

It turns out that the item is tomcat-specific, usually not supported by other application servers such as glass fish.

, , / , .

+1
+2

, Glassfish - .

Glassfish context.xml, / -. asadmin set-web-context-param. domain.xml - .

( ):

set-web-context-param [--help] --name=context-param-name 
    {--value=value|--ignoredescriptoritem={false|true}} 
    [--description=description] application-name[/module]

, JDBC, asadmin, -gui . domain.xml.

+2

web.xml, Java EE.

tomcat context.xml.

,   . , :

<Context ...>   ...   
<Parameter name="companyName" value="My Company, 
    Incorporated" override="false"/>
</Context>

(/WEB-INF/web.xml):

<context-param>   
    <param-name>companyName</param-name>  
    <param-value>My Company, Incorporated</param-value>
</context-param>
+1

Instead, you can use the JNDI properties. I believe Glassfish uses the jndi.properties file.

http://docs.sun.com/app/docs/doc/820-4336/gcpge?a=view

0
source

All Articles