Application service tunneling request method or client preferences. The
tunneling can use query parameters, file-like extensions and specific
headers. This is particularly useful for browser-based applications that
can't fully control the HTTP requests sent.
Here is the list of the default parameter names supported:
Property |
Default name |
Value type |
Description |
methodParameter |
method |
See values in
org.restlet.data.Method |
For POST requests, let you specify the actual method to use (DELETE, PUT,
MOVE, etc.). For GET requests, let you specify OPTIONS as the actual method
to use. |
characterSetParameter |
charset |
Use extension names defined in
MetadataService or the full
character set name |
For GET requests, replaces the accepted character set by the given value.
|
encodingParameter |
encoding |
Use extension names defined in
MetadataService or the full
encoding name |
For GET requests, replaces the accepted encoding by the given value. |
languageParameter |
language |
Use extension names defined in
MetadataService or the full
language name |
For GET requests, replaces the accepted language by the given value. |
mediaTypeParameter |
media |
Use extension names defined in
MetadataService or the full media
type name |
For GET requests, replaces the accepted media type set by the given
value. |
methodHeader |
X-HTTP-Method-Override |
Name of non-standard header. It is a good practice to prefix it with
"X-". |
For POST requests, let you specify the actual method to use (DELETE, PUT,
MOVE, etc.). |
The client preferences can also be updated according to the user agent
properties (its name, version, operating system, or other) available via the
ClientInfo#getAgentAttributes() method. Check the
#isUserAgentTunnel() method.
The list of new media type preferences is loaded from a property file called
"accept.properties" located in the classpath in the sub directory
"org/restlet/service". This property file is composed of blocks of
properties. One "block" of properties starts either with the beginning of the
properties file or with the end of the previous block. One block ends with
the "acceptNew" property which contains the value of the new accept header.
Here is a sample block.
agentName: firefox
acceptOld: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,\*\/\*;q=0.5
acceptNew: application/xhtml+xml,text/html,text/xml;q=0.9,application/xml;q=0.9,text/plain;q=0.8,image/png,\*\/\*;q=0.5
Each declared property is a condition that must be filled in order to update
the client preferences. For example "agentName: firefox" expresses the fact
this block concerns only "firefox" clients.
The "acceptOld" property allows to check the value of the current "Accept"
header. If it equals to the value of the "acceptOld" property or if the
"acceptOld" property is empty, then the preferences will be updated. This can
be useful for AJAX clients which looks like their browser (same agentName,
agentVersion, etc.) but can provide their own "Accept" header.