org.sakaiproject.entitybroker.entityprovider.capabilities
Interface RedirectControllable

All Superinterfaces:
EntityProvider, Redirectable

public interface RedirectControllable
extends Redirectable

This entity type has the ability to define and handle configurable URLs
This adds the ability to control all redirects via a central method
URLs like this can be handled and supported:
/gradebook/7890/student/70987 to view all the grades for a student from a course
/gradebook/6758/item/Quiz1 to view a particular item in a gradebook by it's human readable name
/gradebook/item/6857657 to maybe just a view an item by its unique id.
This is one of the capability extensions for the EntityProvider interface
The convention interface is at Redirectable, there is also a capability for handling simple redirects at RedirectDefinable

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Method Summary
 String[] defineHandledTemplatePatterns()
          Defines all the URL patterns that will be matched and passed through to #handleRedirects(String, String[], Map) NOTE: /{prefix}/ must be included as the start of the template
 String handleRedirects(String matchedTemplate, String incomingURL, String[] incomingSegments, Map<String,String> incomingVariables)
          Explicitly handles all the incoming URLs which match the patterns given by defineHandledTemplatePatterns() do some processing to turn it into an outgoing URL OR just do some processing OR indicate that a failure has occurred
 
Methods inherited from interface org.sakaiproject.entitybroker.entityprovider.EntityProvider
getEntityPrefix
 

Method Detail

defineHandledTemplatePatterns

String[] defineHandledTemplatePatterns()
Defines all the URL patterns that will be matched and passed through to #handleRedirects(String, String[], Map) NOTE: /{prefix}/ must be included as the start of the template

Returns:
a list of all the handled URL patterns

handleRedirects

String handleRedirects(String matchedTemplate,
                       String incomingURL,
                       String[] incomingSegments,
                       Map<String,String> incomingVariables)
Explicitly handles all the incoming URLs which match the patterns given by defineHandledTemplatePatterns() do some processing to turn it into an outgoing URL OR just do some processing OR indicate that a failure has occurred

Parameters:
matchedPattern - the template pattern that was matched
incomingURL - the incoming URL that was matched by a URL pattern
incomingSegments - incoming URL segments, Example: /prefix/123/apple => {'prefix','123','apple'}
incomingVariables - a map of the values in the {} (prefix is always included), Example: pattern: /prefix/{thing}/apple, url: /prefix/123/apple, would yield: 'thing' => '123'
Returns:
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
Throws:
IllegalStateException - if there is a failure, this will cause the server to return a redirect failure


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