Simplified context resolver stuff to only use @ProduceMime for declaring media type capabilities. Changed Providers.getContext to Provider.getContextResolver for consistency with other methods.
svn path=/trunk/; revision=391
diff --git a/spec/chapters/providers.tex b/spec/chapters/providers.tex
index b9ccc4a..eb87ad5 100644
--- a/spec/chapters/providers.tex
+++ b/spec/chapters/providers.tex
@@ -109,9 +109,9 @@
\subsection{Declaring Media Type Capabilities}
-Context providers MAY restrict the media types they support using the \ConsumeMime\ and \ProduceMime\ annotations respectively. The absence of these annotations is equivalent to their inclusion with media type (\lq\lq*/*\rq\rq), i.e. absence implies that any media type is supported.
+Context provider implementations MAY restrict the media types they support using the \ProduceMime\ annotation. The absence of this annotation is equivalent to its inclusion with media type (\lq\lq*/*\rq\rq), i.e. absence implies that any media type is supported.
-When choosing a context provider an implementation sorts the available providers according to the media types they declare support for. Sorting of media types follows the general rule: x/y $<$ x/* $<$ */*, i.e. a provider that explicitly lists a media types is sorted before a provider that lists */*. Quality parameter values are also used such that x/y;q=1.0 $<$ x/y;q=0.7.
+When choosing a context provider an implementation sorts the available providers according to the media types they declare support for. Sorting of media types follows the general rule: x/y $<$ x/* $<$ */*, i.e. a provider that explicitly lists a media type is sorted before a provider that lists */*. Quality parameter values are also used such that x/y;q=1.0 $<$ x/y;q=0.7.
\section{Exception Mapping Providers}
\label{exceptionmapper}
diff --git a/src/jsr311-api/src/javax/ws/rs/ext/ContextResolver.java b/src/jsr311-api/src/javax/ws/rs/ext/ContextResolver.java
index 0d9fa9f..409020a 100644
--- a/src/jsr311-api/src/javax/ws/rs/ext/ContextResolver.java
+++ b/src/jsr311-api/src/javax/ws/rs/ext/ContextResolver.java
@@ -20,13 +20,12 @@
* annotated with {@link Provider}.
*
* A <code>ContextResolver</code> implementation may be annotated
- * with {@link javax.ws.rs.ConsumeMime} and {@link javax.ws.rs.ProduceMime} to
- * restrict the media types for which it will be considered suitable.
+ * with {@link javax.ws.rs.ProduceMime} to restrict the media types for
+ * which it will be considered suitable.
*
* @see javax.ws.rs.core.Context
- * @see Providers#getContext(java.lang.Class, java.lang.Class, javax.ws.rs.core.MediaType, javax.ws.rs.core.MediaType)
+ * @see Providers#getContextResolver(java.lang.Class, java.lang.Class, javax.ws.rs.core.MediaType)
* @see Provider
- * @see javax.ws.rs.ConsumeMime
* @see javax.ws.rs.ProduceMime
*/
public interface ContextResolver<T> {
@@ -35,14 +34,8 @@
* Get a context of type <code>T</code> that is applicable to the supplied
* type.
* @param type the class of object for which a context is desired
- * @param consumes the media type of data being consumed for which a
- * context is required. A null value indicates the the context will not be
- * used for consuming data.
- * @param produces the media type of data being produced for which a
- * context is required. A null value indicates the the context will not be
- * used for producing data.
* @return a context for the supplied type or <code>null</code> if a
* context for the supplied type is not available from this provider.
*/
- T getContext(Class<?> type, MediaType consumes, MediaType produces);
+ T getContext(Class<?> type);
}
diff --git a/src/jsr311-api/src/javax/ws/rs/ext/Providers.java b/src/jsr311-api/src/javax/ws/rs/ext/Providers.java
index b766621..d7adc26 100644
--- a/src/jsr311-api/src/javax/ws/rs/ext/Providers.java
+++ b/src/jsr311-api/src/javax/ws/rs/ext/Providers.java
@@ -93,19 +93,12 @@
* exhausted.
* @param contextType the class of context desired
* @param objectType the class of object for which the context is desired
- * @param consumes the media type of data being consumed for which a
- * context is required. The value is compared to the values of
- * {@link javax.ws.rs.ConsumeMime} for each candidate and only matching
- * providers will be considered. A null value indicates that the context
- * will not be used for consuming data and the values of {@code ConsumeMime}
- * annotations will not be used to filter the set of suitable providers.
- * @param produces the media type of data being produced for which a
- * context is required. The value is compared to the values of
- * {@link javax.ws.rs.ProduceMime} for each candidate and only matching
- * providers will be considered. A null value indicates that the context
- * will not be used for producing data and the values of {@code ProduceMime}
- * annotations will not be used to filter the set of suitable providers.
+ * @param mediaType the media type of data for which a context is required.
+ * The value is compared to the values of {@link javax.ws.rs.ProduceMime}
+ * for each candidate and only matching providers will be considered.
+ * A null value is equivalent to
+ * {@link javax.ws.rs.core.MediaType#WILDCARD_TYPE}.
* @return a matching context or null if none is found.
*/
- <T> T getContext(Class<T> contextType, Class<?> objectType, MediaType consumes, MediaType produces);
+ <T> ContextResolver<T> getContextResolver(Class<T> contextType, Class<?> objectType, MediaType mediaType);
}