001    // Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    // http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry5.internal;
016    
017    import org.apache.tapestry5.ioc.util.TimeInterval;
018    import org.apache.tapestry5.services.javascript.JavaScriptStack;
019    
020    public final class InternalConstants
021    {
022        /**
023         * Init parameter used to identify the package from which application classes are loaded. Such
024         * classes are in the
025         * pages, components and mixins sub-packages.
026         */
027        public static final String TAPESTRY_APP_PACKAGE_PARAM = "tapestry.app-package";
028    
029        /**
030         * Turns off loading of default modules (as driven by JAR file Manifest entries).
031         */
032        public static final String DISABLE_DEFAULT_MODULES_PARAM = "tapestry.disable-default-modules";
033    
034        /**
035         * The name of the query parameter that stores the page activation context inside an action
036         * request.
037         */
038        public static final String PAGE_CONTEXT_NAME = "t:ac";
039    
040        /**
041         * Name of event triggered by Grid sub-components when an in-place Grid is updated.
042         */
043        public static final String GRID_INPLACE_UPDATE = "inplaceupdate";
044    
045        /**
046         * The name of a query parameter that stores the containing page (used in action links when the
047         * page containing the
048         * component is not the same as the page that was rendering). The active page (the page which
049         * initiated the render)
050         * is encoded into the URL, and the containing page is tacked on as this query parameter.
051         */
052        public static final String CONTAINER_PAGE_NAME = "t:cp";
053    
054        public static final String OBJECT_RENDER_DIV_SECTION = "t-env-data-section";
055    
056        public static final String MIXINS_SUBPACKAGE = "mixins";
057    
058        public static final String COMPONENTS_SUBPACKAGE = "components";
059    
060        public static final String PAGES_SUBPACKAGE = "pages";
061    
062        public static final String BASE_SUBPACKAGE = "base";
063    
064        /**
065         * Used in some Ajax scenarios to set the content type for the response early, when the Page
066         * instance (the authority
067         * on content types) is known. The value is of type {@link org.apache.tapestry5.ContentType}.
068         */
069        public static final String CONTENT_TYPE_ATTRIBUTE_NAME = "content-type";
070    
071        public static final String CHARSET_CONTENT_TYPE_PARAMETER = "charset";
072    
073        /**
074         * Request attribute that stores a {@link org.apache.tapestry5.internal.structure.Page} instance
075         * that will be
076         * rendered as the {@linkplain org.apache.tapestry5.SymbolConstants#SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS
077         * immediate
078         * mode response}.
079         */
080        public static final String IMMEDIATE_RESPONSE_PAGE_ATTRIBUTE = "tapestry.immediate-response-page";
081    
082        /**
083         * Required MIME type for JSON responses. If this MIME type is not used, the client-side
084         * Prototype code will not
085         * recognize the response as JSON, and the Ajax.Response.responseJSON property will be null.
086         */
087        public static final String JSON_MIME_TYPE = "application/json";
088    
089        /**
090         * Request attribute key; if non-null, then automatic GZIP compression of response stream is
091         * suppressed. This is
092         * useful when the code opening the response stream wants to explicitly control whether GZIP
093         * compression occurs or
094         * not.
095         *
096         * @since 5.1.0.0
097         */
098        public static final String SUPPRESS_COMPRESSION = "tapestry.supress-compression";
099    
100        /**
101         * Name of response header for content encoding.
102         *
103         * @since 5.1.0.0
104         */
105        public static final String CONTENT_ENCODING_HEADER = "Content-Encoding";
106    
107        /**
108         * Response content encoding value indicating use of GZIP compression.
109         *
110         * @since 5.1.0.0
111         */
112        public static final String GZIP_CONTENT_ENCODING = "gzip";
113    
114        /**
115         * Identifies the start of an expansion inside a template.
116         */
117        public static final String EXPANSION_START = "${";
118    
119        /**
120         * Special prefix for parameters that are inherited from named parameters of their container.
121         */
122        public static final String INHERIT_BINDING_PREFIX = "inherit:";
123    
124        public static final long TEN_YEARS = new TimeInterval("10y").milliseconds();
125    
126        public static final String[] EMPTY_STRING_ARRAY = new String[0];
127    
128        /**
129         * Name of the core {@link JavaScriptStack}, which supplies the basic JavaScript infrastructure
130         * on the client.
131         *
132         * @since 5.2.0
133         */
134        public static final String CORE_STACK_NAME = "core";
135    
136        /**
137         * Virtual folder name for the core library. The core library is special as any component not present in another
138         * library (including the application library) is searched for inside core.
139         *
140         * @since 5.3
141         */
142        public static final String CORE_LIBRARY = "core";
143    
144        /**
145         * The names of the standard controlled subpackages.
146         *
147         * @since 5.3
148         */
149        public static final String[] SUBPACKAGES =
150                {PAGES_SUBPACKAGE, COMPONENTS_SUBPACKAGE, MIXINS_SUBPACKAGE, BASE_SUBPACKAGE};
151    
152        /**
153         * The element name for a submit input element used to cancel the form (rather than
154         * submit it normally).
155         *
156         * @since 5.3
157         */
158        public static final String CANCEL_NAME = "cancel";
159    }