Exemplo n.º 1
0
 private static bool TryGetContentTypeHandler(IContext context, out IContentTypeHandler contentTypeHandler)
 {
     try
     {
         string matchedType;
         contentTypeHandler = new ContentTypeHandlerTable().GetContentTypeHandler(context.Request.AcceptTypes, out matchedType);
     }
     catch (UnsupportedMediaTypeException)
     {
         context.Response.StatusCode = 415;
         context.Response.StatusDescription = "Unsupported media type requested.";
         contentTypeHandler = null;
         return false;
     }
     return true;
 }
 public ContentTypeHandlerRepository(IContentTypeHandler[] handlers)
 {
     _handlers = handlers;
 }