public UriMtHelper(IOidStrategy oidStrategy, HttpRequestMessage req, ITypeFacade spec)
     : this(oidStrategy, req)
 {
     this.spec  = spec;
     cachedId   = "";
     CachedType = RestUtils.SpecToPredefinedTypeString(spec, oidStrategy);
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 7
0
 public UriMtHelper(HttpRequestMessage req, INakedObjectSpecificationSurface spec)
     : this(req) {
     this.spec  = spec;
     cachedId   = "";
     cachedType = RestUtils.SpecToPredefinedTypeString(spec);
 }