📄 env-tags.xtp
字号:
<document><header><product>resin</product><title>Resources: class loaders, environment and IoC</title><version>Resin 3.0</version><description><p>Environment tags configure class-loaders, logging, authenticationand resources like databases, JMS queues, EJB servers, and web serviceclients. Many of the resources are stored in JNDI or in EL variablesfor later assembly.</p><p>Any environment resource can appear in anyof Resin environments: <resin>, <cluster>, <host> and <web-app>.Resources configured at parent levels are shared among all children,so a database can share connection pools for all web-apps or anauthenticator can provide single-signon.</p></description></header><body><localtoc/><defun title="<authenticator>" occur="*"><parents>resin, cluster, host, web-app, login-config</parents> <!-- com.caucho.config.types.Authenticator --><p><authenticator> configures an authentication resourcefor the current environment context. The authenticator is used forlogin and also for the <code>getUserPrincipal</code>and <code>isUserInRole</code> methods of the<code>HttpServletRequest</code> object.</p><p>The authenticators are scoped to their containing environment.An authenticator defined inWEB-INF/resin-web.xml applies only to the web-app, while anauthenticator defined in the <cluster> section of the resin.xmlapplies to the entire cluster. The <a href="resin-tags.xtp#management"><management></a> configuration provides an authenticator which is availableto all applications.</p><p>Resin's servlet authentication uses an authentication resource tovalidate user login and to provide single-signon capability.The authenticator is configured in the environment contextwhere it is shared. An authenticator configured in the web-apponly applies to the web-app, but an authenticator configured inthe host will apply to all hosts.</p><p>The authenticator class is selected with the <var>uri</var> or<var>class</var> attribute. The <var>class</var> can be any custom classextending <code>com.caucho.server.security.AbstractAuthenticator</code>.The <var>uri</var> is a symbolic name for the authenticator class.More details on the predefined authenticators are in the<a href="resin-security.xtp">Resin security</a> documentation.</p><ul><li><var>properties:</var> Java properties-style authentication.</li><li><var>jaas:</var> JAAS authentication.</li><li><var>jdbc:</var> JDBC password-based authentication.</li><li><var>xml:</var> XML JDBC password-based authentication.</li></ul><p>Configuration of the authenticator uses bean-style configuration in the<init> tag.</p><p>See also: the <a href="resin-security.xtp">Resin security</a> section.</p><deftable-childtags title="<authenticator> attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>binding</td> <td>Custom WebBeans binding. Since Resin 3.1.5</td> <td></td></tr><tr> <td>class</td> <td>The implementing class for the authenticator. Since Resin 3.0</td> <td></td></tr><tr> <td>jndi-name</td> <td>The JNDI name where the authenticator is stored. Since Resin 3.0</td> <td></td></tr><tr> <td>name</td> <td>The Resin-IoC name where the authenticator is stored. Since Resin 3.1.5</td> <td></td></tr><tr> <td>uri</td> <td>shortcut alias for the authenticator class. Can also include inlineparameters. Examples include xml:, property:, jdbc:, jndi:.</td> <td></td></tr><tr> <td>init</td> <td>A bean-style configuration section. Since Resin 3.0</td> <td></td></tr></deftable-childtags><def title="<authenticator> schema">r_authenticator = element authenticator { (r_class | r_uri) & r_binding* & r_init? & r_jndi-name? & r_name? & r_scope?}</def><example title="Example: WEB-INF/resin-web.xml properties-based authenticator"><web-app xmlns="http://caucho.com/ns/resin"> <authenticator uri="properties:password-digest=none"> <init>harry=quidditch,userron=cannons,user,prefect </init> </authenticator></web-app></example></defun><defun title="<bam-service>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents><p><bam-service> configures a <a href="hmtp.xtp">BamService</a> tolisten for messages. The service is always a single instance.</p><p><bam-service> can be used as a simple queueing service, replacingJMS queues and ejb-message-bean. By default the queue is consumed with a single thread. Unlike EJB message driven beans, <bam-service>uses a single instance like a servlet, not a pool of instances.</p><p>The bean has full access to Resin-IoC capabilities, includingdependency injection, transaction attributes, and aspect interception.</p><deftable title="<bam-service> attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>class</td> <td>Classname of the BamService bean</td> <td>required</td></tr><tr> <td>init</td> <td>IoC configuration for the listener bean</td> <td></td></tr><tr> <td>name</td> <td>The JID of the service, used by clients to send messages to</td> <td></td></tr><tr> <td>thread-max</td> <td>The number of threads to handle the queue. If 0, the service is not queued, but handles messages directly.</td> <td>1</td></tr><tr> <td>uri</td> <td>A shortcut name for the service, defined in META-INF/caucho/com.caucho.uri/com.caucho.bam.BamService.</td> <td></td></tr></deftable><def title="<bam-service> schema">element ejb-message-bean { class & init? & name? & uri?}</def><example title="Example: Log service in WEB-INF/resin-web.xml"><web-app xmlns="http://caucho.com/ns/resin"> <bam-service uri="caucho.log:"> <name>log</name> <init> <name>test.Log<name> </init> </bam-service></web-app></example></defun><defun title="<bean>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents> <!-- com.caucho.config.types.Resource --><p><bean> configures a custom singleton bean and stores in theWebBeans registry. <bean> is a primary configuration tagfor <a href="resin-ioc.xtp">Resin's IoC</a> capabilities.The bean can also be optional registered in JNDI.</p><p>Custom configuration of the bean is in the <init> section.Field values may use JSP-EL expressions as well as constant stringsor even complex sub-beans. More details for configuring singletonbeans are in <a href="resin-ioc.xtp">Resin IoC</a>.</p><deftable-childtags title="<bean> attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>class</td> <td>Application class implementing the resource. Since Resin 3.0</td> <td>required</td></tr><!--<tr> <td>arg</td> <td>Arguments to the resource's constructor. Since Resin 3.0</td> <td></td></tr>--><tr> <td>init</td> <td>IoC configuration for the bean</td> <td></td></tr><!--<tr> <td>listener</td> <td>Registers the bean as a listener for a JMX emitter. Resin 3.0</td> <td></td></tr>--><tr> <td>jndi-name</td> <td>JNDI name for the resource. Since Resin 3.0</td> <td></td></tr><tr> <td>mbean-name</td> <td>JMX name for management registration. Resin 3.0</td> <td></td></tr><tr> <td>name</td> <td>The name of the bean, used for @Named injection. Resin 3.1.4.</td> <td></td></tr><tr> <td>scope</td> <td>request, session, conversational, application, singleton. Resin 3.1.4.</td> <td>singleton</td></tr></deftable-childtags><def title="<bean> schema">r_bean = element bean { r_class? & r_binding* & r_init? & r_jndi-name? & r_mbean-name? & r_mbean-interface? & r_name? & r_scope?}</def><example title="Example: WEB-INF/resin-web.xml singleton bean"><web-app xmlns="http://caucho.com/ns/resin"> <bean name="test"> <type>test.MyBean</type> <init> <greeting>Hello</greeting> <server>${serverId}</server> <sub-bean> <value>${2 + 2}</value> </sub-bean> </init> </bean></web-app></example></defun> <defun title="<case-insensitive>" occur="?"><parents>resin, cluster, host, web-app</parents><default>true on Windows, false on Unix.</default><p><case-insensitive> specifies whether the environmentcontext is case sensitive or insensitive.</p><p>Because some operating systems are case-insensitive, it is importantfor security reasons for Resin to behave differently for case-sensitiveand case-insensitive directories. For example, when case-insensitiveis true, url-patterns will match in a case-insensitive manner, so TEST.JSPwill work like test.jsp.</p><def title="<case-insensitive> schema">r_case-insensitive = element case-insensitive { r_boolean-Type}</def></defun><defun title="<character-encoding>" occur="?" version="Resin 1.1" type="defun"><parents>resin, cluster, host, web-app</parents><default>The default value is ISO-8859-1.</default><p><character-encoding> specifies the default characterencoding for the environment.</p><def title="<character-encoding> schema">r_character-encoding = element character-encoding { string}</def><example title="Example: utf-8 as default character encoding"><resin xmlns="http://caucho.com/ns/resin"> <character-encoding>utf-8</character-encoding> ...</resin></example></defun><defun title="<class-loader>" occur="*" version="Resin 3.0"> <parents>resin, cluster, host, web-app</parents> <!-- com.caucho.loader.EnvironmentClassLoader --><p><class-loader> configures a dynamic classloaderfor the current environment.</p><p>Each environment (<cluster>, <host>, <web-app>) etc,can add dynamic classloaders. The environment will inherit the parentclassloaders. Each <class-loader> is comprised of several implementingloader items: library-loader for WEB-INF/lib, compiling-loader forWEB-INF/classes.</p><p>For web-apps, the classloaders generally belong in a <prologue>section, which ensures that Resin evaluates them first. The evaluationorder is particularly important in cases like resin-web.xml vs web.xml,because the resin-web.xml is evaluated after the web.xml.</p><deftable title="classloader types"><tr> <th>Element</th> <th>Description</th></tr><tr> <td><compiling-loader></td> <td>Automatically compiles sources code toclasses. It its the default loader for WEB-INF/classes.</td></tr><tr> <td><library-loader></td> <td>Loads jar files from a directory. It is the default loaderfor WEB-INF/lib.</td></tr><tr> <td><simple-loader></td> <td>Loads classes from a directory, but does not compile themautomatically.</td></tr><tr> <td><tree-loader></td> <td>Loads jar files from a directory, recursively searching subdirectories.</td></tr></deftable><def title="<class-loader> schema">r_class-loader = element class-loader { r_compiling-loader* & r_library-loader* & r_simple-loader* & r_tree-loader*}</def><example title="Example: WEB-INF/resin-web.xml defined <class-loader>"><web-app xmlns="http://caucho.com/ns/resin"> <prologue> <class-loader> <compiling-loader path="WEB-INF/classes"/> <library-loader path="WEB-INF/lib"/> </class-loader> </prologue></web-app></example></defun><defun title="<compiling-loader>" occur="*" version="Resin 3.0" type="defun"> <parents>class-loader</parents> <!-- com.caucho.loader.CompilingLoader --><p><compiling-loader> automatically compiles Java code into .classfiles before loading them.</p><deftable title="<compiling-loader> attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>args</td> <td>Additional arguments to be passed to the Java compiler. Resin 3.0</td> <td></td></tr><tr><td>batch</td> <td>If true, multiple changed *.java files will be compiled in a single batch. Resin 3.0.7</td> <td>true</td></tr><tr> <td>encoding</td> <td>I18N encoding for the Java compiler. Since Resin 3.0</td> <td></td></tr><tr> <td>path</td> <td>Filesystem path for the class loader. Since Resin 3.0</td> <td>required</td></tr><tr> <td>source</td> <td>Java source directory. Since Resin 3.0</td> <td>value of path</td></tr><tr> <td>require-source</td> <td>If true, .class files without matching .java files will be deleted. Since Resin 3.0</td> <td>false</td></tr></deftable><example title="Example: WEB-INF/resin-web.xml <compiling-loader>"><web-app xmlns="http://caucho.com/ns/resin"> <prologue> <class-loader> <compiling-loader path="WEB-INF/classes" source="WEB-INF/src"/> </class-loader> </prologue></web-app></example></defun><defun title="<component>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents> <!-- com.caucho.config.types.Resource --><p><component> configures a component bean template and stores in theWebBeans registry. Injection of a <component> will generally create anew bean instance in constrast to the singleton <bean>.<component> is a primary configuration tagfor <a href="resin-ioc.xtp">Resin's IoC</a> capabilities.The bean can also be optionally registered in JNDI.</p><p>Custom configuration of the component is in the <init> section.Field values may use JSP-EL expressions as well as constant stringsor even complex sub-beans. More details for configuring singletonbeans are in <a href="resin-ioc.xtp">Resin IoC</a>.</p><deftable-childtags title="<component> attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>class</td> <td>Application class implementing the resource. Since Resin 3.0</td> <td>required</td></tr><tr> <td>init</td> <td>IoC configuration for the bean</td> <td></td></tr><tr> <td>jndi-name</td> <td>JNDI name for the resource. Since Resin 3.0</td> <td></td></tr><tr> <td>name</td> <td>The name of the bean, used for @Named injection. Resin 3.1.4.</td> <td></td></tr><tr> <td>scope</td> <td>dependent, request, session, conversational, application, singleton. Resin 3.1.4.</td> <td>dependent</td></tr></deftable-childtags><def title="<component> schema">r_component = element component { r_class?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -