simple.http.serve
Interface ContentFactory

All Known Implementing Classes:
CacheContentFactory

public interface ContentFactory

The ContentFactory is used to create instances of the Content object. This is used in conjunction with the FactoryContext to create content objects from issued request URI strings. Because the instances are created by the FactoryContext a lifecycle must be obeyed by the produced implementations. This lifecycle states that the instance is loaded and used for a limited time.

This is required to return a Content instance if there is a suitable match for the issued request URI. If the issued request URI cannot be resolved getInstance must throw a ContentException. The request URI issued to the getInstance is the same as the URI issued to any of the Context methods.

Author:
Niall Gallagher
See Also:
Context.getContent(java.lang.String)

Method Summary
 Content getInstance(Context context, java.lang.String target)
          This will return a Content instance for the request URI issued.
 

Method Detail

getInstance

Content getInstance(Context context,
                    java.lang.String target)
                    throws ContentException
This will return a Content instance for the request URI issued. If there is no match for the issued URI then this will throw a ContentException.

Parameters:
target - the request URI for the content required
context - this is the Context used
Returns:
this returns a Content instance
Throws:
ContentException - thrown if there is no match