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;
014
015import org.apache.tapestry5.annotations.PublishEvent;
016import org.apache.tapestry5.internal.structure.PageResetListener;
017import org.apache.tapestry5.services.ComponentEventLinkEncoder;
018
019/**
020 * Constants needed by end-user classes.
021 *
022 * @since 5.2.0
023 */
024public class TapestryConstants
025{
026
027    /**
028     * The extension used for Tapestry component template files, <em>T</em>apestry <em>M</em>arkup <em>L</em>anguage.
029     * Template files are well-formed XML files.
030     */
031    public static final String TEMPLATE_EXTENSION = "tml";
032
033    /**
034     * Name of query parameter that is placed on "loopback" links (page render links for the same
035     * page). This mostly includes the redirects sent after a component event request. Page render
036     * requests
037     * that do <em>not</em> have the LOOPBACK query parameter will trigger a {@linkplain PageResetListener reset
038     * notification} after the initialization event; the LOOPBACK prevents this reset notification.
039     *
040     * @see ComponentEventLinkEncoder#createPageRenderLink(org.apache.tapestry5.services.PageRenderRequestParameters)
041     * @see ComponentEventLinkEncoder#decodePageRenderRequest(org.apache.tapestry5.http.services.Request)
042     * @see PageResetListener
043     * @since 5.2.0
044     */
045    public static final String PAGE_LOOPBACK_PARAMETER_NAME = "t:lb";
046
047    /**
048     * Name of a request attribute that contains an {@link org.apache.tapestry5.ioc.IOOperation}
049     * used to render the response. The operation should return void.
050     *
051     * Implementations of {@link org.apache.tapestry5.services.ComponentEventResultProcessor}
052     * will store a response rendering operation into the request; the operation, if present,
053     * will be executed as the first filter inside the
054     * {@link org.apache.tapestry5.services.ComponentRequestHandler} pipeline.
055     *
056     * This approach is recommended for any "complex" rendering that involves components or pages.
057     * It is optional for other types.
058     *
059     * @since 5.4
060     */
061    public static final String RESPONSE_RENDERER = "tapestry.response-renderer";
062
063    /**
064     * Name of a {@link org.apache.tapestry5.http.services.Request} attribute, used
065     * to disable JavaScript minimization during asset requests.
066     *
067     * @see org.apache.tapestry5.services.javascript.JavaScriptStack#getJavaScriptAggregationStrategy()
068     * @since 5.4
069     */
070    public static final String DISABLE_JAVASCRIPT_MINIMIZATION = "tapestry.disable-javascript-minimization";
071
072    /**
073     * Name of the HTML data attribute which contains information about component events
074     * published by using the {@linkplain PublishEvent} annotation
075     * in a component event handler method.
076     * 
077     * @see PublishEvent
078     * @since 5.4.2
079     */
080    public static final String COMPONENT_EVENTS_ATTRIBUTE_NAME = "data-component-events";
081
082}