[sakai2-tcc] Filtering Content served from CHS

Matthew Buckett matthew.buckett at oucs.ox.ac.uk
Fri Dec 10 06:47:54 PST 2010


On 10 December 2010 13:34, Aaron Zeckoski <aaronz at vt.edu> wrote:
> I am not a fan of the user control part but I love the idea of
> content/resources finally outputting a valid html page instead of the
> invalid fragment it has done forever.

I like to leave people in control of how their content is managed,
maybe have the UI as a option and possibly only available to admins?

> If someone wanted to control the stuff that goes into the header (like
> CSS stylesheets for their site or JS libraries) then how could that be
> done? Would it be possible to extend this to include a provider style
> interface or configuration options or something which would allow some
> site wide level of control?

Yes.
There is a ContentFilter interface you implement and then register it
in the list of filters to be run.

/**
 * Interface that allows modification of some content.
 * We don't have access to the response headers so can't do things
like zip compression.
 * @author buckett
 *
 */
public interface ContentFilter {

	/**
	 * Check if this content filter should be applied to the resource.
This should be a fast
	 * check.
	 * @param resource The resource being requested.
	 * @return <code>true</code> if a filter should be retrieved using
{@link #wrap(OutputStream)}.
	 */
	public boolean isFiltered(ContentResource resource);
	
	/**
	 * Create a filter which will process the content.
	 * @param content A stream to which the output will be written.
	 * @return An output stream which is contains the modified output.
	 */
	public HttpServletResponse wrap(HttpServletResponse response,
ContentResource resource);
	
}

-- 
  Matthew Buckett
  VLE Developer, LTG, Oxford University Computing Services


More information about the sakai2-tcc mailing list