|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.util.Engine
public abstract class Engine
Facade to the engine implementating the Restlet API. Note that this is an SPI class that is not intended for public usage.
| Field Summary | |
|---|---|
static String |
MAJOR_NUMBER
Major version number. |
static String |
MINOR_NUMBER
Minor version number. |
static String |
RELEASE_NUMBER
Release number. |
static String |
VERSION
Complete version. |
| Constructor Summary | |
|---|---|
Engine()
|
|
| Method Summary | |
|---|---|
abstract int |
authenticate(Request request,
Guard guard)
Indicates if the call is properly authenticated. |
abstract void |
challenge(Response response,
boolean stale,
Guard guard)
Challenges the client by adding a challenge request to the response and by setting the status to CLIENT_ERROR_UNAUTHORIZED. |
abstract void |
copyResponseHeaders(Iterable<Parameter> headers,
Response response)
Copies the given header parameters into the given Response. |
abstract void |
copyResponseHeaders(Response response,
Series<Parameter> headers)
Copies the headers of the given Response into the given
Series. |
abstract Resource |
createDirectoryResource(Directory handler,
Request request,
Response response)
Creates a directory resource. |
abstract Helper<Application> |
createHelper(Application application)
Creates a new helper for a given component. |
abstract Helper<Client> |
createHelper(Client client,
String helperClass)
Creates a new helper for a given client connector. |
abstract Helper<Component> |
createHelper(Component component)
Creates a new helper for a given component. |
abstract Helper<Server> |
createHelper(Server server,
String helperClass)
Creates a new helper for a given server connector. |
abstract void |
fireContextChanged(Restlet restlet,
Context context)
Indicates that a Restlet's context has changed. |
abstract String |
formatCookie(Cookie cookie)
Formats the given Cookie to a String |
abstract String |
formatCookieSetting(CookieSetting cookieSetting)
Formats the given CookieSetting to a String |
abstract String |
formatDimensions(Collection<Dimension> dimensions)
Formats the given Set of Dimensions to a String for the HTTP Vary header. |
abstract String |
formatUserAgent(List<Product> products)
Formats the given List of Products to a String. |
static ClassLoader |
getClassLoader()
Returns the best class loader, first the engine class loader if available using getUserClassLoader(), otherwise the current thread context
class loader, or finally the classloader of the current class. |
static Engine |
getInstance()
Returns the registered Restlet engine. |
abstract Variant |
getPreferredVariant(ClientInfo client,
List<Variant> variants,
Language defaultLanguage)
Returns the best variant representation for a given resource according the the client preferences. A default language is provided in case the variants don't match the client preferences. |
static int |
hashCode(Object... objects)
Computes the hash code of a set of objects. |
static Class<?> |
loadClass(String className)
Returns the class object for the given name using the engine class loader fist, then the current thread context class loader, or the classloader of the current class. |
abstract void |
parse(Form form,
Representation representation)
Parses a representation into a form. |
abstract void |
parse(Form form,
String parametersString,
CharacterSet characterSet,
boolean decode,
char separator)
Parses a parameters string to parse into a given form. |
abstract MediaType |
parseContentType(String contentType)
Parses the given Content Type. |
abstract Cookie |
parseCookie(String cookie)
Parses the given String to a Cookie |
abstract CookieSetting |
parseCookieSetting(String cookieSetting)
Parses the given String to a CookieSetting |
abstract List<Product> |
parseUserAgent(String userAgent)
Parses the given user agent String to a list of Product instances. |
static void |
setInstance(Engine engine)
Sets the registered Restlet engine. |
static void |
setUserClassLoader(ClassLoader newClassLoader)
Sets the user class loader that should used in priority. |
abstract String |
toBase64(byte[] target)
Converts the given bytes array into a Base64 String. |
abstract String |
toMd5(String target)
Returns the MD5 digest of the target string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MAJOR_NUMBER
public static final String MINOR_NUMBER
public static final String RELEASE_NUMBER
public static final String VERSION
| Constructor Detail |
|---|
public Engine()
| Method Detail |
|---|
public static ClassLoader getClassLoader()
getUserClassLoader(), otherwise the current thread context
class loader, or finally the classloader of the current class.
public static Engine getInstance()
public static int hashCode(Object... objects)
objects - the objects to compute the hashCode
public static Class<?> loadClass(String className)
throws ClassNotFoundException
className - The class name to lookup.
ClassNotFoundExceptionpublic static void setInstance(Engine engine)
engine - The registered Restlet engine.public static void setUserClassLoader(ClassLoader newClassLoader)
newClassLoader - The new user class loader to use.
public abstract int authenticate(Request request,
Guard guard)
request - The request to authenticate.guard - The associated guard to callback.
Guard.checkSecret(Request, String, char[])
public abstract void challenge(Response response,
boolean stale,
Guard guard)
response - The response to update.stale - Indicates if the new challenge is due to a stale response.guard - The associated guard to callback.
public abstract void copyResponseHeaders(Iterable<Parameter> headers,
Response response)
Response.
headers - The headers to copy.response - The response to update. Must contain a Representation
to copy the representation headers in it.
public abstract void copyResponseHeaders(Response response,
Series<Parameter> headers)
Response into the given
Series.
response - The response to update. Should contain a
Representation to copy the representation headers from
it.headers - The Series to copy the headers in.
public abstract Resource createDirectoryResource(Directory handler,
Request request,
Response response)
throws IOException
handler - The parent directory handler.request - The request to handle.response - The response to return.
IOExceptionpublic abstract Helper<Application> createHelper(Application application)
application - The application to help.
public abstract Helper<Client> createHelper(Client client,
String helperClass)
client - The client to help.helperClass - Optional helper class name.
public abstract Helper<Component> createHelper(Component component)
component - The component to help.
public abstract Helper<Server> createHelper(Server server,
String helperClass)
server - The server to help.helperClass - Optional helper class name.
public abstract void fireContextChanged(Restlet restlet,
Context context)
restlet - The Restlet with a changed context.context - The new context.
public abstract String formatCookie(Cookie cookie)
throws IllegalArgumentException
cookie -
IllegalArgumentException - Thrown if the Cookie contains illegal values
public abstract String formatCookieSetting(CookieSetting cookieSetting)
throws IllegalArgumentException
cookieSetting -
IllegalArgumentException - Thrown if the CookieSetting contains illegal valuespublic abstract String formatDimensions(Collection<Dimension> dimensions)
dimensions - the dimensions to format.
public abstract String formatUserAgent(List<Product> products)
throws IllegalArgumentException
products - The list of products to format.
IllegalArgumentException - Thrown if the List of Products contains illegal values
public abstract Variant getPreferredVariant(ClientInfo client,
List<Variant> variants,
Language defaultLanguage)
client - The client preferences.variants - The list of variants to compare.defaultLanguage - The default language.
public abstract void parse(Form form,
Representation representation)
form - The target form.representation - The representation to parse.
public abstract void parse(Form form,
String parametersString,
CharacterSet characterSet,
boolean decode,
char separator)
form - The target form.parametersString - The parameters string to parse.characterSet - The supported character encoding.decode - Indicates if the parameters should be decoded using the given
character set.separator - The separator character to append between parameters.
public abstract MediaType parseContentType(String contentType)
throws IllegalArgumentException
contentType - the Content Type as String
IllegalArgumentException - if the String can not be parsed.
public abstract Cookie parseCookie(String cookie)
throws IllegalArgumentException
cookie -
IllegalArgumentException - Thrown if the String can not be parsed as Cookie.
public abstract CookieSetting parseCookieSetting(String cookieSetting)
throws IllegalArgumentException
cookieSetting -
IllegalArgumentException - Thrown if the String can not be parsed as CookieSetting.
public abstract List<Product> parseUserAgent(String userAgent)
throws IllegalArgumentException
userAgent -
IllegalArgumentException - Thrown if the String can not be parsed as a list of Product
instances.public abstract String toBase64(byte[] target)
target - The bytes array to encode.
public abstract String toMd5(String target)
target - The string to encode.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||