simple.http.serve
Interface ResourceEngine

All Known Implementing Classes:
FileEngine, LoaderEngine, MapperEngine, TemplateEngine

public interface ResourceEngine

The ResourceEngine is used to create implementations of the Resource interface that suit the targeted resource. Different Resource objects may be needed to handle different files/directories or even applications. The request URI specified must be a HTTP request URI as of RFC 2616.

The meaning of HTTP URI in this instance is the request URI from a HTTP/x.x request, as RFC 2616 and RFC 2396 defines it

 
 Request-Line = Method SP Request-URI SP HTTP-Version CRLF

 Request-URI = "*" | absoluteURI | abs_path | authority
 absoluteURI = "http:" "//" host [":" port] [abs_path ["?" query]] 
 abs_path = "/" path_segments         
 path_segments = segment *( "/" segment )
 
The ResourceEngine object must be prepared to accept the request URI that come in the form outlined above. These can include formats like
 
 http://some.host/pub;param=value/bin/index.html?name=value
 http://some.host:8080/index.en_US.html
 some.host:8080/index.html
 /usr/bin;param=value/README.txt
 /usr/bin/compress.tar.gz
 
The ResourceEngine implementation should be able to directly take a Request-URI as defined in RFC 2616 and translate this into a Resource. This keeps the objects semantics simple and explicit, although at the expense of performance.

The Resource returned is an implementation of the ProtocolHandler interface. Implementation's of this can acquire the Resource based on the URI or query.

Author:
Niall Gallagher

Method Summary
 Resource resolve(java.lang.String target)
          This will look for and retrieve the requested resource.
 

Method Detail

resolve

Resource resolve(java.lang.String target)
This will look for and retrieve the requested resource. The target given must be in the form of a request URI. This will locate the resource and return the Resource implementation that will handle the target.

Parameters:
target - the URI style path that represents the target Resource
Returns:
this returns the Resource object to handle the desired target
Throws:
java.lang.IllegalArgumentException - if the path given is not relative URI style