org.restlet.service
Class TunnelService

java.lang.Object
  extended by org.restlet.service.TunnelService

public class TunnelService
extends Object

Service tunnelling method names or client preferences via query parameters. Clients applications such as browsers can easily override the default values of their client connector by specifying additional query parameters. 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, specify the actual method to use (DELETE, PUT, etc.).
characterSetParameter charset Use extension names defined in org.restlet.service.MetadataService For GET requests, replaces the accepted character set by the given value.
encodingParameter encoding Use extension names defined in org.restlet.service.MetadataService For GET requests, replaces the accepted encoding by the given value.
languageParameter language Use extension names defined in org.restlet.service.MetadataService For GET requests, replaces the accepted language by the given value.
mediaTypeParameter media Use extension names defined in org.restlet.service.MetadataService For GET requests, replaces the accepted media type set by the given value.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
TunnelService(boolean enabled, boolean methodTunnel, boolean preferencesTunnel)
          Constructor.
 
Method Summary
 boolean allowClient(ClientInfo client)
          Indicates if the request from a given client can be tunnelled.
 String getCharacterSetAttribute()
          Returns the character set parameter name.
 String getEncodingAttribute()
          Returns the name of the parameter containing the accepted encoding.
 String getLanguageAttribute()
          Returns the name of the parameter containing the accepted language.
 String getMediaTypeAttribute()
          Returns the name of the parameter containing the accepted media type.
 String getMethodParameter()
          Returns the method parameter name.
 boolean isEnabled()
          Indicates if the service should be enabled.
 boolean isMethodTunnel()
          Indicates if the method name can be tunneled.
 boolean isPreferencesTunnel()
          Indicates if the client preferences can be tunneled.
 void setCharacterSetAttribute(String parameterName)
          Sets the character set parameter name.
 void setEnabled(boolean enabled)
          Indicates if the service should be enabled.
 void setEncodingAttribute(String parameterName)
          Sets the name of the parameter containing the accepted encoding.
 void setLanguageAttribute(String parameterName)
          Sets the name of the parameter containing the accepted language.
 void setMediaTypeAttribute(String parameterName)
          Sets the name of the parameter containing the accepted media type.
 void setMethodParameter(String parameterName)
          Sets the method parameter name.
 void setMethodTunnel(boolean methodTunnel)
          Indicates if the method name can be tunneled.
 void setPreferencesTunnel(boolean preferencesTunnel)
          Indicates if the client preferences can be tunneled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TunnelService

public TunnelService(boolean enabled,
                     boolean methodTunnel,
                     boolean preferencesTunnel)
Constructor.

Parameters:
enabled - True if the service has been enabled.
methodTunnel - Indicates if the method name can be tunneled.
preferencesTunnel - Indicates if the client preferences can be tunneled.
Method Detail

allowClient

public boolean allowClient(ClientInfo client)
Indicates if the request from a given client can be tunnelled. The default implementation always return true. This could be customize to restrict the usage of the tunnel service.

Parameters:
client - The client to test.
Returns:
True if the request from a given client can be tunnelled.

getCharacterSetAttribute

public String getCharacterSetAttribute()
Returns the character set parameter name.

Returns:
The character set parameter name.

getEncodingAttribute

public String getEncodingAttribute()
Returns the name of the parameter containing the accepted encoding.

Returns:
The name of the parameter containing the accepted encoding.

getLanguageAttribute

public String getLanguageAttribute()
Returns the name of the parameter containing the accepted language.

Returns:
The name of the parameter containing the accepted language.

getMediaTypeAttribute

public String getMediaTypeAttribute()
Returns the name of the parameter containing the accepted media type.

Returns:
The name of the parameter containing the accepted media type.

getMethodParameter

public String getMethodParameter()
Returns the method parameter name.

Returns:
The method parameter name.

isEnabled

public boolean isEnabled()
Indicates if the service should be enabled.

Returns:
True if the service should be enabled.

isMethodTunnel

public boolean isMethodTunnel()
Indicates if the method name can be tunneled.

Returns:
True if the method name can be tunneled.

isPreferencesTunnel

public boolean isPreferencesTunnel()
Indicates if the client preferences can be tunneled.

Returns:
True if the client preferences can be tunneled.

setCharacterSetAttribute

public void setCharacterSetAttribute(String parameterName)
Sets the character set parameter name.

Parameters:
parameterName - The character set parameter name.

setEnabled

public void setEnabled(boolean enabled)
Indicates if the service should be enabled.

Parameters:
enabled - True if the service should be enabled.

setEncodingAttribute

public void setEncodingAttribute(String parameterName)
Sets the name of the parameter containing the accepted encoding.

Parameters:
parameterName - The name of the parameter containing the accepted encoding.

setLanguageAttribute

public void setLanguageAttribute(String parameterName)
Sets the name of the parameter containing the accepted language.

Parameters:
parameterName - The name of the parameter containing the accepted language.

setMediaTypeAttribute

public void setMediaTypeAttribute(String parameterName)
Sets the name of the parameter containing the accepted media type.

Parameters:
parameterName - The name of the parameter containing the accepted media type.

setMethodParameter

public void setMethodParameter(String parameterName)
Sets the method parameter name.

Parameters:
parameterName - The method parameter name.

setMethodTunnel

public void setMethodTunnel(boolean methodTunnel)
Indicates if the method name can be tunneled.

Parameters:
methodTunnel - True if the method name can be tunneled.

setPreferencesTunnel

public void setPreferencesTunnel(boolean preferencesTunnel)
Indicates if the client preferences can be tunneled.

Parameters:
preferencesTunnel - True if the client preferences can be tunneled.


Copyright © 2005-2007 Noelios Consulting.