コード例 #1
0
        static object Decode(WADLParam param, string value)
        {
            TemplateConfigurationHandler handler = TemplateConfigurationHandler.GetConfiguration();
            var             encoderCnfg          = handler.Encoders[param.Encoding ?? Encodings.plainText];
            Type            encoder   = Type.GetType(encoderCnfg.Type);
            INetHttpEncoder formatter = Activator.CreateInstance(encoder) as INetHttpEncoder;

            return(formatter.Decode(param, value));
        }
コード例 #2
0
        //static IFormatter GetEncoder(WADLParam param)
        //{
        //    Type type = Type.GetType(TemplateConfigurationHandler.GetConfiguration().Encoders[param.Encoding].Type);
        //    return (IFormatter)Activator.CreateInstance(type);
        //}

        static void Encode(Stream stream, WADLRepresentation param, object value)
        {
            TemplateConfigurationHandler handler = TemplateConfigurationHandler.GetConfiguration();
            var encoderCnfg = handler.Encoders[param.ContentType];

            if (!String.IsNullOrEmpty(encoderCnfg.Type))
            {
                Type            encoder   = Type.GetType(encoderCnfg.Type);
                INetHttpEncoder formatter = Activator.CreateInstance(encoder) as INetHttpEncoder;
                formatter.Encode(stream, param, value);
            }
        }
コード例 #3
0
 public NetHttpService()
     : base(WADL.WADLUtility.Url.CreateUrl(TemplateConfigurationHandler.GetConfiguration().BaseUri))
 {
     try
     {
         TemplateConfigurationHandler.GetConfiguration().CreateChannels(this);
         Templates = GetTemplates();
         State     = new Status {
             CurrentStatus = ServiceStatus.OK, Message = ""
         };
     }
     catch (Exception e)
     {
         State = new Status {
             CurrentStatus = ServiceStatus.FAULT, Message = e.ToString()
         };
     }
 }