diff --git a/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/groovy/Bootstrap.java b/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/groovy/Bootstrap.java index 8e9733f..f7b315b 100644 --- a/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/groovy/Bootstrap.java +++ b/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/groovy/Bootstrap.java @@ -15,8 +15,6 @@ import org.xbib.net.http.HttpHeaderNames; import org.xbib.net.http.HttpHeaderValues; import org.xbib.net.http.HttpResponseStatus; import org.xbib.net.http.HttpVersion; -import org.xbib.net.http.j2html.J2HtmlResourceHandler; -import org.xbib.net.http.j2html.J2HtmlService; import org.xbib.net.http.server.application.web.WebApplication; import org.xbib.net.http.server.domain.BaseHttpDomain; import org.xbib.net.http.server.domain.BaseHttpSecurityDomain; @@ -155,6 +153,7 @@ public final class Bootstrap { .build(); HttpRouter httpRouter = BaseHttpRouter.builder() + .setPrefix("/") .setHandler(400, new GroovyHttpStatusHandler(HttpResponseStatus.BAD_REQUEST, "Bad request", "400.gtpl")) .setHandler(401, new GroovyHttpStatusHandler(HttpResponseStatus.UNAUTHORIZED, "Unauthorized", "401.gtpl")) .setHandler(403, new GroovyHttpStatusHandler(HttpResponseStatus.FORBIDDEN, "Forbidden", "403.gtpl")) @@ -176,11 +175,6 @@ public final class Bootstrap { .setHandler(new ClassLoaderResourceHandler(Bootstrap.class.getClassLoader(), "META-INF/resources/")) .build()) .addService(httpService) - .addService(J2HtmlService.builder() - .setPrefix("/j2html") - .setPath("glob:**") - .setHandler(new J2HtmlResourceHandler()) - .build()) .addService(GroovyTemplateService.builder() .setTemplateName("index.gtpl") .setSecurityDomain(securityDomain) diff --git a/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/j2html/InternalServerErrorHandler.java b/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/j2html/InternalServerErrorHandler.java index 17a29e3..be810fc 100644 --- a/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/j2html/InternalServerErrorHandler.java +++ b/net-http-server-application-web/src/main/java/org/xbib/net/http/server/application/web/j2html/InternalServerErrorHandler.java @@ -1,6 +1,7 @@ package org.xbib.net.http.server.application.web.j2html; import org.xbib.net.Attributes; +import org.xbib.net.Resource; import org.xbib.net.http.j2html.J2HtmlResourceHandler; import org.xbib.net.http.server.application.Application; import org.xbib.net.http.server.resource.HtmlTemplateResourceHandler; @@ -17,12 +18,18 @@ import static j2html.TagCreator.pre; public class InternalServerErrorHandler extends J2HtmlResourceHandler { + @Override + protected Resource createResource(HttpRouterContext httpRouterContext) throws IOException { + return new InternalServerErrorResource(this, httpRouterContext); + } + protected static class InternalServerErrorResource extends J2HtmlResource { protected InternalServerErrorResource(HtmlTemplateResourceHandler templateResourceHandler, HttpRouterContext httpRouterContext) throws IOException { super(templateResourceHandler, httpRouterContext); } + @Override protected String render(Application application, Attributes attributes) { String message = attributes.get(String.class, "_message"); Throwable throwable = attributes.get(Throwable.class, "_throwable");