public MessageBusConfigurator RegisterHttpHandler(Type t)
 {
     NGinnBPM.MessageBus.Impl.HttpService.UrlPatternAttribute at = (NGinnBPM.MessageBus.Impl.HttpService.UrlPatternAttribute)Attribute.GetCustomAttribute(t, typeof(NGinnBPM.MessageBus.Impl.HttpService.UrlPatternAttribute));
     if (at != null)
     {
         ComponentRegistration <NGinnBPM.MessageBus.Impl.HttpService.IServlet> reg = Component.For <NGinnBPM.MessageBus.Impl.HttpService.IServlet>().ImplementedBy(t)
                                                                                     .DependsOn(new { MatchUrl = at.Pattern }).LifeStyle.Transient;
         _wc.Register(reg);
         log.Info("URL: {0}, handler: {1}", at.Pattern, t.FullName);
     }
     else
     {
         log.Info("Url pattern not specified for http servlet {0}", t.FullName);
     }
     return(this);
 }
Пример #2
0
        /// <summary>
        /// Return url pattern for given type
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static string GetPatternForType(Type t)
        {
            UrlPatternAttribute att = (UrlPatternAttribute)Attribute.GetCustomAttribute(t, typeof(UrlPatternAttribute));

            return(att != null ? att.Pattern : null);
        }