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. 012 013package org.apache.tapestry5.internal; 014 015import org.apache.tapestry5.annotations.PublishEvent; 016import org.apache.tapestry5.commons.util.CommonsUtils; 017import org.apache.tapestry5.commons.util.TimeInterval; 018import org.apache.tapestry5.dom.MarkupModel; 019import org.apache.tapestry5.http.ContentType; 020import org.apache.tapestry5.http.TapestryHttpConstants; 021import org.apache.tapestry5.http.internal.TapestryHttpInternalConstants; 022import org.apache.tapestry5.model.ComponentModel; 023import org.apache.tapestry5.services.javascript.JavaScriptStack; 024 025public final class InternalConstants 026{ 027 /** 028 * Init parameter used to identify the package from which application classes are loaded. Such 029 * classes are in the 030 * pages, components and mixins sub-packages. 031 * @deprecated Use {@link TapestryHttpInternalConstants#TAPESTRY_APP_PACKAGE_PARAM} instead 032 */ 033 public static final String TAPESTRY_APP_PACKAGE_PARAM = TapestryHttpInternalConstants.TAPESTRY_APP_PACKAGE_PARAM; 034 035 /** 036 * Turns off loading of default modules (as driven by JAR file Manifest entries). 037 * @deprecated Use {@link TapestryHttpInternalConstants#DISABLE_DEFAULT_MODULES_PARAM} instead 038 */ 039 public static final String DISABLE_DEFAULT_MODULES_PARAM = TapestryHttpInternalConstants.DISABLE_DEFAULT_MODULES_PARAM; 040 041 /** 042 * The name of the query parameter that stores the page activation context inside an action 043 * request. 044 */ 045 public static final String PAGE_CONTEXT_NAME = "t:ac"; 046 047 /** 048 * Name of event triggered by Grid sub-components when an in-place Grid is updated. 049 */ 050 public static final String GRID_INPLACE_UPDATE = "inplaceupdate"; 051 052 /** 053 * The name of a query parameter that stores the containing page (used in action links when the 054 * page containing the 055 * component is not the same as the page that was rendering). The active page (the page which 056 * initiated the render) 057 * is encoded into the URL, and the containing page is tacked on as this query parameter. 058 */ 059 public static final String CONTAINER_PAGE_NAME = "t:cp"; 060 061 public static final String MIXINS_SUBPACKAGE = "mixins"; 062 063 public static final String COMPONENTS_SUBPACKAGE = "components"; 064 065 public static final String PAGES_SUBPACKAGE = "pages"; 066 067 public static final String BASE_SUBPACKAGE = "base"; 068 069 /** 070 * Used in some Ajax scenarios to set the content type for the response early, when the Page 071 * instance (the authority 072 * on content types) is known. The value is of type {@link org.apache.tapestry5.http.ContentType}. 073 */ 074 public static final String CONTENT_TYPE_ATTRIBUTE_NAME = "content-type"; 075 076 /** 077 * @deprecated Use {@link TapestryHttpInternalConstants#CHARSET_CONTENT_TYPE_PARAMETER} instead 078 */ 079 public static final String CHARSET_CONTENT_TYPE_PARAMETER = TapestryHttpInternalConstants.CHARSET_CONTENT_TYPE_PARAMETER; 080 081 /** 082 * As above but to store the name of the page. Necessary for determining the correct 083 * {@link MarkupModel} for the response. 084 */ 085 public static final String PAGE_NAME_ATTRIBUTE_NAME = "page-name"; 086 087 /** 088 * Required MIME type for JSON responses. If this MIME type is not used, the client-side 089 * Prototype code will not 090 * recognize the response as JSON, and the Ajax.Response.responseJSON property will be null. 091 */ 092 public static final String JSON_MIME_TYPE = "application/json"; 093 094 /** 095 * Request attribute key; if non-null, then automatic GZIP compression of response stream is 096 * suppressed. This is 097 * useful when the code opening the response stream wants to explicitly control whether GZIP 098 * compression occurs or 099 * not. Alias to {@link TapestryHttpConstants#SUPPRESS_COMPRESSION}. 100 * 101 * @since 5.1.0.0 102 */ 103 public static final String SUPPRESS_COMPRESSION = TapestryHttpConstants.SUPPRESS_COMPRESSION; 104 105 /** 106 * Name of response header for content encoding. 107 * 108 * @since 5.1.0.0 109 * @deprecated Use {@link TapestryHttpInternalConstants#CONTENT_ENCODING_HEADER} instead 110 */ 111 public static final String CONTENT_ENCODING_HEADER = TapestryHttpInternalConstants.CONTENT_ENCODING_HEADER; 112 113 /** 114 * Response content encoding value indicating use of GZIP compression. 115 * 116 * @since 5.1.0.0 117 * @deprecated Use {@link TapestryHttpInternalConstants#GZIP_CONTENT_ENCODING} instead 118 */ 119 public static final String GZIP_CONTENT_ENCODING = TapestryHttpInternalConstants.GZIP_CONTENT_ENCODING; 120 121 /** 122 * Identifies the start of an expansion inside a template. 123 */ 124 public static final String EXPANSION_START = "${"; 125 126 /** 127 * Special prefix for parameters that are inherited from named parameters of their container. 128 */ 129 public static final String INHERIT_BINDING_PREFIX = "inherit:"; 130 131 public static final long TEN_YEARS = new TimeInterval("10y").milliseconds(); 132 133 /** 134 * @deprecated Use {@link CommonsUtils#EMPTY_STRING_ARRAY} instead 135 */ 136 public static final String[] EMPTY_STRING_ARRAY = CommonsUtils.EMPTY_STRING_ARRAY; 137 138 /** 139 * Name of the core {@link JavaScriptStack}, which supplies the basic JavaScript infrastructure 140 * on the client. 141 * 142 * @since 5.2.0 143 */ 144 public static final String CORE_STACK_NAME = "core"; 145 146 /** 147 * Virtual folder name for the core library. The core library is special as any component not present in another 148 * library (including the application library) is searched for inside core. 149 * 150 * @since 5.3 151 */ 152 public static final String CORE_LIBRARY = "core"; 153 154 /** 155 * The names of the standard controlled subpackages. 156 * 157 * @since 5.3 158 */ 159 public static final String[] SUBPACKAGES = 160 {PAGES_SUBPACKAGE, COMPONENTS_SUBPACKAGE, MIXINS_SUBPACKAGE, BASE_SUBPACKAGE}; 161 162 /** 163 * The element name for a submit input element used to cancel the form (rather than 164 * submit it normally). 165 * 166 * @since 5.3 167 */ 168 public static final String CANCEL_NAME = "cancel"; 169 170 /** 171 * Request attribute that can be set to bypass page activation. 172 * 173 * @see org.apache.tapestry5.internal.services.StreamPageContentResultProcessor 174 * @see org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl 175 * @since 5.4 176 */ 177 public static final String BYPASS_ACTIVATION = "tapestry.bypass-page-activation"; 178 179 /** 180 * Key inside the response that contains the partial page render keys that are used 181 * to update the client. 182 * 183 * @since 5.4 184 */ 185 public static final String PARTIAL_KEY = "_tapestry"; 186 187 /** 188 * Request attribute, set to true once the active page (as identified in the incoming 189 * component event or page render request) has been successfully loaded. This is very important 190 * to the {@link org.apache.tapestry5.corelib.pages.ExceptionReport} page, which can possibly 191 * fail (resulting in a servlet container 500 response) if the page can't be loaded (because 192 * if the page can't be loaded, then a link to the page can't be created). 193 * 194 * @since 5.4 195 */ 196 public static final String ACTIVE_PAGE_LOADED = "tapestry.active-page-loaded"; 197 198 /** 199 * Used to suppress the stylesheets from the 'core' stack; this is used on certain pages 200 * that want to work around application-specific overrides to the core stack stylesheets. 201 * 202 * @since 5.4 203 */ 204 public static final String SUPPRESS_CORE_STYLESHEETS = "tapestry.suppress-core-stylesheets"; 205 206 /** 207 * A bit of a hack that allows, in production mode, for a component event request to "unwind" when 208 * the component referenced in the URL does not exist. This is related to TAP5-1481. This situation 209 * can most likely occur when a web spider, such as Google, uses an old component event URI from 210 * a prior deployment, which no longer works in a new deployment, due to structural changes. Since 211 * changing the APIs that significantly is forbidden, a non-null value is added as an 212 * {@link org.apache.tapestry5.http.services.Request} attribute. 213 * 214 * @since 5.4 215 */ 216 public static final String REFERENCED_COMPONENT_NOT_FOUND = "tapestry.referenced-component-not-found"; 217 218 /** 219 * Name of request parameter that suppresses the logic that injects a random-ish namespace into allocated ids when rending partial page 220 * responses. This, of course, requires a lot of testing to ensure that there are no resulting name clashes, 221 * and should not be used inside Zones containing an {@link org.apache.tapestry5.corelib.components.AjaxFormLoop}. 222 * 223 * @since 5.4 224 */ 225 public static final String SUPPRESS_NAMESPACED_IDS = "t:suppress-namespaced-ids"; 226 227 /** 228 * @since 5.4 229 */ 230 public static final ContentType JAVASCRIPT_CONTENT_TYPE = new ContentType("text/javascript"); 231 232 /** 233 * Name of the {@linkplain ComponentModel} metadata key whiche stores the {@linkplain PublishEvent} 234 * data. 235 * @since 5.4.2 236 */ 237 public static final String PUBLISH_COMPONENT_EVENTS_META = "meta.publish-component-events"; 238 239 /** 240 * Name of the JSONObject key name which holds the name of the event to be published. 241 * 242 * @since 5.4.2 243 */ 244 public static final String PUBLISH_COMPONENT_EVENTS_URL_PROPERTY = "url"; 245 246}