关于Tapestry5中的配置项的说明

商和颂
2023-12-01

Configuration Symbols-配置标识

Tapestry may also be configured via symbols. A certain number of built-in services (some of which are not even public) are configured via symbols. These symbols can be overridden by contributing to the ApplicationDefaults service configuration, or by placing a <context-param> element into the application's web.xml, or on the command line by defining JVM System Properties with the -D command line option.

大概意思:Tapestry可以经由symbols来配置,通过在service,或者在web.xml中用<context-param>配置,或者在JVM系统属性中的命令行选项来配置。

These symbols are always defined in terms of strings, that are coerced to the appropriate type (a number, a boolean, etc.). Of special note are time intervals, which are specified in a particular format.

大概意思:这些标识总是以字符串的形式定义,必须使用适当的类型,特别注意的是时间间隔的指定,要用 particular format.

备注:就是说指定符号的值的时候需要使用字符串,例如需要指定tapestry.production-mode,这个标识的值要求是一个boolean类型的值,但是我们必须用字符串形式的true or false来表示。

Many of these symbols have an associated constant in the class SymbolConstants.

很多符号常量已经在SymbolConstants中定义了。

备注:指定的时候可以使用SymbolConstants来指定,避免字符串输入错误(哈哈,我喜欢这种有常量可以使用的方式)

tapestry.app-catalog
The location of the global application message catalog, the default is context:WEB-INF/ app-name.properties.
大概意思:全局消息文件名,默认是WEB-INF/app-name.properties文件。
备注:我们如果不指定这个配置,消息文件名就是filter中配置的filter名+“.properties”
tapestry.application-version
The version of the application, which is incorporated into URLs for context and classpath assets. Assets may be compressed, and will have far-future expiration headers; they will be aggresively cached by the client web browser. You should change the application version on each new deployment of the application (that is, any time assets in the context change), to force clients to re-download changed versions of files. If you do not specify an application version, a random one will be assigned on every deployment (which is good for development but very bad for production).
大概意思:太长了,认不得了,呵呵,希望哪位大侠指点。
备注:我理解的意思就是可以指定web应用的版本,使用这个版本,tapestry会将这个版本信息放入URLS中,来要求客户端使用新的应用。
tapestry.charset
The character encoding used when generating output (or parsing input). The default is "UTF-8".
大概意思:应用的编码,默认是"UTF-8".
备注:这个我肯定是对的,哇哈哈。
tapestry.combine-scripts
If "true", then all JavaScript libraries required for a particular page render will be combined into a single request (the contents of the libraries are dynamically combined by Tapestry). Defaults to "true" in production mode.
大概意思:没搞懂
备注:我的理解是如果设置成true,所有的js库文件都会被tapestry应用到每一个页面中。
tapestry.compress-whitespace
A flag (true or false). When true (the default) whitespace in component templates is compressed by default (this can be fine-tuned using the standard xml:space attribute on an element in the template). When this flag is false, then whitespace is retained by default (but can still be overridden).
大概意思:空格是否原样输出的一个配置,如果设置为true,则编辑状态下的tml文件中的空格都会被压缩,就是多个变成一个,同样可以在tml文件用用xml:space属性进行单独的指定某一个元素。
tapestry.default-cookie-max-age
The default time interval that cookies created by Tapestry will be kept in the client web browser. The dfault value is equal to one week.

Primarily, this is used with a cookie that exists to track the preferred user locale.

The default is "7 d" (that is, seven days).

大概意思:cookie的有效期,默认为7天。

tapestry.default-stylesheet
The default stylesheet automatically injected into every rendered HTML page. Many Tapestry components assume that this stylesheet is available. All the classes defined in the stylesheet are prefixed with "t-". The exact contents of the stylesheet are subject to change at any time (they are considered internal), so replacing the stylesheet, rather than overriding selected rules within it, entails some risk.

The default is org/apache/tapestry5/default.css, stored on the classpath.

大概意思:太多了。

备注:我的理解是classpath下的以t开头的classes文件都会被当成默认的。

tapestry.exception-report-page
The name of the page used to report exceptions. This defaults to "ExceptionReport".
大概意思:异常报告页,默认是"ExceptionReport".
tapestry.file-check-interval
Time interval between file system checks. During a file system check, only a single thread is active (all others are blocked) and any files loaded are checked for changes (this is part of automatic component reloading).

The default is "1 s" (one second), and is usually overridden with a higher value in production (say, between one and five minutes).

大概意思:tapestry貌似可以自动重新载入组件文件,这样如果我们修改组件文件就可以直接覆盖而不用重启服务器。默认是1秒

tapestry.file-check-update-timeout
Time interval that Tapestry will wait to obtain the exclusive lock needed for a file check. The default is "50 ms" (50 milliseconds).

If the exclusive lock can't be obtained in that amount of time, the request will proceeed normally (without the check), but each successive request will attempt to get the lock and perform the check until successful.

