001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012package org.apache.tapestry5.http;
013
014/**
015 * Class defining constants for Tapestry HTTP symbols.
016 */
017final public class TapestryHttpSymbolConstants {
018
019    /**
020     * The hostname that application should use when constructing an absolute URL. The default is "", i.e. an empty
021     * string,
022     * in which case system will use request.getServerName(). Not the same as environment variable HOSTNAME, but you can
023     * also
024     * contribute "$HOSTNAME" as the value to make it the same as the environment variable HOSTNAME.
025     *
026     * @since 5.3
027     */
028    public static final String HOSTNAME = "tapestry.hostname";
029    /**
030     * The hostport that application should use when constructing an absolute URL. The default is "0", i.e. use the port
031     * value from
032     * the request.
033     *
034     * @since 5.3
035     */
036    public static final String HOSTPORT = "tapestry.hostport";
037    /**
038     * The secure (https) hostport that application should use when constructing an absolute URL. The default is "0",
039     * i.e. use
040     * the value from the request.
041     * This is an alias to {@link TapestryHttpSymbolConstants#HOSTPORT_SECURE}.
042     *
043     * @since 5.3
044     */
045    public static final String HOSTPORT_SECURE = "tapestry.hostport-secure";
046    /**
047     * If "true" then at the end of each request the
048     * {@link org.apache.tapestry5.http.services.SessionPersistedObjectAnalyzer} will be called on each session persisted
049     * object that was accessed during the request.
050     *
051     * This is provided as a performance enhancement for servers that do not use clustered sessions.
052     *
053     * The default is {@code true}, to preserve 5.2 behavior. For non-clustered applications (the majority), this value should be
054     * overridden to {@code false}. A future release of Tapestry may change the default.
055     *
056     * @since 5.3
057     */
058    public static final String CLUSTERED_SESSIONS = "tapestry.clustered-sessions";
059    /**
060     * If true (the default), then Tapestry will apply locking semantics around access to the {@link javax.servlet.http.HttpSession}.
061     * Reading attribute names occurs with a shared read lock; getting or setting an attribute upgrades to an exclusive write lock.
062     * This can tend to serialize threads when a number of simultaneous (Ajax) requests from the client arrive ... however,
063     * many implementations of HttpSession are not thread safe, and often mutable objects are stored in the session and shared
064     * between threads. Leaving this on the default will yield a more robust application; setting it to false may speed
065     * up processing for more Ajax intensive applications (but care should then be given to ensuring that objects shared inside
066     * the session are themselves immutable or thread-safe).
067     *
068     * @since 5.4
069     */
070    public static final String SESSION_LOCKING_ENABLED = "tapestry.session-locking-enabled";
071    /**
072     * Version number of the application. Prior to 5.4, this version number was integrated into asset URLs. Starting
073     * with 5.4, a checksum of the individual asset's content is used instead, and this version number is only used
074     * for documentation purposes; it appears in the default exception report page, for example.
075     *
076     * The default value is "0.0.1".  In 5.3 and earlier, the default value was a random hexadecimal string.
077     *
078     * @since 5.1.0.0
079     */
080    public static final String APPLICATION_VERSION = "tapestry.application-version";
081    
082    /**
083     * Indicates whether Tapestry is running in production mode or developer mode. This affects a large
084     * number of Tapestry behaviors related to performance and security, including how exceptions are
085     * reported, whether far-future expire headers are emitted, whether JavaScript files may be combined,
086     * whether JSON is compressed, whether component field and parameter values are shadowed to instance
087     * variables (to assist with debugging), and more.
088     */
089    public static final String PRODUCTION_MODE = "tapestry.production-mode";
090    
091    /**
092     * The version number of the core Tapestry framework, or UNKNOWN if the version number is not available (which
093     * should only occur when developing Tapestry).
094     */
095    public static final String TAPESTRY_VERSION = "tapestry.version";
096    
097    /**
098     * Identifies the context path of the application, as determined from {@link javax.servlet.ServletContext#getContextPath()}.
099     * This is either a blank string or a string that starts with a slash but does not end with one.
100     *
101     * @since 5.4
102     */
103    public static final String CONTEXT_PATH = "tapestry.context-path";
104    /**
105     * A comma separated list of execution modes used to control how the application is initialized.
106     * Each modes can contribute a list (comma separated) of Module classes to be loaded during startup,
107     * the order in which they appear is preserved.
108     * The default value is: <code>production</code>.
109     */
110    public static final String EXECUTION_MODE = "tapestry.execution-mode";
111    /**
112     * The charset used when rendering page markup; the charset is also used as the request encoding when handling
113     * incoming requests. The default is "UTF-8".
114     */
115    public static final String CHARSET = "tapestry.charset";
116    /**
117     * Minimum output stream size, in bytes, before output is compressed using GZIP. Shorter streams are not compressed.
118     * Tapestry buffers this amount and switches to a GZIP output stream as needed. The default is "100".
119     *
120     * @see #GZIP_COMPRESSION_ENABLED
121     * @since 5.1.0.0
122     */
123    public static final String MIN_GZIP_SIZE = "tapestry.min-gzip-size";
124    /**
125     * If "true" (the default) then GZip compression is enabled for dynamic requests and for static assets. If you are
126     * using a server that handles GZip compression for you, or you don't want to use the extra processing power
127     * necessary to GZIP requests, then override this to "false".
128     *
129     * @see #MIN_GZIP_SIZE
130     * @see org.apache.tapestry5.http.services.ResponseCompressionAnalyzer
131     * @see org.apache.tapestry5.http.services.CompressionAnalyzer
132     * @since 5.1.0.0
133     */
134    public static final String GZIP_COMPRESSION_ENABLED = "tapestry.gzip-compression-enabled";
135
136}