org.glassfish.jersey.client.filter
Class EncodingFeature

java.lang.Object
  extended by org.glassfish.jersey.client.filter.EncodingFeature
All Implemented Interfaces:
Feature

public class EncodingFeature
extends Object
implements Feature

Feature that configures support for content encodings on the client side. This feature registers EncodingFilter and the specified set of encoding providers to the client configuration. It also allows setting the value of ClientProperties.USE_ENCODING property.

Author:
Martin Matula (martin.matula at oracle.com)

Constructor Summary
EncodingFeature(Class<? extends ContentEncoder>... encodingProviders)
          Create a new instance of the feature.
EncodingFeature(String useEncoding, Class<? extends ContentEncoder>... encoders)
          Create a new instance of the feature specifying the default value for the ClientProperties.USE_ENCODING property.
 
Method Summary
 boolean configure(FeatureContext context)
          A call-back method called when the feature is to be enabled in a given runtime configuration scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodingFeature

public EncodingFeature(Class<? extends ContentEncoder>... encodingProviders)
Create a new instance of the feature.

Parameters:
encodingProviders - Encoding providers to be registered in the client configuration.

EncodingFeature

public EncodingFeature(String useEncoding,
                       Class<? extends ContentEncoder>... encoders)
Create a new instance of the feature specifying the default value for the ClientProperties.USE_ENCODING property. Unless the value is set in the client configuration properties at the time when this feature gets enabled, the provided value will be used.

Parameters:
useEncoding - Default value of ClientProperties.USE_ENCODING property.
encoders - Encoders to be registered in the client configuration.
Method Detail

configure

public boolean configure(FeatureContext context)
Description copied from interface: Feature
A call-back method called when the feature is to be enabled in a given runtime configuration scope. The responsibility of the feature is to properly update the supplied runtime configuration context and return true if the feature was successfully enabled or false otherwise.

Note that under some circumstances the feature may decide not to enable itself, which is indicated by returning false. In such case the configuration context does not add the feature to the collection of enabled features and a subsequent call to Configuration.isEnabled(Feature) or Configuration.isEnabled(Class) method would return false.

Specified by:
configure in interface Feature
Parameters:
context - configurable context in which the feature should be enabled.
Returns:
true if the feature was successfully enabled, false otherwise.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.