diff --git a/jpro-routing/core/src/main/scala/one/jpro/platform/routing/Filters.scala b/jpro-routing/core/src/main/scala/one/jpro/platform/routing/Filters.scala index 3e94920a..a054014f 100644 --- a/jpro-routing/core/src/main/scala/one/jpro/platform/routing/Filters.scala +++ b/jpro-routing/core/src/main/scala/one/jpro/platform/routing/Filters.scala @@ -22,6 +22,22 @@ object Filters { }) } } + def title(title: String): Filter = { route => { request => + val r = route.apply(request) + + Response(r.future.map { + case x: View => + new View { + override def title: String = title + override def description: String = x.description + override def content: all.Node = x.realContent + + override def fullscreen: Boolean = x.fullscreen + } + case x => x + }) + } + } def errorPage(): Filter = errorPage((request, ex) => Response.node(new Label("Error: " + ex.getMessage))) def errorPage(biFunction: BiFunction[Request, Throwable, Response]): Filter = {