|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResourceFactory
Interface that must be implemented by resource factories.
A resource factory is used to create an instance of the
appropriate derived class of Resource
based on the
content-type of the retrieved resource, and possibly on the
context under which the resource is to be created.
When a resource couldn't be retrieved because of some network error,
an instance of the RetrievalFailedResource
class must be returned.
When a resource's content-type is not supported for the given context,
an instance of the NotSupportedResource
class must be returned.
Method Summary | |
---|---|
Resource |
createResource(java.net.URI uri,
java.util.List<RetrievalElement> retrieved,
int depth,
ResourceContext resourceContext,
Resource.LoadType loadType)
Creates an instance of a Resource based on the given parameters. |
boolean |
isContentTypeSupported(java.lang.String contentType,
ResourceContext resourceContext)
Returns true when the factory is able to create resources
that match the given content-type under the given context. |
Method Detail |
---|
Resource createResource(java.net.URI uri, java.util.List<RetrievalElement> retrieved, int depth, ResourceContext resourceContext, Resource.LoadType loadType) throws TestException
Resource
based on the given parameters.
uri
- absolute URI of the resource.retrieved
- the retrieved representation of the resource.depth
- the depth of the resourceresourceContext
- the context that gave birth to the resource.loadType
- browser rendering type of the resource
null
.
TestException
- an unexpected error occurred while retrieving the resource.boolean isContentTypeSupported(java.lang.String contentType, ResourceContext resourceContext)
true
when the factory is able to create resources
that match the given content-type under the given context.
contentType
- Content-Type to checkresourceContext
- Context under which the resource would be created
true
when the content-type is supported,
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |