public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, ITypeFacade spec)
     : this(oidStrategy, req)
 {
     this.spec  = spec;
     cachedId   = "";
     CachedType = RestUtils.SpecToPredefinedTypeString(spec, oidStrategy);
 }
Example #2
0
 private static void FilterBlobsAndClobs(PropertyContextSurface propertyContext, RestControlFlags flags)
 {
     if (!flags.BlobsClobs)
     {
         if (RestUtils.IsBlobOrClob(propertyContext.Specification) && !RestUtils.IsAttachment(propertyContext.Specification))
         {
             throw new PropertyResourceNotFoundNOSException(propertyContext.Id);
         }
     }
 }
Example #3
0
        public bool RequestingAttachment()
        {
            HttpHeaderValueCollection <MediaTypeWithQualityHeaderValue> incomingMediaTypes = requestMessage.Headers.Accept;

            if (!incomingMediaTypes.Any() || incomingMediaTypes.Any(mt => RestUtils.IsJsonMediaType(mt.MediaType)))
            {
                return(false);
            }

            return(true);
        }
 private string GetParameterValue(RestControlFlags flags, ITypeFacade parameterValueSpec)
 {
     if (flags.SimpleDomainModel)
     {
         return(RestUtils.SpecToTypeAndFormatString(parameterValueSpec, oidStrategy).Item1);
     }
     if (flags.FormalDomainModel)
     {
         return(BuildDomainTypeUri(RestUtils.SpecToPredefinedTypeString(parameterValueSpec, oidStrategy)).ToString());
     }
     return(null);
 }
 private string GetParameterValue(RestControlFlags flags, INakedObjectSpecificationSurface parameterValueSpec)
 {
     if (flags.SimpleDomainModel)
     {
         return(RestUtils.SpecToTypeAndFormatString(parameterValueSpec).Item1);
     }
     if (flags.FormalDomainModel)
     {
         return(BuildDomainTypeUri(RestUtils.SpecToPredefinedTypeString(parameterValueSpec)).ToString());
     }
     return(null);
 }
Example #6
0
        public void ValidateIncomingMediaTypeAsJson()
        {
            if (AcceptHeaderStrict)
            {
                HttpHeaderValueCollection <MediaTypeWithQualityHeaderValue> incomingMediaTypes = requestMessage.Headers.Accept;

                if (!incomingMediaTypes.Any() || incomingMediaTypes.Any(mt => RestUtils.IsJsonMediaType(mt.MediaType)))
                {
                    return;
                }

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotAcceptable));
            }
        }
 public UriMtHelper(HttpRequestMessage req, INakedObjectSpecificationSurface spec)
     : this(req) {
     this.spec  = spec;
     cachedId   = "";
     cachedType = RestUtils.SpecToPredefinedTypeString(spec);
 }