Annotation Type HeaderMethod
-
@Retention(RUNTIME) @Target(METHOD) public @interface HeaderMethod
Designates a method corresponding to the renderHeaders method of theHeaderPortletinterface. The annotated method must have one of the following signatures:-
public void <methodName>(HeaderRequest, HeaderResponse)This corresponds to the
renderHeadersmethod. -
public String <methodName>()The String returned by the method will be made available to the portal for inclusion in the document head section.
-
public void <methodName>()
The method declaration may contain a throws clause. Exceptions declared in the throws clause should be of type
PortletExceptionorIOException. Checked exceptions of any other type will be caught, wrapped with a PortletException, and rethrown.The header method can be used to set properties such as cookies, header values, and XML elements for the
HEADsection of the aggregated portal document.Valid
HEADsection markup written to theHeaderResponseoutput stream or writer will be added to the aggregated portal documentHEADsection subject to portlet container-imposed restrictions.- Since:
- 3.0
- See Also:
the add and set properties methods of PortletResponse,MimeResponse#MARKUP_HEAD_ELEMENT,HeaderPortlet
-
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description String[]portletNamesThe portlet names for which the header method applies.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description StringcontentTypeSets the content type, or the MIME type, of content generated by the method.StringincludeSpecifies a resource, such as a JSP, an HTML file, or a servlet to be included.intordinalThe ordinal number for this annotated method.StringportletModeThe portlet mode rendered by the annotated method.
-
-
-
Element Detail
-
portletNames
String[] portletNames
The portlet names for which the header method applies.The annotated method can apply to multiple portlets within the portlet application. The names of the portlets to which the resources apply must be specified in this field.
A wildcard character '*' can be specified in the first portletName array element to indicate that the resource declarations are to apply to all portlets in the portlet application. If specified, the wildcard character must appear alone in the first array element.
- Returns:
- The portlet names
-
-
-
portletMode
String portletMode
The portlet mode rendered by the annotated method.If an portlet mode is specified, the bean enabler will dispatch Header requests with matching portlet mode values to this method.
If this field is empty, the method will be executed for all Header requests not dispatched by portlet mode to other HeaderMethods.
- Returns:
- The portlet mode
- Default:
- ""
-
-
-
contentType
String contentType
Sets the content type, or the MIME type, of content generated by the method. The content type will be set before the annotated method body is executed.If this field is empty or set to the wildcard, no content type will be set. The portlet can then set the content type using the portlet API
HeaderResponse#setContentTypemethod.- Returns:
- The content type
- See Also:
HeaderResponse#setContentType
- Default:
- "*/*"
-
-
-
include
String include
Specifies a resource, such as a JSP, an HTML file, or a servlet to be included.The resource will be included using the
PortletRequestDispatcher#includemethod after the method body has been executed.If this field is empty, no resource will be included.
- Returns:
- The resource to be included
- See Also:
PortletRequestDispatcher,PortletRequestDispatcher#include
- Default:
- ""
-
-