@Retention(value=RUNTIME) @Target(value=METHOD) public @interface HeaderMethod
HeaderPortlet
interface.
The annotated method must have one of the following signatures:
public void <methodName>(HeaderRequest, HeaderResponse)
This corresponds to the renderHeaders
method.
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 PortletException
or
IOException
.
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 HEAD
section of the aggregated portal document.
Valid HEAD
section markup written to the HeaderResponse
output stream or writer will be added to the aggregated portal document HEAD
section subject to portlet container-imposed restrictions.
the add and set properties methods of PortletResponse
,
MimeResponse#MARKUP_HEAD_ELEMENT
,
HeaderPortlet
Modifier and Type | Required Element and Description |
---|---|
String[] |
portletNames
The portlet names for which the header method applies.
|
Modifier and Type | Optional Element and Description |
---|---|
String |
contentType
Sets the content type, or the MIME type, of content generated by the method.
|
String |
include
Specifies a resource, such as a JSP, an HTML file, or a servlet to be included.
|
int |
ordinal
The ordinal number for this annotated method.
|
String |
portletMode
The portlet mode rendered by the annotated method.
|
public abstract String[] portletNames
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.
public abstract String portletMode
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.
public abstract String contentType
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#setContentType
method.
HeaderResponse#setContentType
public abstract String include
The resource will be included using the
PortletRequestDispatcher#include
method after the method body
has been executed.
If this field is empty, no resource will be included.
PortletRequestDispatcher
,
PortletRequestDispatcher#include
public abstract int ordinal
The ordinal number determines the order of execution if multiple methods are annotated. Annotated methods with a lower ordinal number are executed before methods with a higher ordinal number.
Java Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.