org.sakaiproject.entitybroker.entityprovider.annotations
Annotation Type EntityURLRedirect


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface EntityURLRedirect

This annotation indicates that this method will handle an incoming URL and do some processing to turn it into an outgoing URL OR just do some processing OR indicate that a failure has occurred
Define the URL pattern to match AFTER the /prefix using {name} to indicate variables
Example: /{thing}/site/{siteId} will match the following URL:
/myprefix/123/site/456, the variables will be {prefix => myprefix, thing => 123, siteId => 456}
NOTE: all incoming URL templates must start with "/{prefix}" (TemplateParseUtil.TEMPLATE_PREFIX)

NOTE: The method template patterns will be compared in the order they appear in your source code so be careful that you do not have a really simple redirect pattern as the first one as this can cause the other patterns to never be reached
The methods that this annotates should return a String or void
They can have the following parameter types:
(type => data which will be given to the method)
String : incoming URL
EntityView.Method : the submission method (GET,POST,etc)
String[] : incoming URL segments, Example: /myprefix/123/apple => {'prefix','123','apple'}
Map (String => String) : a map of the variable values in the {}, Example: pattern: /{prefix}/{thing}/apple, url: /myprefix/123/apple, would yield: {'thing' => '123','prefix' => 'mypreifx'}
Don't forget to handle the extensions as they will not automatically pass through, use the TemplateParseUtil.DOT_EXTENSION and TemplateParseUtil.EXTENSION values from the variable map which will contain the extension that was passed in

Return should be one of the following:
1) the URL to redirect to, will be processed as an external redirect if it starts with "http" or "/" (unless it starts with "/{prefix}"), otherwise it will be processed as an internal forward
2) "" (empty string) to not redirect and return an empty success response
3) null to not redirect and allow standard processing of the URL to continue
For failures: if there is a failure you should throw an IllegalStateException to indicate failure
This is the convention part of the Redirectable capability

Author:
Aaron Zeckoski (azeckoski @ gmail.com)
See Also:
Redirectable

Required Element Summary
 String value
           
 

Element Detail

value

public abstract String value
Returns:
the URL template pattern to match including the /prefix using {name} to indicate variables
Example: /{prefix}/{thing}/site/{siteId} will match the following URL:
/myprefix/123/site/456, the variables will be {prefix => myprefix, thing => 123, siteId => 456} NOTE: all incoming URL templates must start with "/{prefix}" (TemplateParseUtil.TEMPLATE_PREFIX)


Copyright © 2007-2013 Sakai Project. All Rights Reserved.