📄 webapp-tags.xtp
字号:
<document><header> <product>resin</product> <title>Web Application: tags</title> <version>Resin 3.0</version> <description> <p>Web applications are configured with the <web-app> tag, which can occur in a number of places.</p> <ul> <li><var type="file">WEB-INF/web.xml</var> contains a top-level web-app element. It is the Servlet standard location for defining things like servlet mappings and security roles.</li> <li><var type="file">WEB-INF/resin-web.xml</var> is also used by Resin and will override and supplement the configuration in <var type="file">WEB-INF/web.xml</var>. Use it to specify Resin specific configuration if you prefer to keep <var>WEB-INF/web.xml</var> strictly conforming to the Servlet specification.</li> <li>A web application can also be configured in the main Resin configuration, and in this context <var>web-app</var> is a child of <<a href="host-tags.xtp">host</a>>.</li> </ul> </description></header><body><localtoc/><s1 title="See Also"><ul><li><a href="env-tags.xtp">Resources tags</a> for beans, components,databases, @Stateless and @Stateful EJBs, JMS queues, etc.</li><li><a href="resin-security.xtp">Security</a> for a full descriptionof Resin's authentication and authorization.</li><li><a href="rewrite-tags.xtp">Rewrite tags</a> for Resin's rewrite-dispatchrewriting.</li></ul></s1><defun title="<access-log>"><parents>web-app</parents><p><access-log> configures a HTTP access log for an indivitualweb-app. See <a href="host-tags.xtp#%3caccess-log%3d">access-log</a>in the <host> tag for more information.</p></defun><defun title="<active-wait-time>"><parents>web-app</parents><p><active-wait-time> sets a 503 busy timeout for requeststrying to access a restarting web-app. If the timeout expiresbefore the web-app complete initialization, the request will returna 503 Busy HTTP response.</p><def title="<active-wait-time> schema">element active-wait-time { r_period-Type}</def></defun><defun title="<allow-servlet-el>"><parents>web-app</parents><p>The <allow-servlet-el> flag configures whether <servlet>tags allow EL expressions in the init-param.</p><def title="<allow-servlet-el> schema">element allow-servlet-el { r_boolean-Type}</def></defun><defun title="<archive-path>"><parents>web-app</parents><p><archive-path> configures the location of the web-app's .war file.In some configurations, the .war expansion might notuse the <var>webapps/</var> directory, but will still want automaticwar expantion.</p><def title="<archive-path> schema">element archive-path { r_path-Type}</def><example title="Example: resin.xml explicit archive location"><resin xmlns="http://caucho.com/ns/resin"><cluster id=""> <host id=""> <web-app id="/foo" root-directory="/var/www/foo" archive-path="/var/www/wars/foo.war"/> </host></cluster></resin></example></defun><defun title="<auth-constraint>" version="Servlet"><parents>security-constraint</parents><p>Requires that authenticated users fill the specified role.In Resin's JdbcAuthenticator, normal users are in the "user" role.Think of a role as a group of users.</p><p>The roles are defined by the authenticators (see <a href="resin-security.xtp">Resin security</a>). When using Resin's <management> authenticationas a default, the role name is <var>resin-admin</var>. (See<a href="resin-admin.xtp">Resin management</a>.)</p><deftable-childtags><tr> <th>Attribute</th> <th>Description</th></tr><tr> <td>role-name</td> <td>Roles which are allowed to access the resource.</td></tr></deftable-childtags><def title="<auth-constraint> schema">element auth-constraint { description*, role-name*}</def><p>The following example protects the /admin subdirectory of a web-appby requiring a user to logon with Resin's <management> users, i.e.using the same requirement as /resin-admin.</p><example title="Example: WEB-INF/resin-web.xml auth constraints"><web-app xmlns="http://caucho.com/ns/resin"> <login uri="basic:"/> <security-constraint url-pattern="/admin/*"> <auth-constraint role-name="resin-admin"/> </security-constraint></web-app></example></defun><defun title="<cache-mapping>" version="Resin 1.1"><parents>web-app</parents> <p><cache-mapping> specifies <var>max-age</var> and <var>Expires</var> times for cacheable pages.</p><p>See <a href="proxy-cache.xtp">caching</a> for more information.</p><p><cache-mapping> is intended to provide Expires times for pages thathave ETags or Last-Modified specified, but do not wish to hard-code themax-age timeout in the servlet. For example, Resin's FileServlet relieson cache-mapping to set the expires times for static pages. Usingcache-mapping lets cacheable pages be configured in a standard manner.</p><p><cache-mapping> does not automatically make pages cacheable. Yourservlets must already set the <var>ETag</var> (or Last-Modified) headerto activate <cache-mapping>.</p> <deftable-childtags><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>expires</td> <td>A time interval to be used for the HTTP Expires header.</td> <td></td></tr><tr> <td>max-age</td> <td>A time interval to be used for the "Cache-Control max-age=xxx" header.max-age affects proxies and browsers.</td> <td></td></tr><tr> <td>s-max-age</td> <td>A time interval to be used for the "Cache-Control s-max-age=xxx" header.s-max-age affects proxy caches (including Resin), but not browsers.</td> <td></td></tr><tr><td>url-pattern</td> <td>A pattern matching the url:<var>/foo/*</var>, <var>/foo</var>, or <var>*.foo</var></td> <td></td></tr><tr><td>url-regexp</td> <td>A regular expression matching the url</td> <td></td></tr></deftable-childtags><p>The time interval defaults to seconds, but will allow other periods:</p><deftable><tr> <th>Suffix</th> <th>Meaning</th></tr><tr> <td>s</td> <td>seconds</td></tr><tr> <td>m</td> <td>minutes</td></tr><tr> <td>h</td> <td>hours</td></tr><tr> <td>D</td> <td>days</td></tr></deftable><def title="<cache-mapping> schema">element cache-mapping { (url-pattern | url-regexp) & expires? & max-age? & s-max-age?}</def><ul><li>cache-mapping requires an enabled <cache>. If the cache is disabled,cache-mapping will be ignored.</li><li>cache-mapping does not automatically make a page cacheable. Onlycacheable pages are affected by cache-mapping, i.e. pages with an ETag or Last-Modified.</li></ul><example title="Example: cache-mapping in resin-web.xml"><web-app xmlns="http://caucho.com/ns/resin"> <cache-mapping url-pattern='/*' max-age='10'/> <cache-mapping url-pattern='*.gif' max-age='15m'/></web-app></example></defun><defun title="<constraint>" version="Resin"><parents>security-constraint</parents><p>Defines a custom constraint. Applications can define their ownsecurity constraints to handle custom authentication requirements.</p><deftable-childtags><tr> <th>Attribute</th> <th>Description</th></tr><tr> <td>resin:type</td> <td>A class that extends <a href="javadoc|com.caucho.server.security.AbstractConstraint">AbstractConstraint</a></td></tr><tr> <td>init</td> <td>initialization parameters, set in the object using Bean-style setters and getters</td></tr></deftable-childtags><def title="<constraint> schema">element constraint { class & init?}</def></defun><defun title="<context-param>" version="Servlet 2.2"><parents>web-app</parents><p>Initializes application (ServletContext) variables. <var>context-param</var>defines initial values for <code>application.getInitParameter("foo")</code>. See also<a href="javadoc|javax.servlet.ServletContext">ServletContext.getInitParameter()</a>.</p><deftable title="<context-param attributes"><tr> <th>Attribute</th> <th>Description</th></tr><tr> <td>param-name</td> <td>Named parameter</td></tr><tr> <td>param-value</td> <td>Parameter value</td></tr><tr> <td><var/foo/></td> <td>Parameter name</td></tr></deftable><def title="<context-param> schema">element context-param { (param-name, param-value)* | (attribute * { string })* | (element * { string })*}</def><example title="Example: context-param in resin-web.xml"><web-app xmlns="http://caucho.com/ns/resin"> <context-param> <param-name>baz</param-name> <param-value>value</param-value> </context-param> <!-- shortcut --> <context-param foo="bar"/></web-app></example></defun><defun title="<cookie-http-only>"><parents>web-app</parents><p>The <cookie-http-only> flag configures the Http-Only attributefor all Cookies generated from the web-app. The Http-Only attributecan add security to a website by not forwarding HTTP cookies toSSL HTTPS requests.</p><def title="<cookie-http-only> schema">element cookie-http-only { r_boolean-Type}</def><example title="Example: <cookie-http-only> in resin.xml"><resin xmlns="http://caucho.com/ns/resin"><cluster id=""> <host id="www.foo.com"> <web-app id="" root-directory="/var/www/foo"> <cookie-http-only>true</cookie-http-only> <web-app id=""> </host> <host id="www.foo.com:443"> <web-app id="" root-directory="/var/www/foo-secure"> <secure/> <web-app id=""> </host></cluster></resin></example></defun> <defun title="<ear-deploy>"><parents>host, web-app</parents><p>Specifies ear expansion.</p><p>ear-deploy can be used in web-apps to define a subdirectoryfor ear expansion.</p><deftable title="<ear-deploy> Attributes"><tr> <th>Attribute</th> <th>Description</th> <th>Default</th></tr><tr> <td>archive-path</td> <td>The path to the directory containing ear files</td> <td>path</td></tr><tr> <td>ear-default</td> <td>resin.xml default configuration for all ear files, e.g. configuringdatabase, JMS or EJB defaults.</td> <td></td></tr><tr> <td>expand-cleanup-fileset</td> <td>Specifies the files which should be automatically deleted when anew .ear version is deployed.</td> <td></td></tr><tr> <td>expand-directory</td> <td>directory where ears should be expanded</td> <td>value of <var>path</var></td></tr><tr> <td>expand-prefix</td> <td>automatic prefix of the expanded directory</td> <td>_ear_</td></tr><tr> <td>expand-suffix</td> <td>automatic suffix of the expanded directory</td> <td></td></tr><tr> <td>lazy-init</td> <td>if true, the ear file is only started on first access</td> <td>false</td></tr><tr> <td>path</td> <td>The path to the deploy directory</td> <td>required</td></tr><tr> <td>redeploy-mode</td> <td>"automatic" or "manual". If automatic, detects new .ear filesautomatically and deploys them.</td> <td>automatic</td></tr><tr> <td>url-prefix</td> <td>optional URL prefix to group deployed .ear files</td> <td></td></tr></deftable><def title="<ear-deploy> schema">element ear-deploy { path & archive-directory? & ear-default? & expand-cleanup-fileset? & expand-directory? & expand-path? & expand-prefix? & expand-suffix? & lazy-init? & redeploy-mode? & require-file* & url-prefix?}</def></defun><defun title="<error-page>" version="Servlet 2.2"><parents>web-app</parents><deftable-childtags><tr> <th>Attribute</th> <th>Description</th></tr><tr> <td>error-code</td> <td>Select the error page based on an HTTP status code</td></tr><tr> <td>exception-type</td> <td>Select the error page based on a Java exception</td></tr><tr> <td>location</td> <td>The error page to display</td></tr></deftable-childtags><deftable title="Request attributes for error handling"><tr> <th>Attribute</th> <th>Type</th></tr><tr> <td>javax.servlet.error.status_code</td> <td>java.lang.Integer</td></tr><tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -