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.annotations; 014 015import org.apache.tapestry5.ioc.annotations.UseWith; 016 017import java.lang.annotation.Documented; 018import java.lang.annotation.Retention; 019import java.lang.annotation.Target; 020 021import static java.lang.annotation.ElementType.METHOD; 022import static java.lang.annotation.RetentionPolicy.RUNTIME; 023import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.*; 024 025/** 026 * Method annotation used for methods that should be invoked when the page is first attached to a request. This is 027 * useful for initializations that should occur on each request that involves the page. Often, such initializations will 028 * be balanced by cleanups when the page is detached. 029 * 030 * PageAttached methods should take no parameters and return void. They must either have this annotation, or be named 031 * "pageAttached". 032 * 033 * To be clear: methods with this annotation (or name) are still invoked even in Tapestry 5.2, which does away with 034 * the page pool. 035 * 036 * @see PageDetached 037 */ 038@Target(METHOD) 039@Retention(RUNTIME) 040@Documented 041@UseWith({COMPONENT, MIXIN, PAGE}) 042public @interface PageAttached 043{ 044 045}