Top Description Methods
javax.portlet.annotations

public @Interface ServeResourceMethod

extends Annotation
Annotations
@Retention:RUNTIME
@Target:METHOD
Static Imports
java.lang.annotation.ElementType.METHOD, .RetentionPolicy.RUNTIME

Designates a method corresponding to the portlet API serveResource method.

The annotated method must have one of the following signatures:

where the method name can be freely selected.

The method declaration may contain a throws clause. Exceptions declared in the throws clause should be of type javax.portlet.PortletException or java.io.IOException. Checked exceptions of any other type will be caught, wrapped with a PortletException, and rethrown.

Since
3.0
See Also
ResourceServingPortlet#serveResource

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the method supports asynchronous mode.
asyncSupported
()

Declares whether the serve resource method supports asynchronous operation mode.
public String

Returns:

The character encoding
characterEncoding
()

Sets the character encoding for content generated by the annotated method.
public String

Returns:

The content type
contentType
()

Sets the content type, or the MIME type, of content generated by the method.
public String

Returns:

The resource to be included
include
()

Specifies a resource, such as a JSP, an HTML file, or a servlet, to be included.
public int

Returns:

The ordinal number
ordinal
()

The ordinal number for this annotated method.
public String[]

Returns:

The portlet names
portletNames
()

The portlet names for which the serve resource method applies.
public String

Returns:

The resource ID
resourceID
()

The resource ID.

If a resource ID is specified, the bean enabler will dispatch Resource requests with matching values of the resource ID to this method.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

asyncSupportedback to summary
public boolean asyncSupported()

Declares whether the serve resource method supports asynchronous operation mode.

If this flag is set, any portlet to which this annotated method applies will be marked as supporting asynchronous operation. Asynchronous support applies to resource methods only.

Returns:boolean

true if the method supports asynchronous mode.

characterEncodingback to summary
public String characterEncoding()

Sets the character encoding for content generated by the annotated method. The character encoding will be set before the annotated method body is executed.

If this field is empty, the character encoding will not be set. The portlet can then set the character encoding using the portlet API ResourceResponse#setCharacterEncoding method.

Returns:String

The character encoding

See Also
ResourceResponse#setCharacterEncoding
contentTypeback to summary
public 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 ResourceResponse#setContentType method.

Returns:String

The content type

See Also
ResourceResponse#setContentType
includeback to summary
public 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#include method after the method body has been executed.

If this field is empty, no resource will be included.

Returns:String

The resource to be included

See Also
javax.portlet.PortletRequestDispatcher, PortletRequestDispatcher#include
ordinalback to summary
public int ordinal()

The ordinal number for this annotated method.

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.

Returns:int

The ordinal number

portletNamesback to summary
public String[] portletNames()

The portlet names for which the serve resource 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:String[]

The portlet names

resourceIDback to summary
public String resourceID()

The resource ID.

If a resource ID is specified, the bean enabler will dispatch Resource requests with matching values of the resource ID to this method.

If this field is empty, the method will be executed for all Resource requests not dispatched to other named ResourceMethods.

Returns:String

The resource ID