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

javax.portlet.annotations.package-info 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.
 */

/**
 * 
 * The javax.portlet.annotations package provides the annotations used 
 * for portlet configuration and portlet-specific dependency injection.
 * 
 * 

Overview

*

* The annotation-oriented API provides new capabilities in several areas. *

*
    *
  • * It allows portlet configuration declarations to be performed through use of * annotations. * The goal is to reduce or remove the need to write a portlet deployment descriptor * in most instances. *

    * The developer can choose between providing configuration data through annotations or * through the portlet deployment descriptor. * If the same type of information is provided through both annotations and the deployment * descriptor, the information from the deployment descriptor has precedence. *

  • *
  • * It allows portlet lifecycle methods to be identified through use of annotations. *

    * The possible portlet method annotations are: * {@link javax.portlet.annotations.InitMethod}, * {@link javax.portlet.annotations.DestroyMethod}, * {@link javax.portlet.annotations.ActionMethod}, * {@link javax.portlet.annotations.EventMethod}, * {@link javax.portlet.annotations.HeaderMethod}, * {@link javax.portlet.annotations.RenderMethod}, or * {@link javax.portlet.annotations.ServeResourceMethod}. *

    * Annotated portlet lifecycle methods can be contained in any valid CDI bean class. * The class needs not implement any portlet-specific interface or extend a portlet class. * However, each bean portlet method has method signature requirements that * must be fulfilled. * Please see the annotation descriptions. *

  • *
  • * It provides new custom scopes for portlet artifacts. *
      *
    • * Using the scope annotation * {@link javax.portlet.annotations.PortletSessionScoped} * associates the bean lifecycle with the portlet session. *
    • *
    • * Using the scope annotation * {@link javax.portlet.annotations.PortletRequestScoped} * associates the bean lifecycle with the portlet request. *
    • *
    • * Using the scope annotation * {@link javax.portlet.annotations.RenderStateScoped} * associates the bean lifecycle with the render state, which conceptually is stored * on the URL. * If you use RenderStateScoped beans, your bean state will be automatically stored as * render parameters for the portlet setting the state. *
    • *
    *
  • *
  • * It allows portlet artifacts such as portlet request filters, URL generation listeners, * and preference validators to be identified through annotations. *

    * Please see the following annotation descriptions: * {@link javax.portlet.annotations.PortletLifecycleFilter}, * {@link javax.portlet.annotations.PortletListener}, and * {@link javax.portlet.annotations.PortletPreferencesValidator}. *

*

Injectable Portlet Artifacts

*

* Note: * Most of these beans are dependent on the portlet request being executed, but * some of them could not themselves * be declared as {@literal @}PortletRequestScoped due to technical limitations. * These beans should be used within enclosing beans that are either * {@literal @}RenderStateScoped or {@literal @}PortletRequestScoped to allow * the portlet container to properly manage the lifecycle of the injected object. * The required enclosing bean scope is noted in the table. *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
nameDescriptionEnclosing Bean ScopeAnnotation Example
portletConfig * The PortletConfig object. * Any *
* {@literal @}Inject
* private PortletConfig portletConfig; *
*
portletRequestThe PortletRequest object.Any *
* {@literal @}Inject
* private PortletRequest request; *
*
portletResponseThe PortletResponse object.Any *
* {@literal @}Inject
* private PortletResponse request; *
*
actionRequestThe ActionRequest object.Any *
* {@literal @}Inject
* private ActionRequest request; *
*
actionResponseThe ActionResponse object.Any *
* {@literal @}Inject
* private ActionResponse request; *
*
headerRequestThe HeaderRequest object.Any *
* {@literal @}Inject
* private HeaderRequest request; *
*
headerResponseThe HeaderResponse object.Any *
* {@literal @}Inject
* private HeaderResponse request; *
*
renderRequestThe RenderRequest object.Any *
* {@literal @}Inject
* private RenderRequest request; *
*
renderResponseThe RenderResponse object.Any *
* {@literal @}Inject
* private RenderResponse request; *
*
eventRequestThe EventRequest object.Any *
* {@literal @}Inject
* private EventRequest request; *
*
eventResponseThe EventResponse object.Any *
* {@literal @}Inject
* private EventResponse request; *
*
resourceRequestThe ResourceRequest object.Any *
* {@literal @}Inject
* private ResourceRequest request; *
*
resourceResponseThe ResourceResponse object.Any *
* {@literal @}Inject
* private ResourceResponse request; *
*
clientDataRequestThe ClientDataRequest object.Any *
* {@literal @}Inject
* private ClientDataRequest request; *
*
mimeResponseThe MimeResponse object.Any *
* {@literal @}Inject
* private MimeResponse request; *
*
stateAwareResponseThe StateAwareResponse object.Any *
* {@literal @}Inject
* private StateAwareResponse request; *
*
renderParamsThe RenderParameters object.Any *
* {@literal @}Inject
* private RenderParameters renderParams; *
*
mutableRenderParamsThe MutableRenderParameters object.Any *
* {@literal @}Inject
* private MutableRenderParameters mutableRenderParams; *
*
actionParamsThe ActionParameters object.Any *
* {@literal @}Inject
* private ActionParameters actionParams; *
*
resourceParamsThe ResourceParameters object.Any *
* {@literal @}Inject
* private ResourceParameters resourceParams; *
*
portletContextThe PortletContext object.Any *
* {@literal @}Inject
* private PortletContext portletContext; *
*
portletPreferencesThe PortletPreferences object.Any *
* {@literal @}Inject
* private PortletPreferences preferences; *
*
portletSessionThe PortletSession object.Any *
* {@literal @}Inject
* private PortletSession session; *
*
portletModeThe PortletMode object. * * Any * *
* {@literal @}Inject
* private PortletMode mode; *
*
windowStateThe WindowState object. * * Any * *
* {@literal @}Inject
* private WindowState windowState; *
*
cookiesAn list of Cookie objects set for the portlet. * See {@link javax.portlet.PortletRequest#getCookies() getCookies}. * * Any * *
* {@literal @}Inject
* private List{@literal <}Cookie> cookies; *
*
localesAn list of supported Locales for the portlet. * See {@link javax.portlet.PortletRequest#getLocales() getLocales}. * * Any * *
* {@literal @}Inject
* private List{@literal <}Locale> locales; *
*
namespaceA String representing the unique name space for the * portlet window. * See {@link javax.portlet.PortletResponse#getNamespace() getNamespace}. * * {@literal @}PortletRequestScoped * or * {@literal @}RenderStateScoped * *
* {@literal @}Inject
* private String namespace; *
*
contextPathA String representing the context path for the * portlet application. * See {@link javax.portlet.PortletRequest#getContextPath() getContextPath}. * * {@literal @}PortletRequestScoped * or * {@literal @}RenderStateScoped * *
* {@literal @}Inject
* private String contextPath; *
*
windowIdA String representing the unique window ID for the * portlet window. * See {@link javax.portlet.PortletRequest#getWindowID() getWindowID}. * * {@literal @}PortletRequestScoped * or * {@literal @}RenderStateScoped * *
* {@literal @}Inject
* private String windowId; *
*
portletNameA String representing the portlet name. * See {@link javax.portlet.PortletConfig#getPortletName() getportletName}. * * {@literal @}PortletRequestScoped * or * {@literal @}RenderStateScoped * *
* {@literal @}Inject
* private String portletName; *
*
*

Using the {@literal @}RenderStateScoped Annotation

*

* The {@literal @}RenderStateScoped Annotation allows portlet render parameters * to be treated as beans. * The bean state is stored as a portlet render parameter. * The annotation documentation for * {@link javax.portlet.annotations.RenderStateScoped RenderStateScoped} * describes the necessary prerequisites. *

*

* The paramName element in the annotation can be used to provide a * parameter name for storing the bean. * This element can also be left empty, in which case the portlet container will * generate a parameter name. *

*

* When resource URLs are generated, {@literal @}RenderStateScoped beans valid for the * current request are automatically stored on the URL as render parameters. * When creating render or action URLs, {@literal @}RenderStateScoped beans can be * automatically stored on the URL with the state valid for the current request by * using the appropriate option with the MimeResponse * {@link javax.portlet.MimeResponse#createActionURL createActionURL} and * {@link javax.portlet.MimeResponse#createRenderURL createRenderURL} * methods. *

*

* However, you might want to set a modified {@literal @}RenderStateScoped bean value * on your URL. * You can do this using the PortletURL interface * {@link javax.portlet.PortletURL#setBeanParameter setBeanParameter} * method. * You can create a new bean, set the fields as desired, and use the * {@link javax.portlet.PortletURL#setBeanParameter setBeanParameter} * method to set the new bean on the URL. *

*

* Tip: * It might be useful to provide your {@literal @}RenderStateScoped * bean with a copy constructor in addition to the required default constructor. * You could then create a new {@literal @}RenderStateScoped bean based on the * current state of the injected bean and then update the fields on the new bean as required. *

*/ package javax.portlet.annotations;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy