Annotation Type ServeResourceMethod
-
@Retention(RUNTIME) @Target(METHOD) public @interface ServeResourceMethod
Designates a method corresponding to the portlet API serveResource method.The annotated method must have one of the following signatures:
-
public void <methodName>(ResourceRequest, ResourceResponse)This corresponds to the
serveResourcemethod. -
public String <methodName>()The String returned by the method will be written to the response unchanged.
-
public void <methodName>()Intended for use when only a resource include is needed.
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.- Since:
- 3.0
- See Also:
ResourceServingPortlet#serveResource
-
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description String[]portletNamesThe portlet names for which the serve resource method applies.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanasyncSupportedDeclares whether the serve resource method supports asynchronous operation mode.StringcharacterEncodingSets the character encoding for content generated by the annotated method.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.StringresourceIDThe resource ID.
-
-
-
Element Detail
-
portletNames
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:
- The portlet names
-
-
-
resourceID
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:
- The resource ID
- Default:
- ""
-
-
-
characterEncoding
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#setCharacterEncodingmethod.- Returns:
- The character encoding
- See Also:
ResourceResponse#setCharacterEncoding
- 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
ResourceResponse#setContentTypemethod.- Returns:
- The content type
- See Also:
ResourceResponse#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:
- ""
-
-
-
asyncSupported
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:
trueif the method supports asynchronous mode.
- Default:
- false
-
-