The Wiki Actions Procedure page shows the number of different hooks you can use to enter your own customized behavior, as well as the order in which they are executed.
Greeting requests using RawHttpHandlers
You can completely bypass ServiceStack by adding Config.RawHttpHandlers to return IHttpHandler to the requests you want to welcome, for example, since the built-in mini-profiler welcomes all requests for files that are launched with ssr- and returns a physical file:
config.RawHttpHandlers.Add((IHttpRequest request) => { var file = GetFileNameWithoutExtension(request.PathInfo); return file != null && file.StartsWith("ssr-") ? new MiniProfilerHandler() : null; }
Providing a failover route for inconsistent routes
If you want to provide a default handler for an inconsistent route, you can register CatchAllHandlers in AppHost.Configure() or in a plugin with:
appHost.CatchAllHandlers.Add((string method, string pathInfo, string filepath) => { return ShouldProvideDefaultPage(pathInfo) ? new RazorHandler("/defaultpage.cshtml") : null; });
Using a wildcard to accept any URL in a service
You can create a dummy service and simply return the same view, for example:
[Route("/app/{PathInfo*}")] public class App { public string PathInfo { get; set; } } public class MyService : Service { public object Any(App request) { return request; } }
Using a wild card, this service will return the view, for example. /View/App.cshtml on any route starting with /app , for example:
- /attachment
- / app / hello
- / app / hello / my / name / is this? Foo = bar
Partial Page Support
Since a partial reboot is related to pushstate, I also mention the built-in support of ServiceStack for a partial reboot.
ServiceStack Docs is an example of a demo that uses pushstate in browsers that support it, otherwise it reverts to using full-page reloads with browsers that don't.
You can request a partial page with parameter ?format=text.bare , for example.
Although it uses Markdown Razor . In the latest ServiceStack.Razor service, you can access the partial page only with ?format=bare
mythz
source share