com.sun.jersey.api.container.filter
Class UriConnegFilter

java.lang.Object  extended by com.sun.jersey.api.container.filter.UriConnegFilter
All Implemented Interfaces:
ContainerRequestFilter

public class UriConnegFilter
extends java.lang.Object
implements ContainerRequestFilter

A URI-based content negotiation filter mapping a dot-declared suffix in URI to media type that is the value of the Accept header or a language that is the value of the Accept-Language header.

This filter may be used when the accetable media type and acceptable language need to be declared in the URI.

This class may be extended to declare the mappings and the extending class, foo.MyUriConnegFilter say, can be registered as a container request filter. When an application is deployed as a Servlet or Filter such a filter can be registered using the following initialization parameters:

     <init-param>         <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>         <param-value>foo.MyUriConnegFilter</param-value>     </init-param&gt 

If a suffix of "atom" is regstered with a media type of "application/atom+xml" then a GET request of:

GET /resource.atom

is transformed to:

GET /resourceAccept: application/atom+xml
Any existing "Accept" header value will be replaced.

If a suffix of "english: is regstered with a language of "en" then a GET request of:

GET /resource.english

is transformed to:

GET /resourceAccept-Language: en
Any existing "Accept-Language"header value will be replaced.

The media type mappings are processed before the language type mappings.

Author:
Paul.Sandoz@Sun.Com
See Also:
com.sun.jersey.api.container.filter


Constructor Summary
UriConnegFilter(java.util.Map<java.lang.String,MediaType> mediaExtentions)
          Create a filter with suffix to media type mappings.
UriConnegFilter(java.util.Map<java.lang.String,MediaType> mediaExtentions, java.util.Map<java.lang.String,java.lang.String> languageExtentions)
          Create a filter with suffix to media type mappings and suffix to langauge mappings.
 
Method Summary
 ContainerRequestfilter(ContainerRequest request)
          Filter the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriConnegFilter

public UriConnegFilter(java.util.Map<java.lang.String,MediaType> mediaExtentions)
Create a filter with suffix to media type mappings.

Parameters:
mediaExtentions - the suffix to media type mappings.


UriConnegFilter

public UriConnegFilter(java.util.Map<java.lang.String,MediaType> mediaExtentions,                       java.util.Map<java.lang.String,java.lang.String> languageExtentions)
Create a filter with suffix to media type mappings and suffix to langauge mappings.

Parameters:
mediaExtentions - the suffix to media type mappings.
languageExtentions - the syffix to language mappings.

Method Detail

filter

public ContainerRequest filter(ContainerRequest request)
Description copied from interface: ContainerRequestFilter
Filter the request.

An implementation may modify the state of the request or create a new instance.

Specified by:
filter in interface ContainerRequestFilter
Parameters:
request - the request.
Returns:
the request.


Copyright © 2011
Oracle Corporation. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14