ServiceStack.ContentFormat.GetContentFormat C# (CSharp) Method

GetContentFormat() public static method

public static GetContentFormat ( Format format ) : string
format Format
return string
        public static string GetContentFormat(Format format)
        {
            var formatStr = format.ToString().ToLower();
            return format == Format.MsgPack || format == Format.ProtoBuf
                ? "x-" + formatStr
                : formatStr;
        }

Same methods

ContentFormat::GetContentFormat ( string contentType ) : string

Usage Example

Exemplo n.º 1
0
        public void Register(IAppHost appHost)
        {
            var contentTypes     = (ContentTypes)appHost.ContentTypes;
            var predefinedRoutes = appHost.GetPlugin <PredefinedRoutesFeature>();

            if (predefinedRoutes == null)
            {
                throw new NotSupportedException("SoapFormat requires the PredefinedRoutesFeature Plugin");
            }

            if (!DisableSoap11)
            {
                contentTypes.Register(MimeTypes.Soap11, SoapHandler.SerializeSoap11ToStream, null);
                contentTypes.ContentTypeStringSerializers[MimeTypes.Soap11] = (r, o) =>
                                                                              SoapHandler.SerializeSoap11ToBytes(r, o).FromUtf8Bytes();

                var soap11 = ContentFormat.GetContentFormat(Format.Soap11);
                predefinedRoutes.HandlerMappings[soap11] = () => new Soap11MessageReplyHttpHandler();
            }

            if (!DisableSoap12)
            {
                contentTypes.Register(MimeTypes.Soap12, SoapHandler.SerializeSoap12ToStream, null);
                contentTypes.ContentTypeStringSerializers[MimeTypes.Soap12] = (r, o) =>
                                                                              SoapHandler.SerializeSoap12ToBytes(r, o).FromUtf8Bytes();

                var soap12 = ContentFormat.GetContentFormat(Format.Soap12);
                predefinedRoutes.HandlerMappings[soap12] = () => new Soap12MessageReplyHttpHandler();
            }
        }
All Usage Examples Of ServiceStack.ContentFormat::GetContentFormat