Fix for issue 49. Update section 4.2.2 to refer to section 3.8 rather than restating it (badly). Change the error status code at the end of section 4.2.2 from 406 to 500 - 406 is thrown by section 3.8 when applicable, section 4.2.2 throws a 500 if it can't find a writer to serialize the entity in the selected media type, this is a server application error, not a client error. Added an item to section 3.8 to explicitly recognize that the media type can be set directly in a Response instance.

svn path=/trunk/; revision=507
diff --git a/spec/chapters/providers.tex b/spec/chapters/providers.tex
index b7f7e80..0f65792 100644
--- a/spec/chapters/providers.tex
+++ b/spec/chapters/providers.tex
@@ -48,13 +48,13 @@
 
 \begin{enumerate}
 \item Obtain the object that will be mapped to the response entity body. For a return type of \Response\ or subclasses the object is the value of the \code{entity} property, for other return types it is the returned object.
-\item Obtain the effective value of \Produces\ (see section \ref{declaring_method_capabilities}) and intersect that with the requested response formats to obtain set of permissible media types for the response entity body. Note that section \ref{mapping_requests_to_java_methods} ensures that this set will not be empty.
-\item Select the set of \MsgWrite\ providers that support (see section \ref{declaring_provider_capabilities}) one or more of the permissible media types for the response entity body.
+\item Determine the media type of the response, see section \ref{determine_response_type}.
+\item Select the set of \MsgWrite\ providers that support (see section \ref{declaring_provider_capabilities}) the object and media type of the response entity body.
 \item Sort the selected \MsgWrite\ providers as described in section \ref{declaring_provider_capabilities}.
 \item\label{findwriter} Iterate through the sorted \MsgWrite\ providers and, utilizing the \code{isWriteable} method of each, choose an \MsgWrite\ that supports the object that will be mapped to the entity body.
 \item If step \ref{findwriter} locates a suitable \MsgWrite\ then use its \code{writeTo} method to map the object to the entity body.
 \item Else if a suitable data handler can be found using the JavaBeans Activation Framework\cite{jaf} then use it to map the object to the entity body.
-\item Else generate a \WebAppExc\ with a not acceptable response (HTTP 406 status) and no entity. The exception MUST be processed as described in section \ref{method_exc}.
+\item Else generate a \WebAppExc\ with an internal server error response (HTTP 500 status) and no entity. The exception MUST be processed as described in section \ref{method_exc}.
 \end{enumerate}
 
 A \MsgWrite\code{.write} method MAY throw \WebAppExc. If thrown before the response is committed, the exception is treated as if it originated from a resource method, see section \ref{method_exc}. To avoid an infinite loop, implementations SHOULD NOT attempt to map exceptions thrown during serialization of an response previously mapped from an exception and SHOULD instead simply return a server error (status code 500) response.
diff --git a/spec/chapters/resources.tex b/spec/chapters/resources.tex
index 4900207..bbb1c55 100644
--- a/spec/chapters/resources.tex
+++ b/spec/chapters/resources.tex
@@ -423,6 +423,7 @@
 In many cases it is not possible to statically determine the media type of a response. The following algorithm is used to determine the response media type, $M_{\mbox{selected}}$, at run time:
 
 \begin{enumerate}
+\item If the method returns an instance of \Response\ whose metadata includes the response media type ($M_{\mbox{specified}}$) then set $M_{\mbox{selected}} = M_{\mbox{specified}}$, finish.
 \item Gather the set of producible media types $P$:
 \begin{itemize}
 \item If the method is annotated with \Produces, set $P = \{ V(\mbox{method}) \}$ where $V(t)$ represents the values of \Produces\ on the specified target $t$.