ServiceStack.ContentFormat.GetContentFormat C# (CSharp) Method

GetContentFormat() public static method

public static GetContentFormat ( string contentType ) : string
contentType string
return string
        public static string GetContentFormat(string contentType)
        {
            var parts = contentType?.Split('/');
            return parts?[parts.Length - 1];
        }

Same methods

ContentFormat::GetContentFormat ( Format format ) : 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