大概意思:检查文件是否有更新的超时时间。应该用不到吧!

tapestry.force-absolute-uris
A flag (true or false). When false (the default), Tapestry will attempt to optimize URIs that it generates, using relative URIs when such URIs are shorter than absolute URIs. You will see some savings when you make generous use of libraries, sub-folders and page activation contexts ... otherwise, no significant difference.

When true, all URIs will be absolute URIs (including the context path, and the complete path for the request).

大概意思:没看懂。

tapestry.gzip-compression-enabled
Override to "false" to disable GZIP compression of dynamic Tapestry pages and static assets.
tapestry.min-gzip-size
The minimum stream size necessary for Tapestry to use GZIP compression on the response stream.
tapestry.omit-generator-meta
If "true", then the <meta> tag that Tapestry normally writes into the <head>, identifying the Tapestry version, will be omitted. Use this when you do not wish to advertise your application's use of Tapestry.
tapestry.production-mode
A flag (true or false) indicating whether the application is running in production or in development. The default is true, which means that runtime exceptions are not reported with full detail (only the root exception message is displayed, not the entire stack of exceptions, properties and other information shown in development mode).
大概意思:设置是否是生产模式,开发阶段可以设置成false,这样可以查看到比较详细的错误提示。
tapestry.page-pool.active-window
The time interval that an instantiated page instance may be cached before being removed. As pages are returned to the pool, they are time stamped. Periodically (as per the file check interval), the pool is scanned for page instances that have not been used recently; those that are outside the active window are discarded. This is used to free up unnecessary page instances after a request surge.

The default is "10 m" (10 minutes).

tapestry.page-pool.hard-limit
The absolute maximum number of page instances (for a particular page name / locale combination) that Tapestry will create at any time. If this number is reached, then requests will fail because a page instance is not available ... this can happen as part of a denial of service attack. For this value to have any meaning, it should be lower than the number of threads that the servlet container is configured to use when processing requests.

The default is 20 page instances.

tapestry.page-pool.soft-limit
The number of pages in the page pool (for a given page name / locale combination) before which Tapestry will start to wait for existing pages to be made available. Under this limit of pages, Tapestry will simply create a new page instance if no existing instance is readily available. Once the soft limit is reached, Tapestry will wait a short period of time (the soft wait interval) to see if an existing page instance is made available. It will then create a new page instance (unless the hard limit has been reached).

The default is 5 page instances. Remember that page pooling is done separately for each page (and localization of the page).

tapestry.page-pool.soft-wait
The time interval that Tapestry will wait for a page instance to become available before deciding whether to create an entirely new page instance. The default is "10 ms".
tapestry.secure-enabled
If true, then @Secure annotation is honored; if false, no security checks or redirects take place. This defaults to tapestry.production-mode, meaning that in development mode it will (by default) be disabled.
tapestry.secure-page
If true, then the page may only be accessed via HTTPS. The @Secure annotation will set this value to true. This symbol is the default for all pages; set it to "true" to force the entire application to be secure.
tapestry.scriptaculous
The path to the embedded copy of script.aculo.us packaged with Tapestry. This value may be overridden to use a different version of the script.aculo.us library. Tapestry's default version is 1.8.1 (including Prototype 1.6.0.1).
tapestry.start-page-name
The logical name of the start page, the page that is rendered for the root URL. This is normally "start". This functionality is vestigal: it has been superceded by the use of Index pages.
大概意思:设定应用的默认页,默认的是“start”,我们可以修改成我们习惯的index。
tapestry.supported-locales
A comma-separated list of supported locales. Incoming requests as "narrowed" to one of these locales, based on closest match. If no match can be found, the first locale in the list is treated as the default.

The default is (currently) "en,it,es,zh_CN,pt_PT,de,ru,hr,fi_FI,sv_SE,fr_FR,da,pt_BR,ja,el". As the community contributes new localizations of the necessary messages files, this list will expand. Note that the Tapestry quickstart archetype overrides the factory default, forcing the application to be localized only for "en".

tapestry.suppress-redirect-from-action-requests
Normally, Tapestry responds to action requests (such as form submissions) by sending a client-side redirect to the renderring page. This has a lot of benefits in terms of improving browser navigation, making sure URLs are bookmarkable, and so forth. However, it has a cost: more data stored persistently in the session, and a double-request for each user action (one action request, one render request).

Setting this symbol to "true" changes the Tapestry behavior to make it more like Tapestry 4: a markup response is sent directly for the action request, no redirect in the middle. This option should be used with care, and only in cases where you are certain that the benefits outweigh the disadvantages.

下班了,还有一些没有看懂的,希望热心人士可以帮忙解释一下。

你的举手之劳将成就我学习的愿望,先万分感谢了。

转载于:https://my.oschina.net/namespace/blog/8120

 类似资料: