0

context.xml

asked 2010-04-13 11:26:43 +0800

saad gravatar image saad
207 1 2

hi all
please can you explain me the role of field "context.xml" in zk project
thx for advice

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2010-04-14 22:41:36 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi saad
It seems a tomcat's setting file
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

link publish delete flag offensive edit

answered 2010-04-15 05:15:03 +0800

saad gravatar image saad
207 1 2

Hi
is not a tomcat's setting file
this is a exemple to clarify

<Context>
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>

thx for explain the role of this file context.xml

link publish delete flag offensive edit

answered 2010-04-15 07:16:31 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

/META-INF/context.xml

It's a tomcat file.

We use it for the jindi datasource that let tomcat connect direct to the database.

link publish delete flag offensive edit

answered 2010-04-15 09:56:24 +0800

saad gravatar image saad
207 1 2

thx terry
in order to complet ur answer
can you explain me what you mean by the word "jindi"
and send me a zk link tutoriel for more details about contrext.xml
thx again

link publish delete flag offensive edit

answered 2010-04-15 15:44:31 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-04-15 15:50:02 +0800

Here are the partial codes from the Zksample2

Jndi = Java Naming and Directory Interface

customize-applicationContext.xml

    .  .  .
	<!-- ====================================================== -->
	<!--    THIS PLACE IS FOR CONFIGURING a Jndi CONNECTION     -->
	<!--       USE THIS FOR LET TOMCAT CONNECT TO YOUR OWN      -->
	<!--                   DATABASE PER: Jndi                   -->
	<!-- ====================================================== -->
	<!--
		<bean id="dataSource"	class="org.springframework.jndi.JndiObjectFactoryBean">
                    <property  name="jndiName" value="java:comp/env/jdbc/toledo" /> 
                    <property   name="lookupOnStartup" value="false" /> <property name="cache"value="true" /> 
                    <property name="proxyInterface"  value="javax.sql.DataSource" /> 
               </bean>
	-->
     .   .   .


.

/META-INF/context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context>
	<ResourceLink auth="Container" name="jdbc/toledo" global="jdbc/toledo" type="javax.sql.DataSource"
		description="toledo" />
</Context>

best
Stephan

PS: This is not from a tutorial. This is from the Tomcat docs. Please read it.

link publish delete flag offensive edit

answered 2010-04-19 04:25:20 +0800

saad gravatar image saad
207 1 2

thx terry

link publish delete flag offensive edit

answered 2010-04-19 15:39:28 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-04-19 15:40:33 +0800

@saad

i have forgotten the corresponding codes in Tomcat's server.xml

server.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
		Licensed to the Apache Software Foundation (ASF) under one or more
		contributor license agreements. See the NOTICE file distributed with
		this work for additional information regarding copyright ownership.
		The ASF licenses this file to You under the Apache License, Version
		2.0 (the "License"); you may not use this file except in compliance
		with the License. You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
		applicable law or agreed to in writing, software distributed under the
		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
		CONDITIONS OF ANY KIND, either express or implied. See the License for
		the specific language governing permissions and limitations under the
		License.
	--><!--
		Note: A "Server" is not itself a "Container", so you may not define
		subcomponents such as "Valves" at this level. Documentation at
		/docs/config/server.html
	--><Server port="8005" shutdown="SHUTDOWN">

	<!--APR library loader. Documentation at /docs/apr.html -->
	<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
	<!--
		Initialize Jasper prior to webapps are loaded. Documentation at
		/docs/jasper-howto.html
	-->
	<Listener className="org.apache.catalina.core.JasperListener"/>
	<!--
		JMX Support for the Tomcat server. Documentation at
		/docs/non-existent.html
	-->
	<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
	<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>


	<!--
		Global JNDI resources Documentation at /docs/jndi-resources-howto.html
	-->



	<GlobalNamingResources>
		<!--
			Editable user database that can also be used by UserDatabaseRealm to
			authenticate users
		-->
		<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
		<Resource auth="Container" driverClassName="org.postgresql.Driver" logAbandoned="true" maxActive="50" maxIdle="10" maxOpenPreparedStatements="50" maxWait="10000" name="jdbc/toledo" password="XXXXXXXXXX" poolPreparedStatements="true" removeAbandoned="true" removeAbandonedTimeout="180" scope="Shareable" testWhileIdle="true" timeBetweenEvictionRunsMillis="600000" type="javax.sql.DataSource" url="jdbc:postgresql://localhost:5432/test_db" username="XXXXXXXXXX" validationQuery="Select usr_id from sec_user limit 1"/>

		<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
	</GlobalNamingResources>









	<!--
		A "Service" is a collection of one or more "Connectors" that share a
		single "Container" Note: A "Service" is not itself a "Container", so
		you may not define subcomponents such as "Valves" at this level.
		Documentation at /docs/config/service.html
	-->
	<Service name="Catalina">

		<!--
			The connectors can use a shared executor, you can define one or more
			named thread pools
		-->
		<Executor maxThreads="500" minSpareThreads="4" name="tomcatThreadPool" namePrefix="catalina-exec-"/>


		<!--
			A "Connector" represents an endpoint by which requests are received
			and responses are returned. Documentation at : Java HTTP Connector:
			/docs/config/http.html (blocking & non-blocking) Java AJP Connector:
			/docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define
			a non-SSL HTTP/1.1 Connector on port 8080
		-->
		<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
		<!-- A "Connector" using the shared thread pool-->
		<!--
			<Connector executor="tomcatThreadPool" port="8080"
			protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
		-->
		<!--
			Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the
			JSSE configuration, when using APR, the connector should be using the
			OpenSSL style configuration described in the APR documentation
		-->
		<!--
			<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
			maxThreads="150" scheme="https" secure="true" clientAuth="false"
			sslProtocol="TLS" />
		-->

		<!-- Define an AJP 1.3 Connector on port 8009 -->
		<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>


		<!--
			An Engine represents the entry point (within Catalina) that processes
			every request. The Engine implementation for Tomcat stand alone
			analyzes the HTTP headers included with the request, and passes them
			on to the appropriate Host (virtual host). Documentation at
			/docs/config/engine.html
		-->

		<!--
			You should set jvmRoute to support load-balancing via AJP ie :
			<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
		-->
		<Engine defaultHost="localhost" name="Catalina">

			<!--
				For clustering, please take a look at documentation at:
				/docs/cluster-howto.html (simple how to) /docs/config/cluster.html
				(reference documentation)
			-->
			<!--
				<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
			-->

			<!--
				The request dumper valve dumps useful debugging information about
				the request and response data received and sent by Tomcat.
				Documentation at: /docs/config/valve.html
			-->
			<!--
				<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
			-->

			<!--
				This Realm uses the UserDatabase configured in the global JNDI
				resources under the key "UserDatabase". Any edits that are performed
				against this UserDatabase are immediately available for use by the
				Realm.
			-->
			<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

			<!--
				Define the default virtual host Note: XML Schema validation will not
				work with Xerces 2.2.
			-->
			<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">

				<!--
					SingleSignOn valve, share authentication between web applications
					Documentation at: /docs/config/valve.html
				-->
				<!--
					<Valve className="org.apache.catalina.authenticator.SingleSignOn"
					/>
				-->

				<!--
					Access log processes all example. Documentation at:
					/docs/config/valve.html
				-->
				<!--
					<Valve className="org.apache.catalina.valves.AccessLogValve"
					directory="logs" prefix="localhost_access_log." suffix=".txt"
					pattern="common" resolveHosts="false"/>
				-->

			<Context docBase="maven-zkoss" path="/zkoss" reloadable="true" source="org.eclipse.jst.jee.server:maven-zkoss"/></Host>
		</Engine>
	</Service>
</Server>

best
Stephan

link publish delete flag offensive edit

answered 2010-04-20 05:54:03 +0800

saad gravatar image saad
207 1 2

thx stephan

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-04-13 11:26:43 +0800

Seen: 919 times

Last updated: Apr 20 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More