* @param protocol the protocol that the service is using
* @return media type with parameters removed
* @throws ServletException if <code>mediastring</code> contains no supported media type
*/
private MediaType getMediaType(String mediastring, MediaTypeMapper mapper) throws ServletException {
MediaType media;
if (mediastring == null) {
try {
media = mapper.getMediaTypeFor(null);
} catch (WsConfigurationException e) {
throw new ServletException("Internal JiBX/WS error. Unable to find default media type due to '"
+ e.getMessage() + "'.");
}
} else {
try {
media = new MediaType(mediastring, true);
} catch (ParseException e) {
throw new ServletException("Error parsing media type in content-type from request: " + mediastring);
}
if (!CodecDirectory.hasCodecFor(media)) {
throw new ServletException("No supported media type in content-type from request: " + mediastring);