IHttpHandler dependency injection or Controller??

Topics: General, Troubleshooting
May 30, 2012 at 6:52 AM

I need to implement processing of *.less files, I cant use the dotless httpHandler as I need to change variables dynamically.

There are 2 options...

- I can create my own HttpHandler, only thing is I have no idea how to inject dependencies?? constructor is not possible. Is there a global handle I to the Container I can get hold of??

- I can use a controller action instead, how would I set the route to catch all ".less" files site wide or at least theme?? I've tried

Route = new Route(
                        "{*path}.less",
                        new RouteValueDictionary {
                            {"area", "Orchard.Custom"},
                            {"controller", "LessCss"},
                            {"action", "Index"}
                        },

but I cant pick up routes like http://league.dev:30320/OrchardLocal/Themes/League/Styles/DotLess.less