All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.portlet.annotations.RenderStateScoped Maven / Gradle / Ivy

Go to download

The Java Portlet API version 3.0 developed by the Java Community Process JSR-362 Expert Group.

There is a newer version: 3.0.1
Show newest version
/*  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */

/*
 * This source code implements specifications defined by the Java
 * Community Process. In order to remain compliant with the specification
 * DO NOT add / change / or delete method signatures!
 */

package javax.portlet.annotations;


import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.enterprise.context.NormalScope;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;


/**
 * 
* Provides a CDI custom scope that is scoped to the render state. * The purpose of this scope is to allow portlet render parameters to be handled like * beans. *

* If an {@literal @}RenderStateScoped bean is injected into a class containing * an {@literal @}EventMethod or an {@literal @}ActionMethod, * the bean is associated with the corresponding portlet. * The bean state is stored as a render parameter of the that portlet. *

* A bean annotated with this scope must implement the {@link PortletSerializable} * interface, * which provides methods used by the portlet bean container to synchronize the bean * according to the render state. *

* An {@literal @}RenderStateScoped bean is similar to an * {@literal @}RequestScoped bean in that a new instance is created at the * beginning of each request. * However, for {@literal @}PortletStateScopedScoped beans, the portlet bean * container calls the * {@link PortletSerializable#deserialize(String[]) PortletSerializable#deserialize} * method at the beginning of each request to initialize the bean and the * {@link PortletSerializable#serialize() PortletSerializable#serialize} method * at the end of an action request or event request to obtain the serialized bean data. *

* A {@literal @}RenderStateScoped bean must be a valid bean and * must provide a default constructor. *

* Note that only changes made to the bean state during ActionMethod * or EventMethod execution are stored in the render state. * Changes made during RenderMethod, ServeResourceMethod, * or HeaderMethod execution will not be available during subsequent requests. *

* * @see PortletSerializable */ @Retention(RUNTIME) @Target({TYPE}) @NormalScope() @Inherited public @interface RenderStateScoped { /** * The name of the render parameter under which the bean state is to be stored. *

* If the name is not specified through the annotation, the portlet container * will assign a render parameter name. *

* If this element is a public render parameter identifier as declared in the * portlet application configuration, * the render parameter represented by the annotated class will be treated as * a public render parameter. * * @return The parameter name */ String paramName() default ""; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy