|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jersey.api.container.filter.UriConnegFilter
public class UriConnegFilter
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>
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 /resource Accept: application/atom+xmlAny 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 /resource Accept-Language: enAny existing "Accept-Language"header value will be replaced.
The media type mappings are processed before the language type mappings.
com.sun.jersey.api.container.filter| Constructor Summary | |
|---|---|
UriConnegFilter(java.util.Map<java.lang.String,javax.ws.rs.core.MediaType> mediaExtentions)
Create a filter with suffix to media type mappings. |
|
UriConnegFilter(java.util.Map<java.lang.String,javax.ws.rs.core.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 | |
|---|---|
ContainerRequest |
filter(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 |
|---|
public UriConnegFilter(java.util.Map<java.lang.String,javax.ws.rs.core.MediaType> mediaExtentions)
mediaExtentions - the suffix to media type mappings.
public UriConnegFilter(java.util.Map<java.lang.String,javax.ws.rs.core.MediaType> mediaExtentions,
java.util.Map<java.lang.String,java.lang.String> languageExtentions)
mediaExtentions - the suffix to media type mappings.languageExtentions - the syffix to language mappings.| Method Detail |
|---|
public ContainerRequest filter(ContainerRequest request)
ContainerRequestFilterAn implementation may modify the state of the request or create a new instance.
filter in interface ContainerRequestFilterrequest - the request.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||