private RQKosFormat.FormatEnum GetFormat() { System.Net.Http.Formatting.IContentNegotiator negotiator = this.Configuration.Services.GetContentNegotiator(); System.Net.Http.Formatting.ContentNegotiationResult result = negotiator.Negotiate(typeof(RQKosBranch), this.Request, this.Configuration.Formatters); if (result != null) { RQKosFormat.FormatEnum format = RQKosFormat.FormatEnum.undefined; switch (result.MediaType.MediaType) { case "application/turtle": throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); //format = RQKosFormat.FormatEnum.turtle; //break; case "text/turtle": throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); //format = RQKosFormat.FormatEnum.turtle; //break; case "application/rdf+n3": throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); //format = RQKosFormat.FormatEnum.turtle; //break; case "text/rdf+n3": throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); //format = RQKosFormat.FormatEnum.turtle; //break; case "application/rdf+xml": format = RQKosFormat.FormatEnum.rdf; break; case "text/rdf": format = RQKosFormat.FormatEnum.rdf; break; default: throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); //format = RQKosFormat.FormatEnum.undefined; //break; } return(format); } else { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable)); } }
public System.Net.Http.Formatting.ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable <System.Net.Http.Formatting.MediaTypeFormatter> formatters) { var result = new System.Net.Http.Formatting.ContentNegotiationResult(_jsonFormatter, new System.Net.Http.Headers.MediaTypeHeaderValue("application/json")); return(result); }