⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 env-tags.xtp

📁 RESIN 3.2 最新源码
💻 XTP
📖 第 1 页 / 共 5 页
字号:
<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: &lt;resin>, &lt;cluster>, &lt;host> and &lt;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="&lt;authenticator>" occur="*"><parents>resin, cluster, host, web-app, login-config</parents>  <!-- com.caucho.config.types.Authenticator --><p>&lt;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 &lt;cluster> section of the resin.xmlapplies to the entire cluster.  The <a href="resin-tags.xtp#management">&lt;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&lt;init&gt; tag.</p><p>See also: the <a href="resin-security.xtp">Resin security</a> section.</p><deftable-childtags title="&lt;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="&lt;authenticator> schema">r_authenticator = element authenticator {  (r_class | r_uri)  &amp; r_binding*  &amp; r_init?  &amp; r_jndi-name?  &amp; r_name?  &amp; r_scope?}</def><example title="Example: WEB-INF/resin-web.xml properties-based authenticator">&lt;web-app xmlns="http://caucho.com/ns/resin">  &lt;authenticator uri="properties:password-digest=none">    &lt;init>harry=quidditch,userron=cannons,user,prefect    &lt;/init>  &lt;/authenticator>&lt;/web-app></example></defun><defun title="&lt;bam-service>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents><p>&lt;bam-service> configures a <a href="hmtp.xtp">BamService</a> tolisten for messages.  The service is always a single instance.</p><p>&lt;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, &lt;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="&lt;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="&lt;bam-service> schema">element ejb-message-bean {  class  &amp; init?  &amp; name?  &amp; uri?}</def><example title="Example: Log service in WEB-INF/resin-web.xml">&lt;web-app xmlns="http://caucho.com/ns/resin">  &lt;bam-service uri="caucho.log:">    &lt;name>log&lt;/name>    &lt;init>      &lt;name>test.Log&lt;name>    &lt;/init>  &lt;/bam-service>&lt;/web-app></example></defun><defun title="&lt;bean>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents>  <!-- com.caucho.config.types.Resource --><p>&lt;bean> configures a custom singleton bean and stores in theWebBeans registry.  &lt;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 &lt;init&gt; 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="&lt;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="&lt;bean> schema">r_bean = element bean {  r_class?  &amp; r_binding*  &amp; r_init?  &amp; r_jndi-name?  &amp; r_mbean-name?  &amp; r_mbean-interface?  &amp; r_name?  &amp; r_scope?}</def><example title="Example: WEB-INF/resin-web.xml singleton bean">&lt;web-app xmlns="http://caucho.com/ns/resin">  &lt;bean name="test"&gt;    &lt;type&gt;test.MyBean&lt;/type&gt;    &lt;init&gt;      &lt;greeting&gt;Hello&lt;/greeting&gt;      &lt;server&gt;${serverId}&lt;/server&gt;      &lt;sub-bean&gt;        &lt;value&gt;${2 + 2}&lt;/value&gt;      &lt;/sub-bean&gt;    &lt;/init&gt;  &lt;/bean&gt;&lt;/web-app></example></defun> <defun title="&lt;case-insensitive>" occur="?"><parents>resin, cluster, host, web-app</parents><default>true on Windows, false on Unix.</default><p>&lt;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="&lt;case-insensitive> schema">r_case-insensitive = element case-insensitive {  r_boolean-Type}</def></defun><defun title="&lt;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>&lt;character-encoding> specifies the default characterencoding for the environment.</p><def title="&lt;character-encoding> schema">r_character-encoding = element character-encoding {  string}</def><example title="Example: utf-8 as default character encoding">&lt;resin xmlns="http://caucho.com/ns/resin">  &lt;character-encoding&gt;utf-8&lt;/character-encoding&gt;  ...&lt;/resin&gt;</example></defun><defun title="&lt;class-loader>" occur="*" version="Resin 3.0">  <parents>resin, cluster, host, web-app</parents>  <!-- com.caucho.loader.EnvironmentClassLoader --><p>&lt;class-loader> configures a dynamic classloaderfor the current environment.</p><p>Each environment (&lt;cluster&gt;, &lt;host&gt;, &lt;web-app&gt;) etc,can add dynamic classloaders.  The environment will inherit the parentclassloaders.  Each &lt;class-loader&gt; 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 &lt;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>&lt;compiling-loader></td>  <td>Automatically compiles sources code toclasses.  It its the default loader for WEB-INF/classes.</td></tr><tr>  <td>&lt;library-loader></td>  <td>Loads jar files from a directory.  It is the default loaderfor WEB-INF/lib.</td></tr><tr>  <td>&lt;simple-loader></td>  <td>Loads classes from a directory, but does not compile themautomatically.</td></tr><tr>  <td>&lt;tree-loader></td>  <td>Loads jar files from a directory, recursively searching subdirectories.</td></tr></deftable><def title="&lt;class-loader> schema">r_class-loader = element class-loader {  r_compiling-loader*  &amp; r_library-loader*  &amp; r_simple-loader*  &amp; r_tree-loader*}</def><example title="Example: WEB-INF/resin-web.xml defined &lt;class-loader>">&lt;web-app xmlns="http://caucho.com/ns/resin"&gt;  &lt;prologue>    &lt;class-loader&gt;      &lt;compiling-loader path="WEB-INF/classes"/&gt;      &lt;library-loader path="WEB-INF/lib"/&gt;    &lt;/class-loader&gt;  &lt;/prologue>&lt;/web-app&gt;</example></defun><defun title="&lt;compiling-loader>" occur="*" version="Resin 3.0" type="defun">  <parents>class-loader</parents>  <!-- com.caucho.loader.CompilingLoader --><p>&lt;compiling-loader> automatically compiles Java code into .classfiles before loading them.</p><deftable title="&lt;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 &lt;compiling-loader>">&lt;web-app xmlns="http://caucho.com/ns/resin">  &lt;prologue>    &lt;class-loader>      &lt;compiling-loader path="WEB-INF/classes"                        source="WEB-INF/src"/>    &lt;/class-loader>  &lt;/prologue>&lt;/web-app></example></defun><defun title="&lt;component>" occur="*" version="Resin 3.0"><parents>resin, cluster, host, web-app</parents>  <!-- com.caucho.config.types.Resource --><p>&lt;component> configures a component bean template and stores in theWebBeans registry.  Injection of a &lt;component> will generally create anew bean instance in constrast to the singleton &lt;bean>.&lt;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 &lt;init&gt; 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="&lt;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="&lt;component> schema">r_component = element component {  r_class?

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -